Practical CTF Series • Challenge 04

Computer Architecture Memory Warehouse

You are the MMU. The TLB is completely cold. Perform an architectural 4-level x86-64 page table walk to translate Virtual Address 0x0000_0100_4040_1005 into its physical warehouse coordinates, recover the field note, and decode the Four-Square cipher.

Level 4 (Expert) x86-64 Architecture / Page-Table Walk / Keyed Ciphers Page Table Bit Splitter • Four-Square Matrix • dCode +100 XP Reward Unsolved (0/100 XP) Series: 0 / 325 XP
Steganography CTF Cover
CYBERSECMASTERY CYBER RANGE
Operation Badger: Phase 4
Series Guide Intro & Lab Setup
01
Challenge 01 Intercepted Email & EXIF
02
Challenge 02 Steghide & Wordlist Crack
03
Challenge 03 Multi-Layer Carve & DQT
04
Active Mission Page-Table Warehouse

Investigation Workbench • Challenge 4

1

Identify the Container File Type

Reconnaissance

File extensions can be easily manipulated or spoofed. Use the file command to inspect the internal magic bytes of the target sample and verify what kind of container you are analyzing.

file email.eml
Why we do this: The .eml format is an RFC 822 / RFC 2822 internet message standard. The file utility confirms it contains UTF-8 text rather than a compiled executable, which guides our decision to inspect it via text pagers before launching extraction tools.
2

Terminal Paging & Searching for Attachments

Inspection

Printing the entire raw email with cat floods your terminal with megabytes of Base64 strings. Use less to inspect the email header by header and search for the MIME attachment boundaries and leaked credentials.

less email.eml
Key Discovery: Inside the email body, the sender carelessly left a credential note: Definitely not the password: honeybadger4lyfe. Furthermore, the Content-Type: image/jpeg; name="secretphoto.jpeg" header reveals an embedded JPEG file.
3

Carve the MIME Attachment with munpack

Carving

Rather than manually decoding Base64 or launching heavy GUI mail clients, use the munpack CLI utility (from the mpack package) to extract the JPEG attachment directly into your working directory.

sudo apt install mpack && munpack email.eml
Artifacts Generated: The command produces secretphoto.jpeg (the primary evidence file) and secretphoto.desc (MIME description header). Verify with ls -la.
4

Extract Suspicious EXIF Metadata Comment

Metadata Analysis

Opening the image in an image viewer shows a normal photograph. Run exiftool to perform deep metadata inspection. Look for non-standard tags, particularly the Comment field.

exiftool secretphoto.jpeg
Forensic Anomaly: The EXIF Comment tag holds U2FsdGVkX18KFhm4mZ2SwRS7J9jOm2EuecqdadiwCqDFFfA+VIKlg88xIJ/A0l+l. The prefix U2FsdGVkX18= is the Base64 representation of Salted__, the signature magic header of an OpenSSL encrypted container!
5

Decrypt OpenSSL AES-256 Payload & Recover Flag

Flag Recovery

Extract the raw comment and pipe it into OpenSSL for decryption using the leaked passphrase (honeybadger4lyfe), AES-256-CBC cipher, Base64 decoding (-a), and PBKDF2 key derivation.

exiftool -b -Comment secretphoto.jpeg | openssl enc -aes-256-cbc -d -pbkdf2 -a -k honeybadger4lyfe
1

Target Reconnaissance & Triage

Reconnaissance

You have retrieved stego_badger.jpeg. Run baseline triage with file and exiftool. Note that unlike Challenge 1, no obvious ciphertext exists in the EXIF comments.

file stego_badger.jpeg && exiftool stego_badger.jpeg
Analysis: The file is a valid JPEG image (JFIF 1.01). Standard metadata strings are clean. When metadata reveals nothing, forensic analysts test for spatial domain steganography and DCT frequency embedding using tools like steghide.
2

Analyze Clues & Prepare Wordlist

Intelligence

The operative's brief included a subtle hint: "WE WILL, WE WILL..." — a clear reference to Queen's famous anthem Rock You. In Kali Linux, the standard dictionary is /usr/share/wordlists/rockyou.txt.

ls -lh /usr/share/wordlists/rockyou.txt*
3

High-Speed Passphrase Cracking with Stegseek

Brute Force

Standard stegcracker can take several minutes to test dictionaries. Modern forensic teams use stegseek, a lightning-fast tool capable of testing millions of passwords per second against steghide carriers.

stegseek stego_badger.jpeg rockyou.txt
Passphrase Recovered: Stegseek immediately cracks the sample and uncovers the passphrase: password123.
4

Extract the Concealed Document

Extraction

With the recovered passphrase, use steghide extract to carve the concealed payload file into doc.txt.

steghide extract -sf stego_badger.jpeg -p password123 -xf doc.txt
5

Inspect Recovered Artifact & Claim Flag

Flag Recovery

Inspect the extracted file. Line 1 contains the Challenge 2 flag. Do not discard the document! Line 9 contains the ciphertext needed for Challenge 4, and the remaining 201 records provide key material for Challenge 3.

head -n 1 doc.txt && sed -n '9p' doc.txt
1

Analyze Concatenated Seams with Binwalk

Deep Carving

Run binwalk Honey.jpeg. Unlike normal images with a single trailer (FF D9), this carrier is a stacked multi-file composite containing OpenSSL salt signatures (Salted__), ZIP archives, and an embedded inner JPEG.

binwalk Honey.jpeg
2

Reason Out Passphrase from the "John" Story

