Skip to content

Narnia Level 4

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 narnia4, find the password for narnia5.

What this level teaches

Adapting a familiar attack when a convenient hiding place is taken away.

Key ideas

  • Where payload can live. Earlier you may have used the environment; if the program wipes it, the buffer or arguments must hold your code.
  • Reliable addresses. The stack position can shift with environment and argument size, so use gdb's view and be consistent between debugging and real runs.
  • NOP sleds. A run of no-operation instructions in front of shellcode widens the target you must hit.
  • Size limits. Shellcode has to be small enough to fit.

How to approach it

  1. Read the source and find out what the program does to the environment.
  2. Use gdb to find the offset and your buffer's address.
  3. Build a payload of padding, shellcode and return address that fits.

Why it matters

Practice in adapting to constraints is the core skill of exploit development.