βœ“
Field Note Β· Nov 23, 2026 Β· 16 min read

Runtime Hooking & Intercepting Flutter & React Native SSL Pinning on Android 14+ with Frida

How to intercept and audit Flutter BoringSSL certificate pinning on Android 14+ using Frida runtime hooking. Analyze mobile HTTPS traffic in authorized application QA.

Runtime Hooking & Intercepting Flutter & React Native SSL Pinning on Android 14+ with Frida
Authorized Security Research & Defensive Notice This technical guide is strictly intended for authorized security testing, QA debugging, and defensive engineering on systems, devices, and applications you own or have explicit, written authorization to audit. ToolWar strictly prohibits the use of these techniques or utilities for unauthorized access or destructive activities.

The Mobile Security Bottleneck: When Traditional Burp Suite Proxies Fail

In standard Android mobile application penetration testing, intercepting HTTPS network traffic is a mature, straightforward engineering discipline. On classic native Java or Kotlin applications, security engineers install a custom PortSwigger Burp Suite Certificate Authority (CA) into the Android user trust store (or system trust store via Magisk on rooted devices), configure an HTTP proxy, and effortlessly capture API traffic. If the application enforces SSL Pinning using OkHttp or NetworkSecurityConfig, tools like Objection or Xposed modules bypass the check with a single automated hook.

However, when auditing modern cross-platform applications built with Google Flutter, this standard workflow completely collapses. Despite having valid Burp CA certificates installed in the Android system trust store, Burp Suite observes zero HTTPS requests, and the Flutter app reports continuous handshake errors (HandshakeException: Handshake error in client).

This barrier exists because Flutter does not use the Android operating system's Java networking stack. Instead, Flutter compiles ahead-of-time (AOT) to a native machine-code shared object (libflutter.so) that bundles its own statically linked implementation of BoringSSL with a hardcoded CA trust store. To intercept Flutter and modern React Native network streams on Android 14+, penetration testers must use Frida dynamic binary instrumentation (DBI) to patch compiled C++ assembly registers directly in memory.

Flutter BoringSSL Interception: Frida Memory Hooking Architecture

Figure 15.1: The Frida native memory interception mechanism: locating the BoringSSL verification routine in libflutter.so and forcing register return zero.

1. The Native AOT Architecture of Flutter Networking

To understand why Flutter ignores Android proxy configurations and system CAs, we must trace how Dart executes network requests. When developers invoke Dart's HttpClient or packages like Dio, the request is not dispatched through the Android OS networking APIs. Instead, execution passes down to Flutter's native C++ engine:

  1. BoringSSL Static Bundling: Google compiles a tailored fork of OpenSSL (BoringSSL) directly into libflutter.so.
  2. Isolated Root CA Store: BoringSSL does not query the Android Keystore or /system/etc/security/cacerts. It relies exclusively on an internal compiled list of trusted public certificate authorities.
  3. Proxy Blindness: Native Dart sockets do not read Android Wi-Fi proxy settings unless developers manually write custom Dart proxy resolution code.

Consequently, simply setting an HTTP proxy on the device achieves nothing: requests either bypass the proxy entirely or fail immediately when BoringSSL validates Burp Suite's self-signed TLS certificate against its internal compiled trust chain.

Mobile Framework Networking Engine Trust Store Dependency SSL Pinning Layer Interception Vector
Native Android (Kotlin/Java) OkHttp / HttpURLConnection Android System + User CA Trust Store Network Security Config XML / OkHttp Pinner Android-Trust-User-Certs Magisk module / Objection
React Native (Hermes/V8) JavaScript fetch via Native Bridge Inherits host Android OS trust store Native Java OkHttp CertificatePinner Standard Objection / Universal Frida SSL Unpinning
Flutter (Dart AOT) Dart VM compiled BoringSSL Zero (Completely bypasses Android CAs) Statically linked BoringSSL verify routine Native assembly pattern scanning & Frida register patch
Xamarin / .NET MAUI Mono / CoreFX Sockets Embedded Mono X509 Store ServerCertificateValidationCallback Mono runtime method hook via Frida

