Skip to content
Back to skills

Pentest Mobile React Native

ASecurity

Pentest de mobile React Native — OWASP MASVS L1/L2 + Mobile Top 10 (2024). Cobre insecure storage, SSL pinning, root/jailbreak, deeplink hijack, WebView injection, Hermes bytecode, OTA updates (Expo/CodePush), Frida hooks, anti-tamper e app signing. TRIGGERS: pentest mobile, pentest react native, react native security, masvs, mobile top 10, ssl pinning, deeplink, jailbreak detection, hermes, expo updates, mobile storage, android manifest, ios plist

  • 7 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added December 1, 2026
securityjavascriptgojavashellbashsqlreactawstestinggit

Works with

  • cli
  • api

Security analysis

A100/100

Scanned December 1, 2026

npx -y skills add hbrancalhao/_base --skill pentest-mobile-react-native --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pentest Mobile React Native?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pentest Mobile React Native
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hbrancalhao-pentest-mobile-react-native/badge)](https://www.skillsdirectory.com/skills/hbrancalhao-pentest-mobile-react-native)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pentest-mobile-react-native
description: |
  Pentest de mobile React Native — OWASP MASVS L1/L2 + Mobile Top 10 (2024).
  Cobre insecure storage, SSL pinning, root/jailbreak, deeplink hijack, WebView injection,
  Hermes bytecode, OTA updates (Expo/CodePush), Frida hooks, anti-tamper e app signing.
  TRIGGERS: pentest mobile, pentest react native, react native security, masvs, mobile top 10, ssl pinning, deeplink, jailbreak detection, hermes, expo updates, mobile storage, android manifest, ios plist
---

# 📱 pentest-mobile-react-native — Auditoria Ofensiva de React Native

Cobre RN bare workflow, Expo managed e Expo bare. Base normativa: **OWASP MASVS** (L1/L2) + **Mobile Top 10 2024** + **MASTG** (testing guide).

## Required Reading
- `app.json` / `app.config.ts` (Expo)
- `android/app/src/main/AndroidManifest.xml`
- `android/app/build.gradle`
- `ios/*/Info.plist`
- `metro.config.js`
- `package.json` e nativo (pods, gradle)

---

## M1 — Improper Credential Usage

### Hardcoded secrets no bundle
```bash
rg -n "(apiKey|secret|clientSecret|bearer|accessKey)\s*[:=]" apps/mobile/src/ -i
rg -n "BEGIN (RSA|OPENSSH|EC) PRIVATE KEY" apps/mobile/
```

RN Bundle distribui **TODO** o JS para o dispositivo. Qualquer constante no bundle está pública. Extração:
```bash
# Android
unzip -p app.apk assets/index.android.bundle > bundle.js
# iOS
# extrair do .ipa: Payload/App.app/main.jsbundle
# Se Hermes:
pnpm dlx hermes-assemble-strings main.jsbundle
pnpm dlx hbctool disasm main.hbc out/
```

- [ ] Nenhuma chave de API de 3rd party (Stripe secret, SendGrid, AWS IAM) está no bundle
- [ ] Chaves públicas (Firebase `apiKey`, Google Maps) estão **restritas por bundle id / package name** no console
- [ ] `app.config.ts` não vaza `extra` com secrets; usar EAS Secrets/variáveis de build

---

## M2 — Inadequate Supply Chain Security

- [ ] `package.json` sem `*` ou `latest` em libs nativas críticas
- [ ] `podfile.lock` e `android/gradle/wrapper/gradle-wrapper.properties` com hash
- [ ] Nenhum SDK de 3rd party com `postinstall` script não auditado
- [ ] `react-native-unimodules`, `@expo/*` e `expo-updates` atualizados
- [ ] Verificar [`advisories`](https://github.com/facebook/react-native/security/advisories) da versão em uso

```bash
pnpm audit --audit-level=high
pnpm dlx osv-scanner -r apps/mobile
```

---

## M3 — Insecure Authentication/Authorization

- [ ] Token armazenado em `expo-secure-store` (iOS Keychain / Android Keystore), **NUNCA** em `AsyncStorage`
- [ ] Refresh token rotativo; token de acesso com TTL curto (≤ 15 min)
- [ ] Biometria via `expo-local-authentication` com fallback seguro
- [ ] OAuth com PKCE obrigatório; sem `response_type=token` (implicit flow)

```bash
rg -n "AsyncStorage\.(setItem|getItem)" apps/mobile/src/ | rg -i "token|jwt|password|secret"
rg -n "MMKV|react-native-keychain|SecureStore" apps/mobile/src/
```

**Attack demo**: em dispositivo root/emulador, `AsyncStorage` fica em `/data/data/<pkg>/files/RKStorage` — extrair com `adb pull`.

---

## M4 — Insufficient Input/Output Validation

- [ ] Deeplinks validam esquema e parâmetros (ver M8)
- [ ] WebView não injeta HTML com input do usuário em `source={{html}}`
- [ ] `react-native-webview` com `originWhitelist={['https://*.seudominio.com']}`
- [ ] `postMessage` valida `origin` antes de processar
- [ ] Nenhum `eval`, `Function`, `setTimeout('string', ...)` no JS bundle

```bash
rg -n "WebView" apps/mobile/src/ -A 10 | rg -n "originWhitelist|injectedJavaScript|onMessage"
rg -n "eval\(|new Function\(" apps/mobile/src/
```

---

## M5 — Insecure Communication

### TLS + SSL Pinning
- [ ] `NSAllowsArbitraryLoads=false` no `Info.plist`
- [ ] `android:usesCleartextTraffic="false"` no `AndroidManifest.xml`
- [ ] `networkSecurityConfig` com `<pin-set>` configurado
- [ ] Biblioteca de pinning: `react-native-ssl-pinning` ou `react-native-cert-pinner`
- [ ] Fallback seguro se pinning falhar (não usar HTTP simples)

```bash
rg -n "NSAllowsArbitraryLoads|NSExceptionAllowsInsecureHTTPLoads" ios/
rg -n "usesCleartextTraffic|network_security_config" android/
rg -n "react-native-ssl-pinning|cert-pinner" apps/mobile/package.json
```

**Attack demo**: interceptar com mitmproxy e burp — se capturar tráfego cifrado legível, pinning falhou.

---

## M6 — Inadequate Privacy Controls

- [ ] Info.plist declara apenas permissões usadas (`NSCameraUsageDescription`, `NSLocationWhenInUseUsageDescription`)
- [ ] AndroidManifest sem permissões excessivas (`READ_CONTACTS`, `READ_SMS` sem uso)
- [ ] Nenhum log de PII (CPF, email, token) em produção
- [ ] `__DEV__` é `false` em prod → `console.*` desligado; se não, usar `babel-plugin-transform-remove-console`

```bash
rg -n "console\.(log|warn|info|debug)" apps/mobile/src/ | wc -l
rg -n "<uses-permission" android/app/src/main/AndroidManifest.xml
plutil -p ios/*/Info.plist | rg -i "UsageDescription"
```

---

## M7 — Insufficient Binary Protections

### Root/Jailbreak detection
- [ ] Lib ativa: `jail-monkey` / `react-native-root-detection`
- [ ] Checks adicionais (iOS): arquivos `/Applications/Cydia.app`, `/bin/bash`, `/usr/sbin/sshd`
- [ ] Checks adicionais (Android): `su`, `busybox`, `Magisk`, SafetyNet/Play Integrity

### Anti-debug / Anti-tamper
- [ ] Play Integrity API para Android
- [ ] DeviceCheck + App Attest para iOS
- [ ] Hermes com `bytecode` (dificulta reverse mas não é proteção)
- [ ] ProGuard/R8 habilitado (`android/app/build.gradle`: `minifyEnabled true`)
- [ ] iOS: `strip-frameworks.sh` + Bitcode + habilitar `DEAD_CODE_STRIPPING`

### Frida/objection
Descrever no relatório como testar:
```bash
frida-ps -Uai
objection -g com.seuapp.mobile explore
# iOS: objection ios jailbreak disable / ssl pinning bypass
```

- [ ] App detecta e derruba se `frida-server` está rodando (via lsof simulado/`/proc/net/tcp`)

---

## M8 — Security Misconfiguration (antigo M10 reorganizado)

### Deeplink Hijack
```bash
rg -n "scheme:" android/app/src/main/AndroidManifest.xml -A 5
cat app.json | jq '.expo.scheme, .expo.ios.associatedDomains, .expo.android.intentFilters'
```

- [ ] iOS: `Associated Domains` com `applinks:` assinado (arquivo `apple-app-site-association`)
- [ ] Android: `autoVerify="true"` + `digital-asset-links.json` publicado em `/.well-known/`
- [ ] Se falhar Universal/App Link, cair para esquema custom **sem** realizar ação sensível no handler
- [ ] Params do deeplink validados (ex: `myapp://pay?to=...` deve confirmar com usuário)

**Attack demo** (Android):
```bash
adb shell am start -W -a android.intent.action.VIEW -d "myapp://transfer?to=attacker&amount=9999" com.seuapp
```

### WebView
- [ ] `javaScriptEnabled` só se necessário
- [ ] `allowFileAccess=false`, `allowUniversalAccessFromFileURLs=false`
- [ ] `setMixedContentMode(NEVER)` em Android
- [ ] `WKWebView` (iOS) em vez de `UIWebView` (deprecado)

---

## M9 — Insecure Data Storage

Locais a auditar em dispositivo root:
- Android: `/data/data/<pkg>/{databases,shared_prefs,files,cache}`
- iOS: `~/Library/Containers/<bundle>/Data/{Documents,Library,tmp}`

Bibliotecas:
- ❌ `AsyncStorage` → dados em claro
- ⚠️ `react-native-mmkv` → **NÃO é criptografado por padrão**; usar `encryptionKey`
- ✅ `expo-secure-store` → Keychain/Keystore
- ✅ `react-native-keychain` com `ACCESSIBLE_WHEN_UNLOCKED_THIS_DEVICE_ONLY`
- ✅ `react-native-encrypted-storage` (lib específica de storage cifrado)

```bash
rg -n "new MMKV\(" apps/mobile/src/ -A 3   # validar encryptionKey
rg -n "setGenericPassword|setInternetCredentials" apps/mobile/src/
```

- [ ] Backup desabilitado em Android: `android:allowBackup="false"` + `android:fullBackupContent="@xml/backup_rules"`
- [ ] iOS: arquivos sensíveis com `NSFileProtectionComplete`
- [ ] SQLite (WatermelonDB, expo-sqlite) cifrado (SQLCipher) se contém dados pessoais

---

## M10 — Insufficient Cryptography

- [ ] Sem MD5/SHA1 para integridade sensível
- [ ] AES-GCM (não ECB/CBC) para simétrico
- [ ] Chaves geradas em Keystore/SecureEnclave, não no JS
- [ ] `react-native-crypto` / `crypto-js` com PRNG seguro (`getRandomValues`)

```bash
rg -n "md5|sha1|DES|createCipher\(" apps/mobile/src/ -i
```

---

## OTA Updates (Expo EAS Update / CodePush)

**Altíssimo impacto**: atualização OTA é injeção remota de código.

- [ ] URL de update usa HTTPS + pin de código de signing
- [ ] `expo-updates` com **code signing** habilitado (`EXPO_UPDATES_CODE_SIGNING_CERTIFICATE`)
- [ ] CodePush com `--private-key-path` e verificação em runtime
- [ ] Rollback automático em falha de verificação
- [ ] Branches/canais de update separados (dev/staging/prod)

```bash
cat app.json | jq '.expo.updates'
rg -n "updates\.checkForUpdateAsync|updates\.fetchUpdateAsync" apps/mobile/src/
```

---

## App Signing & Distribuição

### Android
- [ ] Keystore não commitado; `signing.properties` fora do repositório
- [ ] `v2` + `v3` signing scheme habilitados
- [ ] Play App Signing gerenciado no Console

### iOS
- [ ] Certificados/Profiles no EAS ou Apple Developer; `exportOptions.plist` sem credenciais
- [ ] Build server isolado; sem `.p12` no repo

```bash
rg -n "storeFile|storePassword|keyAlias" android/gradle.properties android/app/build.gradle
```

---

## Output Snippet

```markdown
### 📱 Mobile (React Native) — N findings

| ID | Sev | MASVS | CWE | File:Line | Issue |
|----|---|---|---|---|---|
| M-001 | 🔴 Critical | MSTG-STORAGE-1 | CWE-312 | apps/mobile/src/auth/storage.ts:14 | JWT em `AsyncStorage` (texto claro) |
| M-002 | 🟠 High | MSTG-NETWORK-4 | CWE-295 | android/.../network_security_config.xml | Sem SSL pinning |
| M-003 | 🟠 High | MSTG-PLATFORM-3 | CWE-939 | AndroidManifest.xml:22 | Deeplink sem `autoVerify` |
```

## Anti-patterns a SEMPRE reportar

- JWT/PII em `AsyncStorage` ou `MMKV` sem `encryptionKey`
- Ausência de SSL pinning em app financeiro/saúde
- WebView com `javaScriptEnabled` + `source={{uri}}` de input externo
- `android:allowBackup="true"` em app com dados sensíveis
- Deeplink executando ação financeira sem confirmação
- OTA update sem code signing
- `console.log` de token/PII não removido em produção
- `jail-monkey` instalado mas nunca chamado

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.