You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/mobile-pentesting/android-app-pentesting/smali-changes.md
+42-1Lines changed: 42 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -293,8 +293,49 @@ Notes:
293
293
- Make sure the correct ABI variant of the library exists under lib/<abi>/ (e.g., arm64-v8a/armeabi-v7a) to avoid UnsatisfiedLinkError.
294
294
- Loading very early (class static initializer) guarantees the native logger can observe subsequent JNI activity.
295
295
296
-
## References
296
+
## Smali Static Analysis / Rule-Based Hunting
297
+
298
+
After decompiling with `apktool`, you can **scan Smali line-by-line** with regex rules to quickly spot anti-analysis logic (root/emulator checks) and likely hardcoded secrets. This is a **fast triage** technique: treat hits as leads that you must verify in surrounding Smali or reconstructed Java/Kotlin.
299
+
300
+
Key ideas:
301
+
-**Library filtering**: suppress or tag findings under common third-party namespaces so you focus on app-owned code paths.
302
+
-**Context hints**: require suspicious strings to appear near the APIs that consume them (within the same method, within N lines).
303
+
-**Confidence**: use simple levels (high/medium) to rank leads and reduce false positives.
304
+
305
+
Example library prefixes to suppress by default:
306
+
```text
307
+
Landroidx/
308
+
Lkotlin/
309
+
Lkotlinx/
310
+
Lcom/google/
311
+
Lcom/squareup/
312
+
Lokhttp3/
313
+
Lokio/
314
+
Lretrofit2/
315
+
```
316
+
317
+
Example detection rules (regex + context heuristics):
"context_hint": "Only report when the same method also calls File;->exists/canExecute or Runtime;->exec."
326
+
}
327
+
```
328
+
329
+
Additional heuristics that work well in practice:
330
+
-**Root package/path checks**: require nearby `PackageManager;->getPackageInfo` or `File;->exists` calls for strings like `com.topjohnwu.magisk` or `/data/local/tmp`.
331
+
-**Emulator checks**: pair suspicious literals (e.g., `ro.kernel.qemu`, `generic`, `goldfish`) with nearby `Build.*` getters and string comparisons (`->equals`, `->contains`, `->startsWith`).
332
+
-**Hardcoded secrets**: flag `const-string` only when a nearby `.field` or `move-result` identifier includes keywords like `password`, `token`, `api_key`. Explicitly ignore UI-only markers such as `AutofillType`, `InputType`, `EditorInfo`.
297
333
334
+
Rule-driven scanners like PulseAPK Core implement this model to quickly surface anti-analysis logic and potential secrets in Smali.
0 commit comments