Skip to content

Commit 1847c9a

Browse files
author
HackTricks News Bot
committed
Add content from: frida-jdwp-loader: JDWP-based Frida injection without root o...
1 parent 552cc55 commit 1847c9a

File tree

2 files changed

+42
-12
lines changed

2 files changed

+42
-12
lines changed

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

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,30 @@ Notes
8484
- Gadget is detected by some protections; keep names/paths stealthy and load late/conditionally if needed.
8585
- On hardened apps, prefer rooted testing with server + late attach, or combine with Magisk/Zygisk hiding.
8686

87+
## JDWP-based Frida injection without root/repackaging (frida-jdwp-loader)
88+
89+
If the APK is debuggable (android:debuggable="true"), you can attach over JDWP and inject a native library at a Java breakpoint. No root and no APK repackaging.
90+
91+
- Repo: https://github.com/frankheat/frida-jdwp-loader
92+
- Requirements: ADB, Python 3, USB/Wireless debugging. App must be debuggable (emulator with `ro.debuggable=1`, rooted device with `resetprop`, or rebuild manifest).
93+
94+
Quick start
95+
```bash
96+
git clone https://github.com/frankheat/frida-jdwp-loader.git
97+
cd frida-jdwp-loader
98+
# Inject frida-gadget.so into a debuggable target
99+
python frida-jdwp-loader.py frida -n com.example.myapplication
100+
# Keep the breakpoint thread suspended for early hooks
101+
python frida-jdwp-loader.py frida -n com.example.myapplication -s
102+
# Networkless: run a local agent script via Gadget "script" mode
103+
python frida-jdwp-loader.py frida -n com.example.myapplication -i script -l script.js
104+
```
105+
106+
Notes
107+
- Modes: spawn (break at Application.onCreate) or attach (break at Activity.onStart). Use `-b` to set a specific Java method, `-g` to select Gadget version/path, `-p` to choose JDWP port.
108+
- Listen mode: forward Gadget (default 127.0.0.1:27042) if needed: `adb forward tcp:27042 tcp:27042`; then `frida-ps -H 127.0.0.1:27042`.
109+
- This leverages JDWP debugging. Risk is shipping debuggable builds or exposing JDWP.
110+
87111
## Self-contained agent + Gadget embedding (Frida 17+; automated with Objection)
88112

89113
Frida 17 removed the built-in Java/ObjC bridges from GumJS. If your agent hooks Java, you must include the Java bridge inside your bundle.
@@ -165,7 +189,7 @@ diff -r org.secuso.privacyfriendlydicer org.secuso.privacyfriendlydicer.objectio
165189
```
166190
Expected changes:
167191
- AndroidManifest.xml may include `<uses-permission android:name="android.permission.INTERNET"/>`
168-
- New native libs under lib/<abi>/ as above
192+
- New native libs under `lib/<abi>/` as above
169193
- Launchable activity smali contains a static `<clinit>` that calls System.loadLibrary("frida-gadget")
170194

171195
5) Split APKs
@@ -180,11 +204,6 @@ adb install-multiple split1.apk split2.apk ...
180204
```
181205
- For distribution, you can merge splits into a single APK with APKEditor, then align/sign
182206

183-
Defensive notes (what to look for when hardening)
184-
- Implement signature/repackage checks and runtime integrity/attestation
185-
- Detect unexpected System.loadLibrary("frida-gadget") or suspicious native libs at startup
186-
- Avoid declaring unused INTERNET permission; reduce gadget detection surface
187-
188207
## Tutorials
189208

190209
### [Tutorial 1](frida-tutorial-1.md)
@@ -200,7 +219,7 @@ Defensive notes (what to look for when hardening)
200219
**From**: [https://11x256.github.io/Frida-hooking-android-part-2/](https://11x256.github.io/Frida-hooking-android-part-2/) (Parts 2, 3 & 4)\
201220
**APKs and Source code**: [https://github.com/11x256/frida-android-examples](https://github.com/11x256/frida-android-examples)
202221

203-
**Follow the[ link to read it.](frida-tutorial-2.md)**
222+
**Follow the [link to read it.](frida-tutorial-2.md)**
204223

205224
### [Tutorial 3](owaspuncrackable-1.md)
206225

@@ -247,9 +266,8 @@ Hook the function `a()` of the class `sg.vantagepoint.a.c`
247266

248267
```javascript
249268
Java.perform(function () {
250-
; rootcheck1.a.overload().implementation = function() {
251269
rootcheck1.a.overload().implementation = function() {
252-
send("sg.vantagepoint.a.c.a()Z Root check 1 HIT! su.exists()");
270+
send("sg.vantagepoint.a.c.a()Z Root check 1 HIT! su.exists()")
253271
return false;
254272
};
255273
});
@@ -296,6 +314,9 @@ activity.onCreate.overload("android.os.Bundle").implementation = function (
296314

297315
Hooking a decryption function. Print the input, call the original function decrypt the input and finally, print the plain data:
298316

317+
<details>
318+
<summary>Hooking a decryption function (Java) — print inputs/outputs</summary>
319+
299320
```javascript
300321
function getString(data) {
301322
var ret = ""
@@ -321,6 +342,8 @@ aes_decrypt.a.overload("[B", "[B").implementation = function (var_0, var_1) {
321342
}
322343
```
323344

345+
</details>
346+
324347
### Hooking functions and calling them with our input
325348

326349
Hook a function that receives a string and call it with other string (from [here](https://11x256.github.io/Frida-hooking-android-part-2/))
@@ -368,5 +391,9 @@ Java.choose("com.example.a11x256.frida_test.my_activity", {
368391
- [Frida releases (server binaries)](https://github.com/frida/frida/releases)
369392
- [Objection (SensePost)](https://github.com/sensepost/objection)
370393
- [Modding And Distributing Mobile Apps with Frida](https://pit.bearblog.dev/modding-and-distributing-mobile-apps-with-frida/)
394+
- [frida-jdwp-loader](https://github.com/frankheat/frida-jdwp-loader)
395+
- [Library injection for debuggable Android apps (blog)](https://koz.io/library-injection-for-debuggable-android-apps/)
396+
- [jdwp-lib-injector (original idea/tool)](https://github.com/ikoz/jdwp-lib-injector)
397+
- [jdwp-shellifier](https://github.com/hugsy/jdwp-shellifier)
371398

372-
{{#include ../../../banners/hacktricks-training.md}}
399+
{{#include ../../../banners/hacktricks-training.md}}

src/pentesting-web/xs-search/css-injection/less-code-injection.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
## LESS Code Injection leading to SSRF & Local File Read
1+
# LESS Code Injection leading to SSRF & Local File Read
2+
3+
{{#include ../../../banners/hacktricks-training.md}}
24

35
LESS is a popular CSS pre-processor that adds variables, mixins, functions and the powerful `@import` directive. During compilation the LESS engine will **fetch the resources referenced in `@import`** statements and embed ("inline") their contents into the resulting CSS when the `(inline)` option is used.
46

@@ -59,4 +61,5 @@ curl -sk "${TARGET}rest/v10/css/preview?baseUrl=1&lm=${INJ}" | \
5961

6062
* [SugarCRM ≤ 14.0.0 (css/preview) LESS Code Injection Vulnerability](https://karmainsecurity.com/KIS-2025-04)
6163
* [SugarCRM Security Advisory SA-2024-059](https://support.sugarcrm.com/resources/security/sugarcrm-sa-2024-059/)
62-
* [CVE-2024-58258](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-58258)
64+
* [CVE-2024-58258](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-58258)
65+
{{#include ../../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)