Skip to content

70 — Vulnerability Research — FAQ

Real questions, including the ones people are embarrassed to ask. The embarrassing ones are usually the important ones.


1. Where do I even start looking? The device has thousands of things on it.

Run scripts/surface-enum.sh against the device, then run it against a second device — ideally a Pixel — of the same Android version, and diff the two service lists. The services that exist on the first and not the second are vendor code: written by fewer people, reviewed by fewer, and fuzzed by nobody.

That is the answer, and it is not a beginner's answer that you grow out of. Both 20-Security-Architecture §5.8 and 21-App-Sandbox §5.12 arrive at it independently.

Measured on a real MIUI device while writing this chapter: 217 registered Binder services, and the first five alphabetically include MiuiBackup, MiuiInit and MiuiWifiService. You do not need the diff to see the shape of the answer — you need it to find the other two hundred.

What you should not do is start with the AOSP media stack. It is the most interesting-looking target and the worst one, because Google fuzzes it continuously and has done for years. §3.3.


2. Is a crash a vulnerability?

No, and this is the single most important sentence in the chapter.

A crash is an observation — your process stopped. A bug is a defect in the target. A vulnerability is a bug an attacker can reach that gives them something they should not have.

The chapter's own example makes the point uncomfortably: examples/acfg-vulnerable.c contains a fully-controlled heap out-of-bounds write, with attacker control of both the length and the contents, adjacent to an allocation whose size the attacker also chooses. Its severity is none, because nothing on any device parses that format. The mechanism is textbook and the finding is nothing.

Reachability is the whole game. §1.3 and §3.9.


3. Do I need the source code?

No, but it changes what you do.

With source: you can build with sanitizers, which is the difference between a bug that aborts immediately and a bug that silently corrupts memory and is never seen. You can fuzz efficiently with coverage feedback. You can read the missing check directly.

Without source: you can still fuzz — dlopen the library and call the exported function (§6.4), or use AFL++'s QEMU or Frida modes. You can read the decompilation (57-Ghidra). You can diff two firmware releases (§6.3).

What you lose without source is sensitivity. You cannot rebuild a prebuilt vendor library with ASan, so most memory-safety bugs stay silent. The substitutes are malloc_debug and GWP-ASan on device (19-Memory §3.12, §3.14), and both are far less sensitive. A campaign against an uninstrumented .so that finds nothing has told you very little. §7.5.


4. How long does this take? Be honest.

Weeks to months per target, and most of it finds nothing.

A realistic first pass on one component: two days enumerating, three days building harnesses that actually reach the code, a week of wall-clock fuzzing while you do other things, and then triage. Expect the first two harnesses not to work. Expect a meaningful fraction of the first crashes to be in your own harness.

People make a living at this by specialising narrowly — one vendor's HALs, one codec family, one driver — so that their accumulated context makes them faster than everyone else on that surface. Breadth is how you start; depth is how it becomes viable. §5.10.


5. I found something. What do I actually do?

In this order, and do not skip step 1.

  1. Establish reachability. Who can trigger it, from where, with what? If you cannot answer, you do not have a finding yet — you have a bug. §3.9.
  2. Minimise the reproducer. -minimize_crash=1. A 12-byte input is worth ten times a 4 KB one.
  3. Work out where it goes. AOSP, Mainline, Google app, OEM, or third-party developer — five different destinations. Test on a Pixel or AOSP build to tell AOSP bugs from OEM bugs. §5.8.
  4. Read the programme's rules before you submit. They are your scope and your safe harbour.
  5. Write the report to §5.9's structure: verdict first, stack trace last, and an explicit "not shown" line.
  6. Do not publish before the vendor's timeline. Do not attach a working exploit.

6. Should I write an exploit to prove it is serious?

Almost never, and this is a professional position rather than squeamishness.

Vendors triage on reachability and impact assessment. The overwhelming majority of accepted, high-severity, well-paid platform findings are reported without a working exploit, because building one takes weeks and adds nothing the vendor needs to fix the code. What they need is: this is reachable, here is the reproducer, here is what is controlled, here is the analysis.

A working exploit also raises the vendor's handling burden — now there is a weapon in their ticketing system — and if the report leaks, so does the weapon. If a programme explicitly asks for one, that is a considered decision, not a default. §1.5 and §5.9.


7. My fuzzer has run for two days and found nothing. Is the code secure?

You have learned nothing about the code yet. Check, in this order:

  1. Does the harness reach the target? Plant abort(); as the first line of the target function, rebuild, run one input, confirm it dies, remove it. A harness that returns without calling the target produces a campaign log identical to one that found nothing. §7.10.
  2. Did coverage grow at all? A flat curve from execution one means the instrumentation did not apply.
  3. Did coverage plateau, and why? A magic value, a checksum, a length field the mutator cannot satisfy, or genuinely unreachable code. Each has a different fix. §3.5.
  4. Are you grading on exit codes? Two of the three faces of this chapter's planted bug exit with status 0 and leave the finding in the log. grep -c "runtime error" over the campaign log. §3.7.

