CyberKit

Stack Canary

Also called stack cookie, stack protector.

A guard value checked on return to detect stack overflows.

What it is

A mitigation that places a known random value (the canary) between local buffers and the saved return address. The value is verified before a function returns, and a mismatch aborts the program.

Why it matters

Stack canaries detect contiguous stack overflows before control flow is hijacked, defeating naive smashing. Attackers must leak or avoid overwriting the canary, which raises the bar and leaves crash evidence.

In practice

A buffer overflow overwrites the canary, the prologue check fails, and the process terminates with a stack-smashing-detected message instead of running shellcode.

What to look for

  • Binaries compiled without stack protection.
  • Canary failures that point to an overflow attempt.
  • Leaks that expose the canary value.

Common mistake

Assuming a canary covers every overflow. It guards the return address, not every local variable.

Practice it nearby

CyberKit has no tool for this term itself. These are the closest places to practice it.

Read next

Sources