Skip to content

Commit eb977f7

Browse files
authored
Merge pull request #1877 from HackTricks-wiki/research_update_src_mobile-pentesting_android-app-pentesting_frida-tutorial_frida-tutorial-1_20260210_025308
Research Update Enhanced src/mobile-pentesting/android-app-p...
2 parents ec8dcab + b2ee373 commit eb977f7

1 file changed

Lines changed: 42 additions & 2 deletions

File tree

src/mobile-pentesting/android-app-pentesting/frida-tutorial/frida-tutorial-1.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,54 @@ Java.perform(function () {
127127
})
128128
```
129129

130+
## Hooking on recent Android versions (14/15/16)
131+
132+
- From **Frida 17.1.x+** Java hooking on Android 14–16 is stable again (ART quick entrypoint offsets were fixed). If `Java.choose` returns nothing on Android 14+, upgrade **frida-server/gadget** and the **CLI/Python** packages to >=17.1.5.
133+
- Apps with early anti-debug checks often die before `attach`. Use **spawn** so hooks load before `onCreate`:
134+
135+
```bash
136+
frida -U -f infosecadventures.fridademo -l hook1.js --no-pause
137+
```
138+
139+
- When multiple overloads exist, select the target explicitly:
140+
141+
```javascript
142+
var Cls = Java.use("com.example.Class")
143+
Cls.doThing.overload('java.lang.String', 'int').implementation = function(s, i) {
144+
return this.doThing(s, i)
145+
}
146+
```
147+
148+
## Stealthier injection with Zygisk Gadget
149+
150+
Some apps detect **ptrace** or `frida-server`. Magisk/Zygisk modules can load **frida-gadget** inside Zygote so no process is ptraced:
151+
152+
1. Install a Zygisk gadget module (e.g., `zygisk-gadget`) and reboot.
153+
2. Configure the target package and an optional delay to bypass startup checks:
154+
155+
```bash
156+
adb shell "su -c 'echo infosecadventures.fridademo,5000 > /data/local/tmp/re.zyg.fri/target_packages'"
157+
```
158+
159+
3. Launch the app and attach to the gadget name:
160+
161+
```bash
162+
frida -U -n Gadget -l hook3.js
163+
```
164+
165+
Because the gadget is injected by Zygote, APK integrity checks stay untouched and basic ptrace/Frida string checks usually fail.
166+
130167
## Important
131168

132-
In this tutorial you have hooked methods using the name of the mathod and _.implementation_. But if there were **more than one method** with the same name, you will need to **specify the method** that you want to hook **indicating the type of the arguments**.
169+
In this tutorial you have hooked methods using the name of the method and _.implementation_. But if there were **more than one method** with the same name, you will need to **specify the method** that you want to hook **indicating the type of the arguments**.
133170

134171
You can see that in [the next tutorial](frida-tutorial-2.md).
135172

136173

137-
{{#include ../../../banners/hacktricks-training.md}}
138174

139175

176+
## References
140177

178+
- [Frida News (Android 14–16 fixes & Frida 17.x releases)](https://frida.re/news/)
179+
- [zygisk-gadget – Zygisk module that loads frida-gadget](https://github.com/hackcatml/zygisk-gadget)
180+
{{#include ../../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)