Only after all four does "no crashes" mean anything, and even then it is a statement about your corpus, your detector set and your clock.


8. What is the difference between fuzzing and just throwing random data at it?

Coverage feedback, and it is the difference between an exponential search and a hill climb.

A blind mutator changes bytes and runs. It has no idea whether it made progress, so its chance of building a structurally valid input with N interdependent constraints falls off exponentially in N.

A coverage-guided fuzzer keeps every input that reached new code and mutates those, so it solves constraints one at a time and builds on each solution. libFuzzer additionally instruments comparisons, so if (magic == 0x47464341) is solved by observing how close the current value is rather than by guessing four bytes.

Honest caveat from this chapter's own measurement: the blind driver in examples/fuzz-acfg.c found the planted bug in 143,121 executions. That is not evidence that blind fuzzing works — it is evidence that a planted bug requiring one byte to exceed 32 is trivially shallow. Do not generalise from it. §7.4.


9. ASan says nothing but I am certain there is an overflow. What is going on?

Probably the structural blind spot, and it surprises almost everyone the first time.

ASan places no redzone between two structs inside a single allocation. Its shadow memory records how many bytes of each 8-byte granule are addressable; it has no concept of a struct field. So an overflow from array[0] into array[1], inside one calloc, is completely invisible.

Measured here: the identical defect at count = 1 produces a loud ASan heap-buffer-overflow, and at count = 4 produces nothing at all from ASan — only a UBSan array-bounds line, and the process exits 0.

Fixes: build with UBSan alongside ASan (its array-bounds check has the static type information ASan lacks), and set UBSAN_OPTIONS=halt_on_error=1. Also check that the translation unit containing the bug was actually instrumented. §3.7.

There is an ASan option that inserts intra-object padding (-fsanitize-address-field-padding), and it is unusable on anything that talks to uninstrumented code — which on Android is everything — because it changes sizeof.


10. Can I fuzz on my phone?

You can. You should not, and the reason is practical rather than ethical.

A campaign is millions of executions of code designed to misbehave. It will fill storage with artefacts, wedge system services, thermally throttle the device, and occasionally require a reboot or a re-flash. A phone is also one to two orders of magnitude slower than a workstation, every rebuild is a cross-compile and a push, and the device has other things running that make results non-reproducible.

Fuzz on the host, confirm on the device. Discovery where it is fast; reachability confirmation on a device you own and can afford to lose, once, per finding.

Nothing was fuzzed on either physical phone attached to this workstation while this chapter was written, deliberately. §7.6.


11. Why did my Android fuzzer segfault immediately, even though the code is fine?

Two candidates, and the error messages point at neither.

Page size. If your target image uses 16 KB pages (adb shell getconf PAGE_SIZE returns 16384) and you built with NDK r25 or earlier, the binary is 4 KB-aligned and will segfault. Measured here: a three-line int main(void){return 42;} built with NDK r25c segfaults on an API 35 google_apis_ps16k emulator image, and the linker rejects that NDK's libc++_shared.so with the memorable and entirely unhelpful message "empty/missing DT_HASH/DT_GNU_HASH ... (new hash type from the future?)". NDK r27 or newer is required.

Missing ASan runtime. ASan on Android is a shared runtime. libclang_rt.asan-<abi>-android.so must sit next to the binary or on LD_LIBRARY_PATH.

The general lesson is worth more than either: when a fuzzing environment misbehaves, prove the toolchain works before you debug anything you wrote. Compile and run a three-line main. Thirty seconds, and it converts an unbounded debugging session into a bounded one. §7.7.


12. My Android libFuzzer build fails with "undefined symbol: ceilf". What?

Add -lm.

libclang_rt.fuzzer-<abi>-android.a is C++ and uses libm from FuzzerDataFlowTrace.cpp. The C driver does not link libm by default on Android, so the link fails with ceilf and sqrt undefined — and the error points at a file inside the sanitizer runtime rather than at your code, which is why it stops a first attempt dead. Linking the objects with <triple>-clang++ instead works equally well. §7.7.


13. How do I know two crashes are the same bug?

You do not, exactly. You approximate, with a stack hash: normalise the top few meaningful frames — dropping the sanitizer's own interceptors, libc, _start, and (if _FORTIFY_SOURCE is on) the string_fortified.h wrapper that otherwise makes every overflowing copy look identical — and hash the result.

It is a heuristic and it fails in both directions. Measured here: five crash artefacts from one planted defect were bucketed into two groups by scripts/triage-asan.py, because the memcpy is on line 236 and the terminator store is on line 237 and a line-sensitive hash cannot know they are the same missing check.

So: use the tool to reduce 400 artefacts to a handful, then decide by hand. Bucket count is a first approximation a human corrects, exactly as a static sweep produces leads rather than findings. §3.7.


