Another day, another challenge…
In today’s challenge we’re going to solve level 8 from the Natas wargame.
Going to the following link, and entering the username “natas8” and password “DBfUBfqQG69KvJvJ1iAbMoIpwSNQ9bWe” we get the following:
OK, we see a page that is asking for an input secret. Clicking the view sourcecode link we see:
Looking at the screen, there’s PHP code with an encoded secret variable that seems to be in hexadecimal. There’s also a function titled “encodeSecret” that does the following steps:
- Change the binary to hex (bin2hex)
- Reversing the string (strrev)
- Base64 encoding (base64_encode)
From there the code is checking to see if our input secret equals the encoded secret. If it does then we get the code for level 9, otherwise we need to try again.
So, how are we going to solve this?
Going to Google and looking for a PHP interpreter, we’re presented with the following link.
From there, We’re going to do the reverse the steps of above. Our new steps are:
- Convert the hex to binary (hex2bin)
- Reverse the string (strrev)
- Base64 decode (imap_base64)
Below is the screenshot that depicts the above steps.
Doing the steps, we are presented with the decoded secret which is “oubWYf2kBq”
Going back to the level 8 page, and entering our decoded secret we get the following:
We found the flag!
1 thought on “OverTheWire: Natas Level 8 – #appsec #webapp #websecurity #wargames”