2. Dissecting the BoringSSL Verification Routine

Inside BoringSSL, TLS handshake certificate validation is governed by an internal C++ function: ssl_crypto_x509_session_verify_cert_chain. In the original BoringSSL source code, the function signature appears as follows:

// <strong>BoringSSL</strong> internal verification prototype:
int ssl_crypto_x509_<strong>session_verify_cert_chain</strong>(
    SSL_HANDSHAKE *hs,
    uint8_t *out_alert,
    STACK_OF(X509) *chain
);

In standard operation, this function returns 1 on verification failure (or raises an alert byte) and returns 0 on success (indicating the certificate chain is cryptographically valid). Because libflutter.so is compiled with symbol tables stripped to reduce binary size, the function name does not exist as an exported dynamic symbol.

3. Locating the Target Function via Machine-Code Signatures

To hook an unexported function across different compiled versions of Flutter, reverse engineers scan process memory for unique ARM64 assembly byte signatures. In modern 64-bit Android builds (ARM64-v8a), the function prologue of session_verify_cert_chain generates a recognizable pattern of register preservation instructions:

// Typical ARM64 disassembly pattern for <strong>BoringSSL</strong> verify chain:
stp    x29, x30, [sp, #-0x30]!
mov    x29, sp
stp    x20, x19, [sp, #0x10]
stp    x22, x21, [sp, #0x20]
mov    x19, x0

We can write a modular Frida JavaScript script that locates libflutter.so in the target process memory, scans its executable .text section for these instruction byte sequences, and attaches an interceptor trampoline.

4. The Universal Frida Interception & Verification Hook for Android 14+

Below is a production-grade Frida script engineered to defeat Flutter SSL Pinning across ARM64 Android 14+ devices:

// flutter_ssl_bypass_arm64.js
Java.perform(function() {
    console.log("[*] Initializing <strong>Flutter</strong> <strong>BoringSSL</strong> Interception Hook...");

    // Wait for native library <strong>libflutter.so</strong> to load into memory
    var m = Process.findModuleByName("<strong>libflutter.so</strong>");
    if (!m) {
        console.log("[-] <strong>libflutter.so</strong> not loaded yet; waiting for dlopen...");
        var dlopen = Module.findExportByName(null, "dlopen");
        Interceptor.attach(dlopen, {
            onLeave: function() {
                m = Process.findModuleByName("<strong>libflutter.so</strong>");
                if (m) hook<strong>Flutter</strong>(m);
            }
        });
    } else {
        hook<strong>Flutter</strong>(m);
    }

    function hook<strong>Flutter</strong>(flutterModule) {
        console.log("[+] <strong>libflutter.so</strong> mapped at: " + flutterModule.base);

        // ARM64 signature pattern for <strong>session_verify_cert_chain</strong>
        var pattern = "F8 5F BC A9 F6 57 01 A9 F4 4F 02 A9 FD 7B 03 A9";
        var matches = Memory.scanSync(flutterModule.base, flutterModule.size, pattern);

        if (matches.length === 0) {
            // Fallback pattern for alternative <strong>Flutter</strong> compiler versions
            pattern = "FF 43 01 D1 F8 5F 01 A9 F6 57 02 A9 F4 4F 03 A9";
            matches = Memory.scanSync(flutterModule.base, flutterModule.size, pattern);
        }

        console.log("[*] Pattern scan found " + matches.length + " matching offsets.");

        matches.forEach(function(match) {
            var targetAddr = match.address;
            console.log("[+] Attaching hook to verification function at: " + targetAddr);

            Interceptor.attach(targetAddr, {
                onEnter: function(args) {
                    // hs = args[0], out_alert = args[1]
                },
                onLeave: function(retval) {
                    console.log("[!] Intercepting <strong>BoringSSL</strong> verification at " + targetAddr + " (original: " + retval + ")");
                    // Force return value to 0x0 (SUCCESS)
                    retval.replace(0x0);
                }
            });
        });
    }
});

5. Transparent Proxying and Traffic Interception Runbook

Because Flutter ignores Android OS proxy settings, you must enforce Transparent Proxying to route all outbound device traffic through your Burp Suite listener:

The complete Flutter interception pipeline executes through 4 coordinated phases:

  1. Daemon Deployment: Deploy and execute frida-server with root privileges on the Android 14 test device.
  2. Library Memory Scanning: Enumerate memory ranges of libflutter.so to locate the session_verify_cert_chain machine-code pattern.
  3. Return Value Forcing: Intercept the function epilogue and force register X0 (ARM64) to return 0x1 (verification success).
  4. Transparent Redirection: Configure device iptables to silently steer all outgoing HTTPS traffic to your local Burp Suite listener.
  1. Configure iptables Redirect on Android: Run an iptables command on the rooted Android device (or deploy a local WireGuard/tun2socks client) to redirect all TCP traffic destined for ports 80 and 443 directly to your workstation's Burp Suite proxy IP:
    # Redirect all outgoing HTTPS traffic to Burp <strong>transparent proxy</strong> at 192.168.1.50:8080
    iptables -t nat -A OUTPUT -p tcp --dport 443 -j DNAT --to-destination 192.168.1.50:8080
    
  2. Enable Transparent Proxying in Burp Suite: Under Burp Suite > Proxy > Proxy Settings > Edit Listener, navigate to the "Request Handling" tab and check "Support invisible proxying".
  3. Spawn Target Application with Frida:
    frida -U -f com.target.financialapp -l flutter_ssl_bypass_arm64.js --no-pause
    

As the application initializes, Frida intercepts the native BoringSSL verification routine, replaces return codes with zero, and passes all REST, GraphQL, and WebSocket API requests cleanly into your Burp Suite HTTP history in decrypted cleartext.

For static manifest and security decompilation of Android APKs prior to runtime hooking, inspect binary structures with APKInspector and disassemble native shared objects using Ghidra and x64dbg. Ensure test coverage encompasses web APIs using CSRFTester.

Frequently Asked Questions

Q1: Can Flutter certificate verification be intercepted on non-rooted Android devices?

Yes, by utilizing APK repackaging frameworks like Frida-Gadget or Objection. Researchers unpack the APK using apktool, inject `libfrida-gadget.so` into the native library directory, add a `System.loadLibrary("frida-gadget")` call into the smali entry point, and re-sign the APK with a debug keystore. When launched, the app automatically loads the Frida hook without requiring root access.

Q2: Why does Android 14 introduce additional hurdles for mobile testing?

Starting in Android 14, Google converted the system CA certificate directory (`/system/etc/security/cacerts`) into an immutable, read-only APEX mount (`com.android.conscrypt.apex`). Even with root permissions, standard `mount -o remount,rw /system` commands fail. Analysts must use Magisk modules like MagiskTrustUserCerts or Zygisk-TrustUserCerts to overlay custom CAs into the system trust store dynamically at boot time.

Q3: How does React Native SSL pinning differ from Flutter?

React Native compiles its JavaScript UI logic into Hermes or JavaScriptCore bytecode, but executes HTTP network calls through the underlying platform's native networking stack (OkHttp on Android, NSURLSession on iOS). Therefore, standard Java-level OkHttp certificate pinner hooks reliably bypass React Native pinning without requiring native assembly scanning in shared objects.

Q4: Can Flutter applications detect when Frida is attached to the process?

Yes, enterprise apps incorporate anti-Frida detection: scanning `/proc/self/maps` for "frida-agent.so", checking for open listening ports on 27042, and deploying watchdog ptrace threads. Analysts neutralize anti-Frida checks by renaming the Frida server binary, using custom D-Bus socket names, or preloading Frida scripts that hook `fopen()` and `ptrace()` before the application prologue executes.

KS

Kapil Soni

Updated test bio for ToolWar lead researcher

πŸ’¬ Discussion

0 comments
No comments yet. Have insights or questions regarding this article? Join the discussion!