Bait A Phish
Bait A Phish
Security Pulse
tutorial · bandit

Bandit Level 13

Rebuild a repeatedly-compressed file from a hexdump (xxd + file + decompress loop).
banditxxdgzipbzip2tarfile
Narration (cached)
Marks this level complete in your browser.

Goal

data.txt is a hexdump of a file that has been repeatedly compressed.

You need to reconstruct the binary, then repeatedly identify and decompress until you reach the plaintext password.

Hints

Solution (click to reveal)
  1. SSH in and create a scratch dir:
ssh bandit13@bandit.labs.overthewire.org -p 2220
workdir=$(mktemp -d)
cd "$workdir"
  1. Copy the hexdump file into your scratch space:
cp ~/data.txt .
  1. Convert hexdump to a binary file:
xxd -r data.txt > blob
  1. Now iterate:
file blob

Depending on what file says, do one of these and rename the output back to blob:

  • If it’s gzip:

    mv blob blob.gz && gunzip blob.gz && mv blob blob
    
  • If it’s bzip2:

    mv blob blob.bz2 && bunzip2 blob.bz2 && mv blob blob
    
  • If it’s a tar archive:

    mv blob blob.tar && tar -xf blob.tar
    # then identify the extracted file and continue
    ls -la
    

Repeat until file blob reports plain text. Then:

cat blob

That output is the password for Level 14.

Notes

Bandit Level 12Bandit Level 14