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/android_ca_inject.sh

View on GitHub
#!/usr/bin/env bash
#
# android_ca_inject.sh — Trust a custom CA on Android 14/15 (Conscrypt-APEX, immutable trust store)
#
# The system trust store moved to /apex/com.android.conscrypt/cacerts which cannot be remounted rw.
# This injects the CA by bind-mounting a modified cert dir over the APEX path INSIDE the Zygote mount
# namespace, so every newly spawned app inherits it. /apex uses PRIVATE propagation, so we nsenter
# Zygote's mount ns explicitly. The mount is non-persistent (gone on Zygote restart/reboot) -> a watch
# loop re-injects.
#
# USAGE:
#   1) Compute the hashed filename for your CA (run on host):
#        openssl x509 -inform PEM -subject_hash_old -in cacert.pem | head -1     # e.g. 9a5ba575
#        cp cacert.pem 9a5ba575.0
#   2) adb push 9a5ba575.0 /data/local/tmp/
#   3) bash android_ca_inject.sh 9a5ba575.0 /data/local/tmp/9a5ba575.0
#
# DEPENDENCIES: rooted device (Magisk), adb, nsenter+mount on device (toybox/busybox), bash on host.
# SCOPE: authorized testing only. Nothing is written to /system or the APEX; reboot fully reverts.
set -euo pipefail

CERT_NAME="${1:?usage: android_ca_inject.sh <hashed.0 name> <device path to cert> }"
DEV_CERT_PATH="${2:?provide on-device path to the hashed cert, e.g. /data/local/tmp/9a5ba575.0}"
APEX_CACERTS="/apex/com.android.conscrypt/cacerts"
WORK="/data/local/tmp/ca_inject"

echo "[*] Preparing on-device certificate directory..."
adb shell su -c "
  set -e
  rm -rf '$WORK'; mkdir -p '$WORK'
  # seed with the existing APEX certs so we don't drop the system roots
  cp -f $APEX_CACERTS/* '$WORK'/ 2>/dev/null || cp -f /system/etc/security/cacerts/* '$WORK'/ 2>/dev/null || true
  cp -f '$DEV_CERT_PATH' '$WORK/$CERT_NAME'
  chown 0:0 '$WORK'/*
  chmod 644 '$WORK'/*
  # SELinux context must match a system trust file
  chcon u:object_r:system_file:s0 '$WORK'/* 2>/dev/null || true
"

echo "[*] Injecting bind-mount into Zygote namespace(s) and watching..."
# Run a persistent watcher on-device. It bind-mounts $WORK over the APEX path inside each zygote's
# mount namespace and re-applies if zygote restarts.
adb shell su -c "
  inject() {
    for zpid in \$(pidof zygote zygote64 2>/dev/null); do
      nsenter --target \$zpid --mount -- /bin/sh -c '
        mount --bind \"$WORK\" \"$APEX_CACERTS\" 2>/dev/null \
          && echo \"[+] mounted into zygote pid '\$zpid'\" \
          || true
      ' 2>/dev/null || \
      nsenter -t \$zpid -m -- mount --bind '$WORK' '$APEX_CACERTS' 2>/dev/null || true
    done
  }
  last=\$(pidof zygote zygote64 2>/dev/null)
  inject
  echo '[*] watch loop started; Ctrl-C / kill adb to stop (mount auto-clears on zygote restart).'
  while true; do
    cur=\$(pidof zygote zygote64 2>/dev/null)
    if [ \"\$cur\" != \"\$last\" ]; then
      echo '[*] zygote changed -> re-injecting'
      inject
      last=\$cur
    fi
    sleep 2
  done
"
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