70 — Vulnerability Research — Cheat Sheet
Dense reference. The reasoning lives in README.md .
Bug class → where it lives → how to hunt it
Bug class
Where it lives on Android
How to hunt it
Cheapest signal
Owned by
Heap buffer overflow (write)
Native parsers: media, images, fonts, vendor blob formats, .so in apps
Fuzz with ASan+UBSan
heap-buffer-overflow ... WRITE
19 §3.9.1
Heap buffer overflow (read)
Same
Same
heap-buffer-overflow ... READ
19 §3.9.1
Integer overflow → undersized alloc
malloc(a*b), malloc(len+hdr) with input-derived operands
Grep, then fuzz to confirm
Arithmetic on an input value before a size check
19 §3.9.2
Use-after-free
Callbacks, Binder death recipients, media buffer pools, async lifetimes
Fuzz with ASan; ownership review
heap-use-after-free
19 §3.9.3
Double free / invalid free
Error paths that free what the success path also frees
Fuzz that exercises error paths
attempting free on address which was not malloc()-ed
19 §3.9.4-5
Uninitialised memory
Structs filled field-by-field with an early return
MSan on host
Non-determinism between runs
19 §3.9.6
Type confusion
JNI boundaries, Parcel type tags, C++ downcasts
Review
A cast whose validity depends on an input value
19 §3.9.7
Stack buffer overflow
Fixed local buffer + input-derived length
Fuzz with ASan; grep
stack-buffer-overflow
19 §3.9.8
Confused deputy
Platform IPC: system services, vendor system apps
Review only — no crash exists
Privileged op with no caller check; clearCallingIdentity with no preceding check
24 §3.20, 25 §3.12
Check in onBind
Any bound service
Grep for permission checks in onBind
getCallingUid() there returns the service's own UID
28
Parser differential
Two implementations of one format
Differential testing; oracle is "outputs differ"
Two tools printing different things about the same bytes
10 §18
Path canonicalisation
URI checked by one component, opened by another
Review + differential
Check and open using different path forms
33
State / logic
State machines, retry and cancel paths, error paths
Build the state table; fill every cell
A state variable set in more places than it is checked
—
Race / TOCTOU
Binder thread pool, check-then-open, Parcel read twice
Review; targeted stress; TSan on host
Any gap between a check and a use
25 §3.12.2
Over-permissive vendor SELinux domain
Vendor policy
Diff policy against AOSP
A domain with more allow rules than its AOSP peer
22 §8.6
Exported component, no permission
Vendor system apps
Manifest read across every package
exported=true with no android:permission
32
Bold rows are the ones fuzzing never finds .
Sanitizer flag matrix
Sanitizer
Compile + link flag
Catches
Blind to
Cost
Combines with
ASan
-fsanitize=address
Heap/stack/global OOB, UAF, double free, invalid free, leaks
Anything inside one allocation ; uninitialised reads; integer bugs
~2x time, ~3x RAM
UBSan, fuzzer
UBSan
-fsanitize=undefined
Signed overflow, shifts, misalignment, array-bounds , typed null deref
Anything not statically reasonable
small
ASan, TSan, fuzzer
MSan
-fsanitize=memory
Uninitialised reads
Everything ASan catches
~3x
fuzzer only
TSan
-fsanitize=thread
Data races
Non-racy logic
5–15x, large RAM
UBSan, fuzzer
HWASan
-fsanitize=hwaddress
ASan's classes, tag-based
Same intra-allocation blind spot
~2x, low RAM
AArch64 / Android
libFuzzer
-fsanitize=fuzzer
(engine, not detector)
—
—
ASan, UBSan, MSan, TSan
libFuzzer, no main
-fsanitize=fuzzer-no-link
(instrumentation only)
—
—
same
Legal and illegal combinations
Combination
OK?
address,undefined
yes — the default pairing
fuzzer,address,undefined
yes — the standard host build
fuzzer-no-link,address,undefined
yes — when you supply your own driver
thread,undefined
yes
memory,undefined
yes
address,memory
no — mutually exclusive
address,thread
no — mutually exclusive
hwaddress,address
no
Flags that are not optional
Flag
Why
-g
Without symbols every triage report is hex addresses
-O1
-O0 is too slow to fuzz; -O2 makes line numbers lie
-fno-omit-frame-pointer
Readable stack traces
-fsanitize-address-use-after-scope
Catches stack-scope UAF that plain ASan misses
-lm (Android + libFuzzer)
libclang_rt.fuzzer-*-android.a needs ceilf, sqrt
Environment
export ASAN_OPTIONS = abort_on_error = 1 :detect_leaks= 1 :allocator_may_return_null= 0 :detect_stack_use_after_return= 1
export UBSAN_OPTIONS = halt_on_error = 1 :print_stacktrace= 1
export MSAN_OPTIONS = poison_in_dtor = 1
export ASAN_SYMBOLIZER_PATH = $( command -v llvm-symbolizer)
UBSAN_OPTIONS=halt_on_error=1 is not the default. Without it a UBSan-only finding prints one
line, the process continues, and the campaign exits 0 with the bug in the log.
libFuzzer flags
Flag
Effect
corpus/
Seed directory; new interesting inputs written back
-max_len=N
Cap input size. Always set it
-artifact_prefix=DIR/
Where crash files go
-runs=N
Stop after N executions
-max_total_time=N
Stop after N seconds
-jobs=N -workers=N
Parallel processes, shared corpus
-dict=f
Token dictionary
-seed=N
Fix the PRNG. Required for reproducibility
-minimize_crash=1
Shrink a crashing input
-merge=1 out/ in/
Corpus minimisation
-print_final_stats=1
Coverage and exec summary at exit
-rss_limit_mb=N
OOM threshold (default 2048)
-timeout=N
Per-input timeout, seconds
-detect_leaks=0
Turn off LSan when the target leaks by design
Reading the status line
#8192 NEW cov: 61 ft: 94 corp: 12/243b lim: 64 exec/s: 4096 rss: 34Mb L: 22/76 MS: 2 ChangeByte-
Field
Watch for
cov:
Plateau = stop and diagnose
ft:
Still growing after cov stalls = still progress
corp:
Bloat = run -merge=1
exec/s:
Under a few hundred = harness problem
rss:
Steady growth = harness leak
Triage decision table
Report line
Class
First question
heap-buffer-overflow ... WRITE
OOB write
How far past, and how much data is controlled?
heap-buffer-overflow ... READ
OOB read
Does the value reach an attacker-visible output?
heap-use-after-free
UAF
How wide is the window, can the attacker allocate into it?
double-free
Allocator metadata
Is the pointer attacker-controlled?
attempting free on address which was not malloc()-ed
Invalid free
Where did the pointer come from?
stack-buffer-overflow
Stack OOB
Does it reach the return address? Is there a canary?
SEGV on unknown address 0x000000000000
Null deref
Almost always DoS only. Say so
SEGV on unknown address 0x6161616161
Wild pointer
Address looks input-derived. Different conversation
dynamic-stack-buffer-overflow
VLA / alloca
The length is attacker-supplied
runtime error: index N out of bounds
UBSan array-bounds
ASan may be blind to this one. Exit code 0
SUMMARY: ... LeakSanitizer
Leak
Usually a harness bug, not a finding
The order of the questions
Target or harness? (read the stack bottom-up)
Does it reproduce in a fresh process?
What class?
Same defect as one I already have? (stack hash)
Read/write, distance, length control, content control
Reachable?
Reachability evidence ladder
Level
Evidence
Strength
0
"The library is on the device"
none
1
"The function is exported, the name fits"
hypothesis
2
"A static call path exists"
moderate
3
"I traced the call at runtime with a hook"
strong
4
"An unprivileged app sent it; the target process died; here is the tombstone"
conclusive
The four honest verdicts
Verdict
Action
Reachable, demonstrated
Report as a vulnerability
Reachable, argued
Report, state the evidence level and the gap
Not reachable from the surface tested
Report as a bug, low severity, say what you tested
Unknown
Do not report as a vulnerability
Disclosure routing
Defect is in
Goes to
Fix reaches users via
AOSP framework, ART, media, libbinder
Android VDP (bughunters.google.com)
Monthly bulletin, then OEM OTA
Mainline / APEX module
Android VDP
Play system update
GMS, Play services, Google apps
Google VRP
App update
OEM system app, vendor HAL, vendor kernel
The OEM's own programme
OEM bulletin and OTA
Third-party app on Play
Developer; then Play's channel
App update
Upstream open-source library
Upstream security contact
Upstream release
Test on a Pixel or AOSP build. If it reproduces there it is probably AOSP; if only on the OEM
device it is probably theirs. State which you tested — it saves a triage round-trip.
Report skeleton
Summary : <who> with <starting position> can <do what> to <component>,
resulting in <what>.
Affected : build fingerprint, patch level, module versions, model
Reachability : <verdict> -- evidence level <N>
Reproduction : numbered, from a clean device, from an APP not adb shell
Reproducer : minimised input + the app or harness that delivers it
Evidence : full sanitizer report or tombstone, as text
Analysis : which line is wrong and why
Impact : what is controlled; what is NOT demonstrated
Mitigations : which are present in the SHIPPED build (verified how)
Suggested fix: the corrected code
Disclosure : intended publication date
Command reference
# build a host fuzzer
clang -g -O1 -fno-omit-frame-pointer -fsanitize= fuzzer,address,undefined \
harness.c target.c -o fuzz_target
# build for Android (note the -lm)
$NDK /bin/aarch64-linux-android24-clang -g -O1 -fno-omit-frame-pointer \
-fsanitize= fuzzer,address harness.c target.c -lm -o afuzz
# run
./fuzz_target corpus/ -artifact_prefix= findings/ -max_len= 4096 -seed= 1 -print_final_stats= 1
# minimise a crasher
./fuzz_target -minimize_crash= 1 -runs= 100000 findings/crash-<sha1>
# minimise the corpus
./fuzz_target -merge= 1 corpus-min/ corpus/
# coverage report
clang -g -O0 -fprofile-instr-generate -fcoverage-mapping harness.c target.c -o cov
LLVM_PROFILE_FILE = t.profraw ./cov corpus/*
llvm-profdata merge -sparse t.profraw -o t.profdata
llvm-cov report ./cov -instr-profile= t.profdata
llvm-cov show ./cov -instr-profile= t.profdata target.c
# triage
python3 -B scripts/triage-asan.py --dir findings/
python3 -B scripts/triage-asan.py --json --frames 5 report.txt
# generate a harness
scripts/make-fuzz-harness.sh --name t --func t_parse \
--sig 'int(const uint8_t*, size_t)' --out /tmp/t-harness
# enumerate a device (read-only)
scripts/surface-enum.sh --out /tmp/surface-$( date +%F)
scripts/surface-enum.sh --out /tmp/b --compare /tmp/a
# reachability probe
frida -U -n com.vendor.target -l scripts/reachability-probe.js
Recon one-liners
# exports that look like parsers
llvm-nm --defined-only --demangle lib.so | grep -iE ' T .*(parse|decode|read|load|unpack)'
# error strings map the parser
llvm-strings lib.so | grep -iE 'invalid|malformed|unsupported|truncat|magic'
# unbounded copy imports
llvm-nm --undefined-only lib.so | grep -E 'strcpy|strcat|sprintf|gets'
# hardening actually present
llvm-readelf --dynamic lib.so | grep -E 'BIND_NOW|FLAGS'
llvm-readelf --headers lib.so | grep -E 'GNU_RELRO|GNU_STACK'
# device posture that severity depends on
adb shell getprop ro.build.version.security_patch
adb shell getprop ro.arm64.memtag.bootctl
adb shell getconf PAGE_SIZE
adb shell getenforce
Grep catalogue
grep -rnE '\b(strcpy|strcat|sprintf|gets|vsprintf)\s*\(' --include= *.c --include= *.cpp .
grep -rnE '\b(memcpy|memmove|strncpy|snprintf)\s*\([^,]+,[^,]+,[^)]*\)' --include= *.c . | grep -v sizeof
grep -rnE '\b(malloc|calloc|realloc)\s*\(?[^;]*[*+][^;]*\)' --include= *.c .
grep -rnE '\b(char|uint8_t)\s+\w+\s*\[[0-9]+\]' --include= *.c .
grep -rnE '\balloca\s*\(' --include= *.c .
Wrong
Why
Right
if (off + len > total) (32-bit)
Addition wraps
if (len > total - off) after validating off
malloc(count * size)
Multiplication wraps
calloc(count, size)
uint16_t t = a + b + 1
Truncates before comparison
compute in size_t
int len = get(); if (len > max) return;
Negative passes, becomes huge
use unsigned, or also check len < 0
if (nlen > MAX) before buf[nlen] = 0
Off-by-one; no room for terminator
if (nlen >= MAX)
if (nlen > 31) nlen = 31;
Clamping accepts malformed input
reject, do not clamp
Mitigations: what each costs an attacker
Mitigation
Effect on your severity
ASLR / PIE
Lowers, unless you also have an infoleak — then the pair is a chain, say so
Stack canary
Lowers contiguous stack overflows; nothing for a chosen-offset write
_FORTIFY_SOURCE
Can turn corruption into a controlled abort — i.e. into DoS
Full RELRO + BIND_NOW
Removes the GOT target. Do not assume it is present
CFI
Often the difference between "code execution" and "corruption, impact unclear"
Shadow Call Stack
Removes return-address techniques
PAC / BTI
Largest single difficulty increase where present
MTE
Turns many silent corruptions into detected crashes
SELinux
Does nothing to the corruption; determines what it is worth afterwards
seccomp-bpf
Same shape as SELinux
Check, do not assume. Vendor builds differ from AOSP builds.
The numbers to remember
Number
What it is
143,121
Executions before the planted ACFG bug surfaced (gcc, ASan+UBSan, PRNG seed 1234, 20-byte seed)
56
sizeof(acfg_record) — why count=1 is loud and count=4 is silent
3
Faces of one defect: ASan abort, UBSan-only, invisible
2 of 3
Faces that exit with status 0
5 → 2 → 1
Artefacts → tool's buckets → actual defects
217
Binder services on a real MIUI API 30 device
299 of 431
Broadcast actions with no manifest receiver anywhere (ch. 29)
16,836 → 168 → 2 of 17
Static hits → leads → survivors of hand review (ch. 52)
132 of 132
High-confidence secret-scanner hits that were false positives (ch. 33)