OverTheWire — Natas Level 8

Complete solution and explanation of natas level 8

Hritesh J
1 min readJan 31, 2022

Level 7 → Level 8

URL: http://natas8.natas.labs.overthewire.org/

  • here we find a box, where we can input some data (numbers, alphabets, symbols)
  • let’s try what it does by giving a random input say “passwd”, it says Wrong secret
  • now let’s view the source code
  • Oops, we can see the steps or ways in which our input is modified to match the correct secret
  • the function does

bin2hex : converts binary to hex

strrev : reverses the string

base64_encode : encodes the string in base 64

and then compares it with the variable secret

if you don’t know what these are, please google them

  • now all we have to do is reverse these steps (you can try this compiler)
<!DOCTYPE html>
<html>
<body>
<?php
$secret = "3d3d516343746d4d6d6c315669563362";
# given function
# echo bin2hex(strrev(base64_encode($secret)));
# reversing the function to get the secret
echo base64_decode(strrev(hex2bin($secret)));
?>
</body>
</html>
  • after reversing we get the secret oubWYf2kBq, once we submit this, we get the password for the next level!!

Give this a 👏 if you found it useful!

--

--

Hritesh J

Hritesh J is a student pursuing undergraduate studies in CS. Loves cybersecurity and playing ctfs and writing about them. “learning one new thing every day.”