Skip to main content
Be Bitwise

Building a Proof of Concept

Zero-Day Discovery Workflow · Zero-Day Research track

7 min read

In this module

From Crash Input to Minimal PoC

You have a crashing input and understand the root cause. Now you need to turn that raw artefact into a proof of concept (PoC): a minimal, reliable test case that cleanly demonstrates the vulnerability. A PoC isn't an exploit. It doesn't need to achieve code execution, escalate privileges, or pop a shell. It just needs to prove that the vulnerability is real and consistently triggerable.

A PoC says "this flaw exists — here's how to confirm it." An exploit says "here's how to weaponise it." For responsible disclosure, you need the former. Building the latter is unnecessary and creates additional risk; don't do it unless you have a specific reason.

Input Minimisation

Fuzzer-generated crashing inputs are typically large and packed with data irrelevant to the bug. A TIFF that triggers a heap overflow might be 50 KB, but only 30 bytes actually matter. Input minimisation strips everything else.

Why bother?

  • Clarity. A 30-byte PoC exposes the root cause instantly. A 50 KB blob buries it.
  • Vendor cooperation. Minimal test cases are far easier to analyse and reproduce — and that accelerates the fix.
  • Your own understanding. Minimisation forces you to find the exact bytes and structure that trigger the bug. Often you learn things the fuzzer didn't tell you.

Automated Minimisation

Several tools automate the process of reducing a crashing input to its minimal form:

bash
# Using afl-tmin (AFL's test case minimiser)
$ afl-tmin -i crash_input.dat -o minimised.dat -- ./target_app @@
# Using lithium (a general-purpose test case reducer)
$ python lithium.py --testcase=crash_input.dat ./check_crash.sh

These tools work by systematically removing bytes or sections from the input and checking whether the crash still occurs. They use strategies like binary search, sequential deletion, and block removal to converge on a minimal input efficiently.

Manual Minimisation

Automated tools do not always find the true minimum, especially for structured file formats. Manual minimisation fills the gaps:

  1. Understand the file format. Identify the header, metadata sections, and data payload. Determine which sections the parser reads before reaching the vulnerable code path.
  2. Remove optional sections. Strip out metadata, comments, thumbnails, and other data that the parser does not need to reach the vulnerable function.
  3. Zero out data fields. Replace data payload bytes with zeroes. If the crash still triggers, those bytes are irrelevant.
  4. Truncate the file. Cut the file at the point where the parser has already reached the vulnerable code. Bytes after the crash point are unnecessary.
  5. Verify after each change. After every modification, confirm the crash still occurs with the same root cause (same crash address, same call stack). A change that eliminates the crash or shifts it to a different location has removed something essential.
Preserve the Root Cause

During minimisation, always verify that the reduced input triggers the same vulnerability - not just any crash. Compare the crash address, the call stack, and the sanitiser output against the original. If minimisation changes the crash signature, you have altered the trigger condition and may be demonstrating a different bug entirely.

Reliability Testing

A PoC must trigger the vulnerability consistently. Run it multiple times under varying conditions:

bash
# Run the PoC 100 times and check for consistent crashes
for i in $(seq 1 100); do
./target_app minimised.dat 2>/dev/null
if [ $? -ne 139 ]; then # 139 = SIGSEGV (128 + 11)
echo "Run $i: did not crash as expected"
fi
done

That check only works for a plain build, where the crash kills the process with SIGSEGV. An AddressSanitizer build catches the bad access first, prints a report and exits with status 1 by default on Linux (on macOS it aborts, giving 134), so the loop above would flag every run. For an ASan build, look for the report instead (or pin the status with ASAN_OPTIONS=exitcode=...):

bash
# ASan build: the report on stderr is the crash signal
for i in $(seq 1 100); do
if ! ./target_app_asan minimised.dat 2>&1 | grep -q 'ERROR: AddressSanitizer'; then
echo "Run $i: no ASan report"
fi
done

If the crash is intermittent, investigate why:

  • ASLR variation. The crash may depend on specific heap layout. Disable ASLR temporarily to confirm, then document this dependency.
  • Race condition. The vulnerability may require specific timing between threads. This does not make it less real, but it makes it harder to demonstrate.
  • Uninitialised memory. The crash may depend on the contents of uninitialised memory, which vary between runs.

Document the reliability rate. A PoC that crashes 95 out of 100 runs is still a valid demonstration, but note the rate in your report so the vendor understands the behaviour.

Documenting the Trigger Conditions

A PoC is only useful if someone else can reproduce it. Document:

  • Exact software version. Include commit hash if working from source.
  • Build configuration. Compiler, flags, and any relevant options (debug vs release, sanitisers, optimisation level).
  • Operating system and version. Some vulnerabilities are platform-specific.
  • Command line. The exact command used to trigger the crash.
  • Expected output. What the crash looks like - the signal, the error message, the sanitiser report.
c
Environment:
Target: ExampleLib 3.4.2 (commit a1b2c3d)
Compiled: gcc 13.2.0, -O2, -fsanitize=address
OS: Ubuntu 24.04 (kernel 6.8.0)
Command:
$ ./examplelib_convert minimised.tiff /dev/null
Expected result:
AddressSanitizer: heap-buffer-overflow in parse_ifd_entry
(src/tiff_decode.c:142)
Reliability: 100/100 runs crash consistently.

When NOT to Build a Full Exploit

PoC, Not Exploit

For coordinated disclosure, a proof of concept that demonstrates the vulnerability trigger is sufficient. You do not need to develop a working exploit that achieves code execution. Building a full exploit creates unnecessary risk: it could be leaked, stolen, or used before the vendor releases a patch. A PoC that triggers a crash under ASan is compelling evidence. A PoC that pops calc.exe is a weapon.

There are specific circumstances where building a more complete demonstration is appropriate:

  • The vendor disputes exploitability. If the vendor claims a crash is not a security issue, demonstrating control over the instruction pointer or a write primitive may be necessary to convey the severity.
  • Bug bounty requirements. Some programmes require demonstration of impact beyond a crash. Read the programme's rules carefully.
  • Internal research. If you are assessing the security of your own organisation's software, understanding full exploitability helps prioritise remediation.

Even then, go only as far as necessary. Demonstrate control of EIP/RIP, show an arbitrary write, or prove an information leak — but stop before building a weaponised payload unless you have a clear, legitimate reason.

Preparing the PoC for Submission

Package the PoC clearly for the vendor:

  1. The minimal crashing input file (or a script that generates it).
  2. A text file describing the vulnerability, the trigger conditions, and the expected output.
  3. Build and run instructions that anyone with access to the source code can follow.
  4. The sanitiser output showing the exact error.

Encrypt the package before transmission - vulnerability details in transit are sensitive. Use the vendor's PGP key if they publish one (check security.txt), or establish an encrypted channel before sending.