Writeups OverTheWireBanditLinuxCompressionxxd

Bandit 12 Writeup - OverTheWire

Writeup for Bandit level 12 from OverTheWire: repeatedly decompressing a hexdump.

Contents

Wargame: Bandit

Level: 12

Category: Linux Fundamentals

Description

data.txt is a hexdump of a file that has been compressed multiple times. The goal is to reverse each layer of compression until the final plaintext file containing the password is reached.

Overview

Background: Compression Formats

Solution

Step 1: Reverse the Hexdump

mkdir /tmp/work && cd /tmp/work
cp ~/data.txt .
xxd -r data.txt > data.bin

Step 2: Iteratively Decompress

file data.bin
# e.g. "gzip compressed data" -> mv data.bin data.gz && gzip -d data.gz
# e.g. "bzip2 compressed data" -> mv data.bin data.bz2 && bzip2 -d data.bz2
# e.g. "POSIX tar archive" -> tar -xf data.tar

Step 3: Read the Password

cat data10.txt

Password

wbWdlBxEir4CaE8LaPhauuOo6pwRmrDw

← Back to Blog