Skip to content

Commit 6033f62

Browse files
author
HackTricks News Bot
committed
Add content from: MalFixer: Toolkit for Inspecting and Recovering Malformed An...
1 parent d2b6049 commit 6033f62

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

  • src/mobile-pentesting/android-app-pentesting

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,41 @@ firmware-level-zygote-backdoor-libandroid_runtime.md
165165
First of all, for analysing an APK you should **take a look to the to the Java code** using a decompiler.\
166166
Please, [**read here to find information about different available decompilers**](apk-decompilers.md).
167167

168+
### APK anti-analysis via malformed containers, manifests, and asset names
169+
170+
Some malicious APKs are not merely obfuscated: they are **deliberately malformed** so common tooling (`unzip`, `apktool`, `jadx`, AV scanners, CI pipelines) cannot enumerate files reliably or aborts early. A useful mental model is **parser differential anti-analysis**: Android may still accept enough of the package to install or partially process it, while desktop ZIP/APK parsers disagree about what entries exist or where they start.
171+
172+
Common patterns:
173+
174+
- **Malformed ZIP/APK metadata**: inconsistent **local file headers** and **central directory** records can make tools resolve different offsets, sizes, or filenames for the same entry.
175+
- **Corrupted binary `AndroidManifest.xml`**: if the manifest cannot be decoded, many static-analysis pipelines stop before inspecting components, permissions, exported surfaces, or embedded resources.
176+
- **Malformed asset filenames**: suspicious names inside `assets/` can break extraction, path handling, or downstream file processing and hide secondary payloads.
177+
178+
Practical workflow when a sample "looks empty" or decompilers crash:
179+
180+
1. Compare how multiple parsers see the archive:
181+
```bash
182+
unzip -l app.apk
183+
zipinfo -v app.apk
184+
jadx app.apk -d out-jadx
185+
apktool d app.apk -o out-apktool
186+
```
187+
2. If the file list differs across tools, or `jadx` / `apktool` fails on `AndroidManifest.xml`, treat the APK as intentionally malformed instead of assuming corruption in transit.
188+
3. Rebuild a **normalized APK** that rewrites ZIP metadata, repairs the manifest, and sanitises hostile asset names before deeper reversing.
189+
190+
One purpose-built tool for this is **MalFixer**:
191+
192+
```bash
193+
python malfixer.py /path/to/app.apk
194+
python malfixer.py /path/to/app.apk --output-dir /path/to/output
195+
python malfixer.py /path/to/app.apk -l DEBUG
196+
```
197+
198+
The resulting `*-fixed.apk` is intended to be **standard enough for static tooling**, especially `jadx`. This is useful when triaging Android malware or packers that hide payloads behind malformed container metadata rather than only string/code obfuscation.
199+
200+
> [!NOTE]
201+
> The MalFixer README describes the ZIP repair module as `zipzixer.py`, while the repository file listing currently exposes `zipfixer.py`. If you inspect or import the project manually, verify the actual filename in the checked-out tree.
202+
168203
### Looking for interesting Info
169204

170205
Just taking a look to the **strings** of the APK you can search for **passwords**, **URLs** ([https://github.com/ndelphit/apkurlgrep](https://github.com/ndelphit/apkurlgrep)), **api** keys, **encryption**, **bluetooth uuids**, **tokens** and anything interesting... look even for code execution **backdoors** or authentication backdoors (hardcoded admin credentials to the app).
@@ -971,6 +1006,7 @@ AndroL4b is an Android security virtual machine based on ubuntu-mate includes th
9711006
- [CoRPhone — Android in-memory JNI execution and packaging pipeline](https://github.com/0xdevil/corphone)
9721007
- [justapk — multi-source APK downloader with Cloudflare bypass](https://github.com/TheQmaks/justapk)
9731008
- [Jezail rooted Android pentesting toolkit (REST API + Flutter UI)](https://github.com/zahidaz/jezail)
1009+
- [MalFixer](https://github.com/Cleafy/Malfixer)
9741010
- [BeatBanker: A dual‑mode Android Trojan](https://securelist.com/beatbanker-miner-and-banker/119121/)
9751011

9761012
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)