# 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:
| Layer | What it blocks | Introduced |
|---|---|---|
| User CA store ignored | Apps targeting API 24+ trust only system CAs unless `network_security_config` opts in | Android 7 |
| No CA-install prompt | Apps can no longer prompt the user to add a CA | Android 11 |
| System store immutable | Trust store moved into the Conscrypt APEX module, mounted per process; old `/system` remounts break | Android 14 |
| CT required by default | Apps targeting API 37 on Android 17 reject system-trusted certs without SCTs (`NOT_ENOUGH_SCTS`) | Android 17 |
| App-level pinning | OkHttp `CertificatePinner`, custom `TrustManager`, bundled `.bks`/`.jks` truststores, pinned SPKI hashes | per app |
| Own TLS stack | Flutter ships BoringSSL in `libflutter.so` with its own CA list and never reads the Android config | framework |
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` [[raw/medium.com/android-network-interception-step-by-step-bypassing-https-and-certific-15860|AndroGoat network]], [[raw/medium.com/33-cracks-in-the-armor-hacking-androgoat-to-learn-how-android-apps-rea-15949|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 [[raw/medium.com/android-network-interception-step-by-step-bypassing-https-and-certific-15860|AndroGoat network]].
- MASVS-NETWORK; verify with MASTG-TEST-0022 (custom stores and pinning) and MASTG-TEST-0236 (cleartext traffic).
## Related
- [[Mobile Application Security]] · [[Frida]] · [[Android App Security]] · [[iOS App Security]] · [[Jailbreak and Root Detection Bypass]] · [[OWASP Mobile Top 10]]
## Sources
- [[raw/mas.owasp.org/bypassing-certificate-pinning-owasp-mastg-2754|Bypassing Certificate Pinning (OWASP MASTG)]]
- [[raw/httptoolkit.com/android-17-enables-certificate-transparency-and-breaks-custom-cas-12095|Android 17 enables certificate transparency, and breaks custom CAs]]
- [[raw/httptoolkit.com/defeating-android-certificate-pinning-with-frida-2755|Defeating Android Certificate Pinning with Frida]]
- [[raw/netspi.com/four-ways-to-bypass-android-ssl-verification-and-certificate-pinning-n-2753|Four Ways to Bypass Android SSL Verification and Certificate Pinning]]
- [[raw/github.com/frida-interception-and-unpinning-scripts-to-mitm-all-https-traffic-4921|frida-interception-and-unpinning]]
- [[raw/nowsecure.com/certificate-pinning-for-mobile-apps-lessons-from-the-emudhra-ca-incide-12712|Certificate Pinning for Mobile Apps: Lessons from the eMudhra CA Incident]]
- [[raw/crossfyre.io/locating-flutter-s-tls-certificate-verifier-in-a-stripped-libflutter-s-12016|Locating Flutter's TLS certificate verifier in a stripped libflutter.so]]
- [[raw/infosecwriteups.com/i-wasted-3-days-intercepting-a-flutter-app-here-s-what-actually-works-9829|I Wasted 3 Days Intercepting a Flutter App]]
- [[raw/omaradel.tech/dynamic-instrumentation-and-ssl-pinning-bypass-on-an-android-fintech-a-13587|SSL pinning bypass on an Android FinTech app via Frida]]
- [[raw/approov.io/bypassing-certificate-pinning-using-frida-a-step-by-step-guide-2750|Bypassing Certificate Pinning Using Frida (Approov)]]
- [[raw/jidr.ly/frida-and-burp-suite-on-an-android-emulator-on-apple-silicon-13588|Frida and Burp Suite on an Android emulator on Apple Silicon]]
- [[raw/mas.owasp.org/mobile-app-tampering-and-reverse-engineering-owasp-mastg-3731|Mobile App Tampering and Reverse Engineering (OWASP MASTG)]]
- [[raw/medium.com/android-network-interception-step-by-step-bypassing-https-and-certific-15860|Android network interception: HTTPS and pinning bypass with Burp]]
- [[raw/medium.com/33-cracks-in-the-armor-hacking-androgoat-to-learn-how-android-apps-rea-15949|33 Cracks in the Armor: Hacking AndroGoat]]