Certificate Pinning Bypass

The analyst problem of getting an app to accept an intercepting proxy’s certificate despite a narrowed trust store (pinning) or a non-platform TLS stack — a precondition for inspecting mobile API traffic, and the control whose strength MASVS-NETWORK measures.

Why interception got hard

Everything rests on whether the app trusts the tester’s CA. Android has removed the easy paths in stages, so interception is now a layered problem rather than one setting:

LayerWhat it blocksIntroduced
User CA store ignoredApps targeting API 24+ trust only system CAs unless network_security_config opts inAndroid 7
No CA-install promptApps can no longer prompt the user to add a CAAndroid 11
System store immutableTrust store moved into the Conscrypt APEX module, mounted per process; old /system remounts breakAndroid 14
CT required by defaultApps targeting API 37 on Android 17 reject system-trusted certs without SCTs (NOT_ENOUGH_SCTS)Android 17
App-level pinningOkHttp CertificatePinner, custom TrustManager, bundled .bks/.jks truststores, pinned SPKI hashesper app
Own TLS stackFlutter ships BoringSSL in libflutter.so with its own CA list and never reads the Android configframework

On iOS the equivalent work is done through the instrumentation toolchain rather than trust-store edits (see Frida, Jailbreak and Root Detection Bypass).

Why pinning exists (and its limits)

Pinning is a legitimate control, not just an obstacle. The 2025 eMudhra incident — intermediate certs generated with trivially guessable private keys, undetected ~18 months, then cross-signed by a major CA — is the standard argument: an app that talks to a handful of endpoints should not trust all ~75 root owners in the OS store. NowSecure’s guidance is to pin vetted roots or intermediates, not leaves, so certificate rotation doesn’t brick already-installed apps, and to fail closed. CRL, OCSP and CT are weaker fallbacks because on Android they largely fail open or are disabled.

The limit is the trust model: any pin lives inside a binary the attacker controls on their own device, so on a rooted/jailbroken test device a determined analyst gets through. Pinning raises the cost of passive MitM for ordinary users; it is not a substitute for server-side authorization (Broken Access Control) or attestation.

The spectrum of approaches (what research describes)

Tooling and writeups describe a rough escalation, from cheapest to most involved:

  • Trust-store level — installing or repackaging a proxy CA as a system/NSC trust anchor. Defeats apps with no pinning at all. The Android 17 CT change breaks this class of tooling (HTTP Toolkit, AdGuard Cert); HTTP Toolkit’s published workaround is to run private CT logs so its forged leaves carry SCTs, exploiting that clients don’t verify inclusion proofs.
  • Generic runtime instrumentation — Objection’s sslpinning disable, Frida CodeShare’s frida-multiple-unpinning, Xposed modules (TrustMeAlready, SSLUnpinning), and HTTP Toolkit’s frida-interception-and-unpinning (which also redirects traffic, injects a CA, patches CT checks and forces HTTP/3 down to TCP). These hook well-known validation entry points such as Conscrypt’s TrustManagerImpl.verifyChain.
  • Static patching — apk-mitm and manual smali edits to pinned hashes or bundled truststores, then repackage/re-sign. MASTG-TECH-0012 documents the file locations and keytool round-trip for BKS stores.
  • Obfuscated custom pinning — fingerprint the library from residual strings/licence files, then hook or rewrite its known API (e.g. R8-mangled OkHttp CertificatePinner.Builder.add).
  • Non-platform / native stacks — patch the verifier inside the native library. Crossfyre’s writeup identifies Flutter’s ssl_crypto_x509_session_verify_cert_chain in a stripped (not obfuscated) libflutter.so structurally — it is the one function cross-referencing both ssl_client and ssl_server — rather than by brittle byte signatures that fail silently across engine versions.

Flutter tells: Firebase/Crashlytics traffic (ordinary Java stack) decrypts while the app’s own API fails, often as a generic “no internet” rather than a TLS error; Dart also ignores the system proxy. Analysts report that individual tools (ReFlutter, Objection, stock scripts) each failed and only covering every validation path at once worked.

Notable cases

  • Obfuscated FinTech app: OkHttp3 CertificatePinner plus a custom TrustManager under ProGuard, bypassed by hooking the pinner and verify path, exposing transaction endpoints (Omar Adel).
  • ShipFast demo pinned via NSC, intercepted with Frida + mitmproxy on an emulator (Approov).
  • Android 17 CT rollout breaking system-CA interception tooling (NET::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED).
  • AndroGoat (OWASP training app): one endpoint over plain HTTP; HTTPS to owasp.org decrypted once Burp’s CA was trusted because network_security_config.xml held cleartextTrafficPermitted="true" and <certificates src="user"/>; OkHttp3 CertificatePinner.check hooked with Frida to always pass; the NSC <pin-set> disabled with Objection android sslpinning disable AndroGoat network, AndroGoat.

Defenses and verification

  • Pin vetted root/intermediate SPKIs via NSC <pin-set> or OkHttp CertificatePinner, with a backup pin, failing closed.
  • Expect pinning to be bypassable on an attacker-owned device; pair it with server-side authZ and attestation rather than treating client TLS as API protection.
  • Remove <certificates src="user"/> and set cleartextTrafficPermitted="false"; pair pinning with root and hook detection and alert on bypass attempts; add application-level encryption for the most sensitive payloads so a successful interception still yields ciphertext AndroGoat network.
  • MASVS-NETWORK; verify with MASTG-TEST-0022 (custom stores and pinning) and MASTG-TEST-0236 (cleartext traffic).

Sources