Skip to content
Back to Blog
·8 min read·technology

Frida for Android App Pentesting: Runtime Instrumentation Guide

Learn how Frida enables authorised Android app pentesting through runtime hooking, SSL pinning bypass, and MASVS-aligned mobile security testing in India.

BR

Bachao.AI Research Team

Cybersecurity Research

Scan Your Attack Surface

Security exposure this creates

Unpatched vulnerabilities in your tech stack are the #1 entry point for breaches targeting Indian businesses. Here's what to watch.

Frida is a dynamic instrumentation toolkit that lets an authorised tester attach to a running Android app, hook Java and native methods, and change behaviour in memory without touching the APK on disk. For Indian fintech and neobank apps, this matters because static analysis alone misses logic that only executes at runtime — SSL pinning checks, root-detection routines, and crypto key handling. Under OWASP MASVS/MASTG, dynamic testing with Frida is the standard technique for verifying resiliency controls that static tools cannot fully validate. Used only on apps you own or are contracted to test, it turns "we assume this is secure" into evidence.

What Frida Actually Does at Runtime

Frida injects a JavaScript engine into the target process. From that vantage point, a tester can:

    1. Hook methods — intercept any Java method call (via Java.perform) or native function (via Interceptor.attach), read its arguments, and replace its return value.
    2. Trace execution — log every call to a class or function to understand undocumented logic, such as how an app derives a device fingerprint.
    3. Tamper with control flow — force a boolean check (e.g. isRooted()) to always return false, or force a licence/subscription check to return true.
    4. Inspect memory and crypto — dump keys, IVs, and plaintext right before or after encryption calls, even when the network traffic itself is encrypted and pinned.
This is fundamentally different from decompiling an APK. Static review shows what code could do; Frida shows what the app actually does with real inputs, in the emulator or on a rooted test device, session by session.
graph TD A[Attach Frida to process] --> B[Hook target methods] B --> C[Bypass root and pinning checks] C --> D[Inspect crypto and logic] D --> E[Report and harden] style A fill:#1e3a5f,stroke:#3B82F6,color:#e2e8f0 style B fill:#1e3a5f,stroke:#3B82F6,color:#e2e8f0 style C fill:#5f1e1e,stroke:#EF4444,color:#e2e8f0 style D fill:#5f1e1e,stroke:#EF4444,color:#e2e8f0 style E fill:#1e3d2f,stroke:#10B981,color:#e2e8f0
🛡️
SECURITY
Every technique below assumes you own the app, hold a signed authorisation letter, or are working under a contracted VAPT engagement. Attaching Frida to an app you do not have written permission to test is unauthorised access under the IT Act, 2000, regardless of intent.

Hooking Methods: Reading and Rewriting Logic Live

The most common Frida workflow on Android starts with Java.perform(), which gives access to the app's loaded classes. A tester enumerates classes with a target package name, picks a suspicious method — say, a validateTransaction() call in a payments SDK — and overrides its implementation to log arguments before calling the original method through. This reveals things a decompiled .smali file cannot: the actual value of a session token at the moment of an API call, whether a discount or fraud-score field is validated client-side (and therefore trivially bypassable), and whether sensitive data briefly exists in plaintext in a variable before encryption.

For native code (many fintech apps ship OTP verification, tokenisation, or anti-tamper logic in a .so library for obfuscation), Interceptor.attach() hooks the function at the assembly boundary, letting the tester dump register values on entry and exit — independent of whatever the Java layer around it does.

Setting Up a Frida Environment for Android Pentesting

Frida uses a client-server model: frida-server runs on the target device — a rooted physical Android device or a rooted emulator image such as Genymotion or a custom AVD — while the tester's frida-tools (installed on the host with pip install frida-tools) connect over USB or a forwarded port. The two sides must be architecture- and version-matched; running an ARM64 frida-server binary against an x86_64 emulator, or pairing a newer frida-tools release on the host with an older frida-server on the device, is the most common cause of "failed to attach" errors and hooks that silently never fire. A typical session starts with frida-ps -Uai to list installed packages on the connected device, then frida -U -f com.package.name -l script.js --no-pause to spawn the target app with the hook script attached from process start. Spawning rather than attaching to an already-running process matters for fintech apps specifically, because root-detection and pinning checks often run within the first few hundred milliseconds after launch — a late attach can miss the window entirely and produce a false "no protections found" result.