Cryptanalysis

The operative narrative teaches you to build the key, not brute-force it: Codename (DesertStorm) + # + mask ?d?d?l?u?l (82pLm) = DesertStorm#82pLm. Decrypt the outer bundle secret.enc.

openssl enc -d -aes-256-cbc -pbkdf2 -pass pass:'DesertStorm#82pLm' -in secret.enc -out secret_bundle.zip
Bundle Contents: Unzipping secret_bundle.zip reveals: qtbl.py (DQT extractor), STEGO_KEY_368.txt (201 records), passwords.enc, and iv.bin.
3

Construct Stego Key 368

Key Synthesis

The filename 368 directs you to select record #3, record #6, and record #8 from the 201 records in STEGO_KEY_368.txt and concatenate them in reference order.

python3 -c "s=open('STEGO_KEY_368.txt').read().strip(); r=[s[i:i+24] for i in range(0,len(s),24)]; print(r[2]+r[5]+r[7])"
4

Extract AES Key from JPEG Quantization Tables

DQT Stego

Execute qtbl.py extract against the carved inner JPEG nothingtoseehere.jpg using the synthesized 72-character key to pull the raw 32-byte AES key.

python3 qtbl.py extract -i nothingtoseehere.jpg -o aeskey.bin -k "QZFCUPBAFMCKZSHSKOSQURRJPAXUFABOGAZEJEQANIZEYABOUPNAHLNSIBESOLTUEBUPDNEY"
5

Decrypt Nested Payloads & Reveal Final Flag

Flag Recovery

Decrypt passwords.enc using the raw key and IV, extract the high-entropy payload password, and decrypt payload.enc to reveal the flag!

openssl enc -d -aes-256-cbc -in passwords.enc -out passwords.txt -K $(xxd -p aeskey.bin | tr -d '\n') -iv $(xxd -p iv.bin | tr -d '\n')
1

Read the MMU Mission Memo

System Architecture

The mission directive instructs: "MMU, your TLB is empty. You must perform a PT walk to resolve virtual address VA = 0x0000_0100_4040_1005 into a physical location in our memory warehouse."

cat warehouse_memo.txt
2

48-bit x86-64 Page-Table Bit Splitting

Bit Arithmetic

In x86-64 hardware, the 48-bit virtual address is partitioned into four 9-bit table indices and a 12-bit page offset: [PML4 9b][PDPT 9b][PD 9b][PT 9b][Offset 12b].

python3 -c "va=0x0000010040401005; print('PML4:', (va>>39)&0x1ff, 'PDPT:', (va>>30)&0x1ff, 'PD:', (va>>21)&0x1ff, 'PT:', (va>>12)&0x1ff, 'Offset:', va&0xfff)"
Calculated Vector: PML4 = 2, PDPT = 1, PD = 2, PT = 1, Offset = 5 → [2, 1, 2, 1, 5].
3

Translate Vector to Physical Warehouse Location

Spatial Mapping

Map the hierarchy on the warehouse floor from large structures to small: L1/PT → Row 1; L2/PD → Bay 2 (Back); L3/PDPT → Shelf 1 (Bottom); L4/PML4 → Sub-section 2; Offset → Box 5.

locate_box --row 1 --bay 2 --shelf 1 --sub 2 --box 5
4

Inspect Field Note & Identify Cipher Clues

Cryptanalysis

Inside Box 5 is a handwritten note with 4 corner words: Honey (Top-Left), Badger (Top-Right), Heck (Bottom-Left), Yeah (Bottom-Right), pointing to "dCode" and "Line #9".

cat warehouse_note.svg
5

Execute Keyed Four-Square Decryption

Flag Recovery

Line 9 from the Challenge 2 document is UPNAHLNSIBESOLTUEBUPDNEY. Decrypt this 24-character ciphertext using a Four-Square cipher where all four 5x5 squares are keyed with the corner words!

python3 decode_foursquare.py --cipher UPNAHLNSIBESOLTUEBUPDNEY --tl HONEY --tr BADGER --bl HECK --br YEAH

Mission Dossier

Ch 4
Challenge ID: 04
Codename: Operation Badger: Phase 4
Difficulty: Level 4 (Expert)
Category: x86-64 Architecture / Page-Table Walk / Keyed Ciphers
Reward: +100 XP

Submit Challenge Flag

+100 XP

Enter the recovered flag for Challenge 4 to verify and claim your XP reward.

Starter Files & Repo

3 Files
jdtherobot / steganography-ctf
github.com • tree/main
warehouse_memo.txt
Official MMU Virtual Address Memo
1 KB
warehouse_note.svg
Recovered Warehouse Field Note (Vector SVG)
2 KB
warehouse_note.png
High-Res Field Note Diagram (PNG)
53 KB

Command Quick Reference

Ch 4 CLI
  • python3 -c "va=0x0000010040401005; print((va>>39)&0x1ff, (va>>30)&0x1ff, (va>>21)&0x1ff, (va>>12)&0x1ff, va&0xfff)" Splits 48-bit VA into [PML4, PDPT, PD, PT, Offset] → 2, 1, 2, 1, 5.
  • echo "Row 1 / Bay 2 (back) / Shelf 1 / Sub-section 2 / Box 5" Physical memory warehouse coordinates for box.
  • cat warehouse_note.svg Inspects recovered card with corner keys (Honey/Badger/Heck/Yeah).
  • python3 decode_foursquare.py Decodes Line 9 ciphertext UPNAHLNSIBESOLTUEBUPDNEY to reveal flag.