Narnia · OverTheWire

Narnia Level 1 → Level 2

Level 1

Username : narnia1
Password : efeidiedae
SSH : narnia.labs.overthewire.org:2226

Solution

To solve this level, we first ssh into the narnia server using the credentials provided above. Let’s have a look at the executable for this level and its source code.

Screenshot from 2017-07-24 12-38-03.png

7-24-2017 12-43-10 PM.png

As we can see, the executable checks for the existence of an environment variable named ‘EGG’. To read more on environment variables, click here. Therefore, we need to create our shellcode and store it in the environment variable. The executable would then execute our shellcode for us. This would be a good point to read on Buffer Overflow if you’re unfamiliar with that. This link provides good information about it. Since we would be executing our shellcode from the environment variable, this link provides a really nice script to store our shellcode. Let’s now create our shellcode and store that in the ‘EGG’ environment variable.

Screenshot from 2017-07-25 12-49-48.png

As we can see above, we now have the shellcode. Let’s store this in the variable now.

Screenshot from 2017-07-25 12-57-17.png

Now that our shellcode is loaded, let’s execute ‘narnia1’

Screenshot from 2017-07-25 13-11-07.png

Level 2

Username : narnia2
Password : nairiepecu
SSH : narnia.labs.overthewire.org:2226

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s