Skip to content

Behemoth Level 1

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 behemoth1, find the password for behemoth2.

What this level teaches

The Narnia-style stack overflow, but starting from a binary alone.

Key ideas

  • Unsafe input functions. Functions that read without a length limit, such as gets, make overflows trivial. Disassembly or ltrace will show which one is used.
  • Finding the offset. Send a cyclic pattern in gdb and read which part lands in the saved return address.
  • Shellcode and its address. Place shellcode in the buffer or environment, and aim the return address at it. Remember gdb changes the stack slightly compared with a normal run.
  • Keep the shell alive. Make sure your input does not close standard input before the shell can use it.

How to approach it

  1. Confirm the crash with a long input.
  2. Find the offset and the buffer's address.
  3. Build and test the payload, adjusting for the real stack layout.

Why it matters

It consolidates the Narnia skills and confirms you can work without source.