OverTheWire Bandit Level 12 Walkthrough

Today we're doing a walkthrough of level 12 of the Bandit CTF wargame hosted at OverTheWire.org.  First, let's look at the level's objectives:

https://overthewire.org/wargames/bandit/bandit13.html


The Flag for this level is located in the data.txt which is a hexdump and has also been repeatedly compressed.

Now let's login to the game server using SSH.  Remember to use the Flag from the previous level as the SSH password.

ssh bandit12@bandit.labs.overthewire.org -p 2220


Now let's locate the data.txt file.

pwd
ls -a


In this level, we will be manipulating the data.txt file a lot.  In order to create new files, copy files and rename files, we will have to work inside a directory where we have write privileges.  First, we'll use the mkdir command to create a temporary directory to work in, then we'll navigate to that directory, and finally we'll copy the data.txt file to that directory.

mkdir /tmp/tmp12
cd /tmp/tmp12
cp /home/bandit12/data.txt /tmp/tmp12/data.txt


Next, we'll cat out the data.txt file to see if we can get any clues.

cat data.txt


The data.txt file was previously named data2.bin, so let's rename it back to that.  Then we'll use the xxd command to revert the file back to its previous state, then use the file command to see what kind of compression we're dealing with.

mv data.txt data2.bin
xxd -r data2.bin data2.bin
file data2.bin


The following commands will be a cycle of decompressing the file over and over again until the ASCII version of the file is revealed.

mv data2.bin data2.gz
gzip -d data2.gz
mv data2 data2.bz2
dzip2 -d data.bz2
mv data2 data.gz
gzip -d data.gz
mv data data.tar
tar -xvf data.tar
mv data5.bin data5.tar
tar -xvf data5.tar


mv data6.bin data6.gz
bzip2 -d data6.bz2
mv data6 data6.tar
tar -xvf data6.tar
mv data8.bin data8.gz
gzip -d data8.gz
file data8


The final step is to cat out the data8 file to receive the Flag.

cat data8


Summary

Bandit12 requires us to revert a hashdumped file, then go through a series of decompression cycles in order to access a ASCII file and receive the level's Flag.

Finish







Comments

Popular posts from this blog

TryHackMe - Windows PrivEsc - Walkthrough

TryHackMe - Reversing Elf - Walkthrough

TryHackMe - XSS - Walkthrough