Know your vulnerabilities before attackers do

Run a free VAPT scan — takes 5 minutes, no signup required.

Book Your Free Scan

Bypassing Root Detection and SSL Pinning

Two checks dominate mobile app hardening reviews, and both are textbook Frida targets:

  1. Root/jailbreak detection — apps typically check for su binaries, Magisk artifacts, or build tags. A single hook forcing the detection method's return value to false disables the check for the test session, letting the assessment continue on a rooted device that more closely resembles a compromised end-user phone.
  2. Certificate/SSL pinning — apps pin a certificate or public key to prevent man-in-the-middle interception, even over a legitimate TLS proxy like Burp Suite. Frida scripts (the community's frida-multiple-unpinning approach is widely referenced in MASTG) hook the app's TrustManager or OkHttp CertificatePinner and force every certificate check to pass, so a tester can route traffic through an interception proxy and inspect API payloads that would otherwise be invisible.
⚠️
WARNING
If an app's root detection or pinning can be defeated with a public, off-the-shelf Frida script and no custom engineering, that is itself a finding — MASTG treats "trivially bypassable" resiliency controls as a resiliency gap, not a functioning defence.

Both bypasses matter for fintech specifically: they are the same techniques a malware author would use to intercept OTPs, session tokens, or account data from a repackaged or sideloaded version of a banking app running on a compromised device.

What Runtime Instrumentation Reveals About Insecure Storage and Logic

Once pinning and root checks are bypassed, dynamic testing typically surfaces a predictable set of issues, mapped to MASVS storage and crypto requirements:

Finding classWhat Frida revealsMASVS/MASTG reference
Hardcoded or derivable crypto keysKey material visible in memory or logged before an AES callMASVS-CRYPTO
Client-side-only business logicFraud score, discount, or KYC checks can be forced to passMASVS-RESILIENCE
Plaintext data in transit brieflySensitive fields visible pre-encryption in a hooked methodMASVS-CRYPTO-1
Weak/ineffective root detectionSingle hook disables all checks, no secondary validationMASVS-RESILIENCE-1
Sensitive data in shared prefs/logsValues traced from a hooked setter into insecure storage APIsMASVS-STORAGE-1
20%Of mobile apps assessed contain hardcoded encryption keys (NowSecure, 525,600+ app assessments, 2025)
67%Of mobile apps assessed use broken or weak encryption, the layer Frida testing exposes directly (NowSecure, 2025)
🚨
DANGER
Under the DPDP Act 2023, a data fiduciary that fails to take reasonable security safeguards against a personal data breach faces a penalty in the highest slab prescribed by the Act (MeitY, DPDP Act 2023). Insecure client-side storage of KYC or financial data, the kind Frida testing routinely surfaces, falls squarely into that exposure.
💡
TIP
Run the same Frida script across three builds — production, staging, and an intentionally "hardened" build — to see whether obfuscation or added checks actually change tester effort, or just add noise that a determined attacker scripts around once.

Defence: What Actually Slows Down a Frida-Capable Attacker

Obfuscation and a single root-check are not defences against runtime instrumentation — they are speed bumps. A realistic MASVS-aligned defence-in-depth stack looks like this:

    1. RASP (Runtime Application Self-Protection) — detect Frida's own presence (its default server port, named pipes, injected library signatures, and TracerPid anomalies) and respond by degrading functionality or terminating the session, rather than relying on a single boolean check.
    2. Multi-layered integrity checks — validate app signature, installer source, and code integrity at multiple points in the flow (not just at startup), so a bypass at one point doesn't compromise the whole session.
    3. Native-layer sensitive logic — move fraud/KYC-adjacent decisions and key handling into native code with anti-hooking checks (stack trace inspection, inline hooking detection), since native hooks require more attacker effort than Java-layer ones.
    4. Server-side validation as the real control — never trust a client-side check for anything that affects money movement or KYC status. Treat every client-side flag as advisory; re-validate on the server. This is the single control that neutralises most Frida-based tampering, because bypassing a client check achieves nothing if the server independently re-checks.
    5. Certificate pinning with fallback monitoring — pin certificates, but also monitor and alert server-side on TLS anomalies and unusual client behaviour, since pinning alone will eventually be bypassed by a sufficiently motivated attacker.
ℹ️
INFO
MASTG explicitly frames anti-Frida and anti-root checks as resiliency controls, not security controls — they raise attacker cost, they do not replace server-side authorisation and validation.
pie title Mobile App Risk Categories "Insecure data storage" : 30 "Weak crypto implementation" : 22 "Client-side trust logic" : 20 "Insufficient transport protection" : 16 "Reverse-engineering exposure" : 12

Bringing This Into a Structured Assessment

A one-off Frida session by an internal developer is useful for debugging; it is not a security assessment. A structured MASVS-aligned mobile pentest — static review, dynamic instrumentation, API testing behind the mobile layer, and a written report mapped to MASTG test cases — is what regulators and enterprise customers actually expect to see evidence of. For apps handling payments or KYC data, this dynamic layer is typically delivered with a CERT-In empanelled partner where a formal empanelled certificate is required for a tender or regulatory submission.

🎯Key Takeaway
Runtime instrumentation with Frida is not an exotic attack technique — it is the standard way OWASP MASVS/MASTG-aligned testers verify whether an Android app's resiliency controls (root detection, pinning, obfuscation) hold up against real tampering, or exist only on paper. Every finding it surfaces should map to a server-side fix, not just a client-side patch.

Fintech teams that want this validated on their own app, on their own authorised build, can start with a free VAPT scan run on Dhisattva AI Pvt Ltd's automated assessment platform, and route mobile-specific findings into a structured DPDP-aligned remediation plan — see DPDP compliance guidance for how storage and logging findings map to statutory obligations. More assessment methodology is available on the Bachao.AI blog.

Sources

Frequently Asked Questions

Is using Frida on an Android app legal in India?
It is legal only when you own the app or have explicit written authorisation to test it, such as a signed VAPT engagement letter. Attaching Frida to any third-party app without that authorisation is unauthorised access under the IT Act, 2000.
Can SSL pinning stop a Frida-based attacker entirely?
No. Pinning raises the effort required but is routinely bypassed with published unpinning scripts unless combined with RASP-style Frida-detection and server-side anomaly monitoring, as reflected in OWASP MASTG resiliency guidance.
Why does root detection alone not count as a real defence?
Because a single hook can force the detection function to return false for the entire session. MASVS treats root/root-detection checks as resiliency controls that raise attacker cost, not as a substitute for server-side validation of sensitive actions.
What is the biggest finding Frida testing usually reveals in fintech apps?
Client-side-only business logic — fraud scores, KYC gates, or transaction limits that are checked in the app but not re-verified on the server, meaning a tampered client can bypass them entirely.
Does obfuscating an APK stop dynamic instrumentation?
No. Obfuscation slows static reverse-engineering but does not prevent Frida from hooking methods at runtime, since hooks operate on the running process rather than the decompiled source.
How does this fit into a full mobile app pentest?
Runtime instrumentation is one layer alongside static code review, API/backend testing, and storage analysis; a MASVS/MASTG-aligned report ties every dynamic finding back to a specific test case and a server-side remediation, not just a client patch.
BR

Bachao.AI Research Team

Cybersecurity Research

AI-powered security research and threat intelligence from the Bachao.AI team. Covering the latest vulnerabilities, CVEs, and cybersecurity developments affecting Indian businesses.

Get cybersecurity insights for Indian SMBs

Weekly vulnerability alerts, DPDP compliance tips, and security guides. No spam — unsubscribe anytime.

We respect your privacy. Your email is never shared.

Find out if you're exposed to this class of threat

Free automated scan — risk score in under 2 hours. No credit card required.

Scan Your Attack Surface
Find your vulnerabilitiesStart free scan →