Skip to content

Challenge workflow

Binary challenge workflowFive steps from scope and identify, through static analysis and debugging, to exploit construction and local verification.01Identifyformat / arch / scope02Tracestrings / callers / input03Measurecrash / offset / control04Buildsmall local script05Verifyfresh run

Treat each exploit as a chain of claims. Record what the program does, what your input controls, and what changes after each experiment.

Start with the file and runtime facts. Do not infer the architecture from a filename or an old write-up.

Terminal window
file ./challenge
checksec --file=./challenge
readelf -h ./challenge
strings -a -n 5 ./challenge | less
nm -an ./challenge | less

file and ELF headers identify the format and architecture. The security summary helps set expectations. Strings and imports can reveal prompts, error paths, menu options, or useful references. Stripped symbols are normal.

For a challenge stored at C:\Users\analyst\Downloads\Reverse Task, quote the path because it contains spaces. In PowerShell:

Terminal window
$challengeDir = 'C:\Users\analyst\Downloads\Reverse Task'
Set-Location -LiteralPath $challengeDir
Get-ChildItem -Force
Get-ChildItem -File | Format-Table Name, Length

The variable keeps the folder path together; Set-Location opens that directory; Get-ChildItem -Force lists visible and hidden contents; the last command lists file names and sizes. Look for the actual executable (.elf, .bin, or a file with no extension), not just its source or a write-up.

Ghidra runs on Windows and can import the executable itself: choose File → Import File, browse to the challenge folder, and select the binary. Importing a folder does not automatically identify which file is the target.

For Linux ELF challenges, run GDB and pwndbg inside Linux or WSL. The Windows C: path is mounted in WSL at /mnt/c/:

Terminal window
cd "/mnt/c/Users/analyst/Downloads/Reverse Task"
ls -la
file ./chall
gdb -q ./chall

The quotes keep Reverse Task as one path. file confirms whether chall is an ELF binary; gdb -q opens it in GDB without the startup banner. Replace chall with the file you found. Once GDB opens, use the GDB quick reference or pwndbg’s run-control guide.

If the folder contains only C source, check its README or Makefile and build it using the provided instructions. Do not guess compiler flags: changing them can change the protections and behavior you are trying to analyze. A pwntools script launched from that WSL directory can then use ELF("./chall") and process("./chall").

In Ghidra, search for visible prompts and imported input functions. Follow references to their callers, then trace the user-controlled value toward a copy, format string, index, size, or indirect call.

Rename functions only after confirming their behavior. The decompiler is a navigation aid; check the listing or runtime state before relying on details that affect an exploit.

Run the binary with a small valid input first. Note prompts, newline handling, menu state, and whether the process reads once or loops.

gdb -q ./challenge
(gdb) set disassembly-flavor intel
(gdb) start
(gdb) info functions
(gdb) disassemble main

gdb -q opens the binary without the startup banner; set disassembly-flavor intel selects Intel syntax; start runs to main; info functions lists function symbols GDB knows; disassemble main prints main’s machine instructions.

Write down the bug in one precise sentence. Examples:

  • A copy accepts more bytes than the local destination holds.
  • User-controlled bytes become the format string.
  • A length calculation wraps before an allocation or copy.
  • A branch uses a value that the input can influence.

For a suspected stack overwrite, send a cyclic pattern and inspect the saved return slot before the function returns. The exact offset, input boundary, and overwritten bytes matter more than the source-level array size. See Stack memory.

  • A useful function already exists and the return slot is controllable: try ret2win.
  • An imported function can disclose an address: try the two-stage ret2libc recipe.
  • Multiple calls or register setup are required: construct and inspect a ROP chain.
  • Input reaches a print format parameter: establish whether the primitive reads, writes, or both before constructing a payload.

Read Mitigations before committing to an address-based plan.

Keep the final script small. Separate the leak, address calculation, and final payload. Print addresses in hex, run from a fresh process, and check the output against the challenge’s success condition.

Record the exact command, input, crash point, observed bytes, relevant address, and what changed when you tested the hypothesis. The field notes page covers common debugging snags.