Skip to content

Behemoth Level 3

Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.

There is no information for this level, intentionally.

Study guide

Level map: logged in as behemoth3, find the password for behemoth4.

What this level teaches

Format-string exploitation starting from a compiled program.

Key ideas

  • Recognising the bug. The program prints your input with a printf-style call without a fixed format. Feeding %x specifiers shows stack contents.
  • Locating your input on the stack with positional specifiers.
  • Choosing a target to overwrite. A function pointer, a Global Offset Table entry or a return address can redirect execution.
  • Where to put shellcode. An environment variable is a convenient place, and its address can be computed.

How to approach it

  1. Confirm the vulnerability with a harmless sequence of specifiers.
  2. Find the stack index of your own input.
  3. Decide on the target and the value, then build the write.

Why it matters

It repeats a technique you learned earlier in a more realistic setting.