Skip to content

Commit 92510d2

Browse files
authored
Update reversing-native-libraries.md
1 parent 5bcbd81 commit 92510d2

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/mobile-pentesting/android-app-pentesting/reversing-native-libraries.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -276,31 +276,18 @@ make
276276
```
277277
</details>
278278

279-
Why this enables “early” instrumentation
280-
- You can attach Frida/LLDB to the loader-stable process, set breakpoints and patch anti-debug/root checks before executing `INIT0()`.
281-
- Renaming `JNI_OnLoad` avoids crashes from JNI state that the constructor typically initializes.
282-
- Running outside the original app lifecycle reduces noise (UI/threads/classloader), making analysis reproducible.
283279

284-
Pitfalls
280+
**Common Pitfalls:**
285281
- Constructor addresses change after patching due to re-layout; always recompute from `.rela.dyn` on the final binary.
286282
- Ensure `-Djava.class.path` covers every class used by `RegisterNatives` calls.
287283
- Behavior may vary with NDK/loader versions; the consistently reliable step was removing `INIT_ARRAY`/`INIT_ARRAYSZ` DYNAMIC tags.
288284

289-
Defensive notes (blue team)
290-
- Validate DYNAMIC entries and library integrity at runtime; assert that expected init tags are present before proceeding.
291-
- Add post-init integrity checks confirming constructors executed.
292-
- Use runtime attestation and code-signing verification to detect modified native libraries.
293285

294-
---
295-
296-
### Resources
286+
### References
297287

298288
- **Learning ARM Assembly:** [Azeria Labs – ARM Assembly Basics](https://azeria-labs.com/writing-arm-assembly-part-1/)
299289
- **JNI & NDK Documentation:** [Oracle JNI Spec](https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/jniTOC.html) · [Android JNI Tips](https://developer.android.com/training/articles/perf-jni) · [NDK Guides](https://developer.android.com/ndk/guides/)
300290
- **Debugging Native Libraries:** [Debug Android Native Libraries Using JEB Decompiler](https://medium.com/@shubhamsonani/how-to-debug-android-native-libraries-using-jeb-decompiler-eec681a22cf3)
301-
302-
### References
303-
304291
- Frida 16.x change-log (Android hooking, tiny-function relocation) – [frida.re/news](https://frida.re/news/)
305292
- NVD advisory for `libwebp` overflow CVE-2023-4863 – [nvd.nist.gov](https://nvd.nist.gov/vuln/detail/CVE-2023-4863)
306293
- SoTap: Lightweight in-app JNI (.so) behavior logger – [github.com/RezaArbabBot/SoTap](https://github.com/RezaArbabBot/SoTap)
@@ -311,4 +298,4 @@ Defensive notes (blue team)
311298
- [LIEF Project](https://github.com/lief-project/LIEF)
312299
- [JNIInvocation](https://github.com/Ch0pin/JNIInvocation)
313300

314-
{{#include ../../banners/hacktricks-training.md}}
301+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)