Bandit Level 13
Bandit Level 13 — peel back layers of a hexdump, gzip, bzip2 and tar by repeatedly identifying and unpacking the file.
Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.
Level Goal
The password for the next level is stored in the file data.txt, which is a hexdump of a file that has been repeatedly compressed. For this level it may be useful to create a directory under /tmp in which you can work. Use mkdir with a hard to guess directory name. Or better, use the command “mktemp -d”. Then copy the datafile using cp, and rename it using mv (read the manpages!)
Commands you may need to solve this level
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd, mkdir, cp, mv, file
Helpful Reading Material
Study guide
Level map: logged in as bandit12, find the password for bandit13.
What this level teaches
A repeatable loop for dealing with unknown, nested data: identify, unpack, repeat.
Key ideas
- Hexdump.
xxdshows bytes as hexadecimal;xxd -rreverses a dump back into the original binary. - Compression formats. gzip, bzip2 and tar archives each begin with a recognisable signature, so
filecan name them at every layer. - Extension expectations.
gzip -dandbzip2 -dexpect matching filename suffixes, so you will rename files withmvbetween steps. - A private working directory. You cannot normally create files in your home directory. Make a new one under
/tmpwithmktemp -d, which picks a name nobody can guess, and copy the data file into it withcp.
How to approach it
- Reverse the hexdump into a file.
- Run
fileon it, apply the matching tool, and runfileon the result. Repeat until you see plain text. - Keep notes of the chain you followed; it is easy to lose your place.
Why it matters
Malware droppers, CTF challenges and forensic images are frequently layered. A calm identify-and-unpack loop beats guessing.