Skip to content

Binary protections

Protection flags describe constraints, not a verdict. Confirm the behavior in the target process and keep the exact binary and library versions in your notes.

Terminal window
checksec --file=./chall
file ./chall
readelf -h ./chall
readelf -l ./chall
readelf -s ./chall | less

checksec is a compact summary. readelf shows the underlying ELF metadata and program headers. When results matter, inspect the file and runtime mapping rather than relying on a single summary line.

Mitigation What it changes Typical consequence for analysis
NX Marks data pages non-executable. Injected stack bytes usually cannot run; code reuse may be relevant.
Stack canary Checks a guard value before a protected function returns. A write must avoid, recover, or otherwise account for the guard; a crash in __stack_chk_fail means the check fired.
PIE Makes the executable’s load address relocatable. Code addresses need a runtime base, often established by a leak.
ASLR Randomizes process mappings. Stack, shared libraries, and PIE bases can vary between executions.
RELRO Restricts writes to relocation data after loader setup. Full RELRO makes the GOT read-only; it does not stop every control-flow technique.
FORTIFY Adds checks to selected library operations when the compiler can infer sizes. Some unsafe calls fail early; coverage depends on the call and build.
Stripped symbols Removes many names and debugging symbols. Navigation needs imports, strings, xrefs, function boundaries, and runtime evidence.

PIE allows the main executable to load at a variable base. ASLR is the operating-system policy that randomizes mappings. A non-PIE executable can still have randomized stack and library mappings. In a debugger, settings such as set disable-randomization on can make observations repeatable while debugging; they do not describe the normal environment.

In GDB or pwndbg, compare static expectations with the process map:

info proc mappings
vmmap # pwndbg

Look for the executable, stack, libc, and permissions. A mapping ending in x is executable; w is writable. Mappings and addresses can change on each fresh run when randomization is active.

  1. Identify the input primitive and measure its real boundary.
  2. Determine which security check interrupts the path, if any.
  3. Check whether the needed address is stable, position-independent, or leaked at runtime.
  4. Choose the smallest technique that meets those constraints.
  5. Re-run from a clean process and verify each assumption.

Do not treat “NX enabled” as “ROP required” or “canary enabled” as proof that control is impossible. The binary’s reachable paths and the challenge’s permitted setup determine what is feasible.