14. Everyone says "read the code" — but what am I actually looking for?

Four questions, at every copy, every allocation and every index:

  1. What is the length? Name the variable.
  2. Where did it come from? If it traces back to the input, everything downstream is suspect.
  3. What is the destination, and what is its size? If you cannot state the size, you have not finished reading.
  4. Is the length checked against the destination's size, on every path that reaches this line?

Question 3 is the one that catches the commonest real bug, because the check that is present usually validates the source — "are these bytes present in the input?" — and a reviewer skimming for "is there a bounds check?" sees it and moves on. §5.2 and §8.2.


15. I keep finding duplicates. What am I doing wrong?

Target selection. Duplicates mean you found a real bug and were not first, which means other people are working the same surface. Move to one they are not. §3.3's first factor — "who else has fuzzed this, with what, for how long?" — is the question that prevents this, and it takes ten minutes to answer before you start rather than three weeks to discover afterwards.


It depends on your jurisdiction and on the app's licence, and this is not legal advice.

The practical position: the app is licensed to you, not sold, and most EULAs prohibit reverse engineering. Some jurisdictions void such clauses for security research; others do not. Bug bounty programmes exist partly to give you written permission, and a programme's scope text is your authorisation.

The safe pattern: work on your own code, on open-source software, or inside a published programme's scope. Establish that before you build the harness, not after the crash — researchers routinely lose real findings because they cannot explain how they found them without admitting an out-of-scope test. §1.6 and §5.12.


17. What is a "confused deputy" and why does the chapter keep saying fuzzing cannot find it?

A privileged component performing an action on behalf of a caller, using the component's own authority, without checking that the caller was entitled to ask.

Fuzzing cannot find it because nothing crashes. The code works exactly as written. There is no out-of-bounds access, no sanitizer report, no artefact. The only way to find one is to read the service's transactions and ask, for each: does this do something privileged, and does it check who is asking, and is the check in the right place?

24-IPC §3.20 owns the concept and 25-Binder §3.12 owns the mechanism. §5.3 here is the hunting method. It is also the bug class where an unrooted device is no obstacle: you need an attacker app and logcat.


18. Do I need root on the device?

For most of this chapter, no.

Enumeration is read-only and needs nothing. Confused-deputy hunting needs an attacker app. Host fuzzing needs no device at all. Reading a tombstone caused by your own app's input needs no root.

Root helps for on-device instrumentation (frida-server), for reading other processes' memory, and for running things in more privileged contexts. It is a convenience, not a prerequisite — and chapter 60 measured why the shell's convenience is a trap: com.android.shell holds 200 permissions with 16 pre-granted SYSTEM_FIXED, so anything you prove from adb shell proves nothing about what an app can do.


19. What is the actual difference between this and what a pentester does?

A pentester asks "are the known controls present and correct?" and a researcher asks "what do we not know about this system?"

Consequences: the pentester has a checklist and expects findings; the researcher has a hypothesis and usually finds nothing. The pentester's report is measured against a standard; the researcher's is one defect with a reachability argument. The pentester's hard part is thoroughness; the researcher's is knowing when to stop.

They are different economic activities with different risk profiles, not levels of the same one. §1.2.


20. When should I give up on a target?

At a budget you set before you started, because a budget set after you are invested is not a budget.

Legitimate endings, all of them successful:

  • Budget exhausted, coverage plateaued, nothing found — write it up. A harness, a corpus, a coverage number and "here is what would need to change" makes the next campaign cheaper.
  • Crashes found, all triaged unreachable — report them as bugs, record the analysis, move on.
  • A finding — report it, then decide separately whether to continue.
  • The target turns out to be structurally uninteresting (it is Rust; nothing reaches it; the input is not attacker-controlled) — stop immediately and write down why.

The failure mode is specific: three weeks in, you have a crash, it is not reachable, and you start looking for a way to make it reachable rather than asking whether it is. That is the moment to stop. §3.12.


21. Everything in this chapter is about C. What about Java and Kotlin bugs?

Memory-safety fuzzing does not apply — the runtime prevents that class, which is exactly why AOSP is moving new native components to Rust and why so much of the framework was always managed code.

What remains, and what this chapter's §5.3, §5.4, §5.5 and §5.6 are about, applies fully: confused deputies, parser differentials, state and logic bugs, and races. Those are found by reading, and the managed layer is where most of Android's authorisation logic lives, so it is where most authorisation bugs are.

The practical division: fuzz the native parsers, read the managed authorisation code.


22. What single habit would most improve my results?

Writing down what you did not find, and where you did not look.

Every campaign, record: the harness, the corpus, the coverage number, the CPU time, and the reason you stopped. It feels like bureaucracy for the first month and then it becomes the thing that makes you faster than people who are cleverer than you — because they re-fuzz ground they already covered and you do not.

That is what "systematic" means in the sentence 01-Computer-Science-Basics uses to point at this chapter: "the bug classes of section 5, found systematically". §1.4.