Prerequisites
- Target system, dependencies and environment configured.
Usage
Purpose
Static analysis reads the app; dynamic instrumentation lets you reach into it while it runs — hooking functions to see their arguments and return values, and modifying behaviour to test how the app responds. Frida is the standard tool: it injects into a running app and lets you intercept and change any function call. This skill covers using Frida to analyse mobile app behaviour at runtime, the technique behind pinning bypass, security-control bypass, and observing what the app actually does with data.
When to use it
The dynamic phase of a mobile assessment, when static analysis has shown you the app's structure and you want to observe or manipulate runtime behaviour. It requires a device you control (rooted/jailbroken is easiest) and an app you're authorised to test.
Procedure
- Set up Frida. Install the Frida server on the test device (rooted/jailbroken) and the Frida client on your machine; confirm it can attach to the target app:
frida-ps -U # list processes on the USB device
frida -U -f <package> # spawn and attach to the app
Objection is a Frida-based toolkit that wraps common tasks (pinning bypass, storage inspection) in ready commands — a good starting point.
- Hook functions to observe behaviour. Intercept a function to log its arguments and return value — this reveals what the app does with inputs, what it sends, and how it processes data. Hooking is the core technique:
// Frida script: hook a method, log args + return
Java.perform(() => {
const C = Java.use('com.app.Crypto');
C.encrypt.implementation = function (data) {
console.log('encrypt input:', data);
const r = this.encrypt(data);
console.log('encrypt output:', r);
return r;
};
});
- Modify behaviour to test controls. Change a function's return value or logic at runtime to bypass a check — root detection returning false, a license check passing, a pinning validation succeeding (the pinning skill). This tests whether security controls can be bypassed by an attacker with device control.
- Inspect data and internal state. Read the app's runtime data — decrypted values, keys in memory, tokens — that static analysis or storage inspection can't reach because they only exist at runtime.
- Use Objection for common tasks. For standard operations (SSL pinning bypass, root-detection bypass, keychain/storage dumping, method enumeration), Objection provides them without writing Frida scripts — faster for routine assessment.
- Combine with the other techniques. Frida is the engine behind pinning bypass and RE-protection bypass; use it to enable traffic inspection and to test the anti-tampering controls.
- Recognise when the app fights back. Anti-instrumentation and Frida-detection (part of RE protections) may detect or block Frida; robust apps require bypassing those first.
Cheatsheet
static = read the app ; Frida = reach INTO it while running (hook functions -> observe + MODIFY)
the engine behind pinning bypass, control bypass, runtime data inspection
needs: device you control (rooted/JB easiest) + authorised app
setup: frida-server on device ; frida-ps -U (list) ; frida -U -f <pkg> (spawn+attach)
Objection = Frida toolkit wrapping common tasks (pinning/root bypass, storage dump) — good start
core techniques
HOOK to observe: log a function's args + return -> what the app does with data/inputs/sends
MODIFY to test controls: change return/logic -> bypass root detection / license / pinning
(tests whether an attacker with device control bypasses the control)
INSPECT runtime state: decrypted values, keys in memory, tokens (static/storage can't reach)
OBJECTION for routine: pinning bypass, root bypass, keychain/storage dump, method enum
app fights back: anti-instrumentation / Frida-detection (RE-protections) -> bypass first
Reading the analysis
- A hooked function revealing its arguments and return = you see what the app actually does with data at runtime — the input to a crypto call, the token it sends, the value of a check. This is Frida's core value: observing behaviour static analysis can only guess at.
- A security control bypassed by modifying a return value (root detection → false, pinning → success) = demonstrates the control is bypassable by an attacker with device control; important for judging whether client-side controls are relied upon inappropriately (they shouldn't be the only defence).
- Runtime data inspected (decrypted secrets, in-memory keys) = data that only exists while running, invisible to static/storage analysis; Frida reaches it.
- Objection handling a routine task (pinning/root bypass, storage dump) = faster than a custom script for standard operations; use it for the common cases.
- The app detecting/blocking Frida = anti-instrumentation is present (an RE protection); robust apps require bypassing that before Frida works. Recognise the resistance.
- Frida enabling traffic inspection and control testing = the dynamic phase working; it's the enabler for much of mobile assessment.
Pitfalls
- Instrumenting an app you're not authorised to test. Frida modifies a running app; do it only on authorised apps on your own test device.
- Expecting Frida to just work on hardened apps. Anti-instrumentation and Frida-detection block it; robust apps require bypassing those first (RE-protections skill).
- Writing custom scripts for routine tasks. Objection already does pinning/root bypass, storage dumps, and enumeration; use it for the common cases and script only what's custom.
- Concluding a client-side control is "secure" because it's there. Frida shows client-side controls (root detection, license checks, even pinning) can be bypassed by an attacker with device control; they shouldn't be the sole defence. That's a finding, not a Frida limitation.
- Missing runtime-only data. Static and storage analysis can't see decrypted values and in-memory keys; Frida is how you reach them — don't stop at static.
References
- Frida documentation (frida.re) and Objection (github.com/sensepost/objection)
- OWASP MASTG (dynamic analysis, runtime instrumentation) and MASVS
- The ssl-pinning-bypass, reverse-engineering-protections, and insecure-data-storage skills
- Frida script repositories (codeshare.frida.re)
Inputs
- Relevant source code, logs, network traces, or system specifications.
Outputs
- Analysis findings, security audit report, or generated code artifacts.
1---2name: dynamic-instrumentation-frida3description: Use when analysing a running mobile app by hooking its functions with Frida — observing and modifying behaviour at runtime to test logic, bypass checks, and inspect data.4---5678## Prerequisites9- Target system, dependencies and environment configured.1011## Usage12### Purpose1314Static analysis reads the app; dynamic instrumentation lets you reach into it while it runs — hooking functions to see their arguments and return values, and modifying behaviour to test how the app responds. Frida is the standard tool: it injects into a running app and lets you intercept and change any function call. This skill covers using Frida to analyse mobile app behaviour at runtime, the technique behind pinning bypass, security-control bypass, and observing what the app actually does with data.1516### When to use it1718The dynamic phase of a mobile assessment, when static analysis has shown you the app's structure and you want to observe or manipulate runtime behaviour. It requires a device you control (rooted/jailbroken is easiest) and an app you're authorised to test.1920### Procedure21221. **Set up Frida.** Install the Frida server on the test device (rooted/jailbroken) and the Frida client on your machine; confirm it can attach to the target app:23 ```24 frida-ps -U # list processes on the USB device25 frida -U -f <package> # spawn and attach to the app26 ```27 Objection is a Frida-based toolkit that wraps common tasks (pinning bypass, storage inspection) in ready commands — a good starting point.282. **Hook functions to observe behaviour.** Intercept a function to log its arguments and return value — this reveals what the app does with inputs, what it sends, and how it processes data. Hooking is the core technique:29 ```30 // Frida script: hook a method, log args + return31 Java.perform(() => {32 const C = Java.use('com.app.Crypto');33 C.encrypt.implementation = function (data) {34 console.log('encrypt input:', data);35 const r = this.encrypt(data);36 console.log('encrypt output:', r);37 return r;38 };39 });40 ```413. **Modify behaviour to test controls.** Change a function's return value or logic at runtime to bypass a check — root detection returning false, a license check passing, a pinning validation succeeding (the pinning skill). This tests whether security controls can be bypassed by an attacker with device control.424. **Inspect data and internal state.** Read the app's runtime data — decrypted values, keys in memory, tokens — that static analysis or storage inspection can't reach because they only exist at runtime.435. **Use Objection for common tasks.** For standard operations (SSL pinning bypass, root-detection bypass, keychain/storage dumping, method enumeration), Objection provides them without writing Frida scripts — faster for routine assessment.446. **Combine with the other techniques.** Frida is the engine behind pinning bypass and RE-protection bypass; use it to enable traffic inspection and to test the anti-tampering controls.457. **Recognise when the app fights back.** Anti-instrumentation and Frida-detection (part of RE protections) may detect or block Frida; robust apps require bypassing those first.4647### Cheatsheet4849```50static = read the app ; Frida = reach INTO it while running (hook functions -> observe + MODIFY)51 the engine behind pinning bypass, control bypass, runtime data inspection52 needs: device you control (rooted/JB easiest) + authorised app5354setup: frida-server on device ; frida-ps -U (list) ; frida -U -f <pkg> (spawn+attach)55 Objection = Frida toolkit wrapping common tasks (pinning/root bypass, storage dump) — good start5657core techniques58 HOOK to observe: log a function's args + return -> what the app does with data/inputs/sends59 MODIFY to test controls: change return/logic -> bypass root detection / license / pinning60 (tests whether an attacker with device control bypasses the control)61 INSPECT runtime state: decrypted values, keys in memory, tokens (static/storage can't reach)62 OBJECTION for routine: pinning bypass, root bypass, keychain/storage dump, method enum6364app fights back: anti-instrumentation / Frida-detection (RE-protections) -> bypass first65```6667### Reading the analysis6869- **A hooked function revealing its arguments and return** = you see what the app actually does with data at runtime — the input to a crypto call, the token it sends, the value of a check. This is Frida's core value: observing behaviour static analysis can only guess at.70- **A security control bypassed by modifying a return value** (root detection → false, pinning → success) = demonstrates the control is bypassable by an attacker with device control; important for judging whether client-side controls are relied upon inappropriately (they shouldn't be the only defence).71- **Runtime data inspected** (decrypted secrets, in-memory keys) = data that only exists while running, invisible to static/storage analysis; Frida reaches it.72- **Objection handling a routine task** (pinning/root bypass, storage dump) = faster than a custom script for standard operations; use it for the common cases.73- **The app detecting/blocking Frida** = anti-instrumentation is present (an RE protection); robust apps require bypassing that before Frida works. Recognise the resistance.74- **Frida enabling traffic inspection and control testing** = the dynamic phase working; it's the enabler for much of mobile assessment.7576### Pitfalls7778- **Instrumenting an app you're not authorised to test.** Frida modifies a running app; do it only on authorised apps on your own test device.79- **Expecting Frida to just work on hardened apps.** Anti-instrumentation and Frida-detection block it; robust apps require bypassing those first (RE-protections skill).80- **Writing custom scripts for routine tasks.** Objection already does pinning/root bypass, storage dumps, and enumeration; use it for the common cases and script only what's custom.81- **Concluding a client-side control is "secure" because it's there.** Frida shows client-side controls (root detection, license checks, even pinning) can be bypassed by an attacker with device control; they shouldn't be the sole defence. That's a finding, not a Frida limitation.82- **Missing runtime-only data.** Static and storage analysis can't see decrypted values and in-memory keys; Frida is how you reach them — don't stop at static.8384### References8586- Frida documentation (frida.re) and Objection (github.com/sensepost/objection)87- OWASP MASTG (dynamic analysis, runtime instrumentation) and MASVS88- The ssl-pinning-bypass, reverse-engineering-protections, and insecure-data-storage skills89- Frida script repositories (codeshare.frida.re)9091## Inputs92- Relevant source code, logs, network traces, or system specifications.9394## Outputs95- Analysis findings, security audit report, or generated code artifacts.