Lost and Found
umasscybersec
Task: analyze a VM disk image where a home directory and Git repository were recursively obfuscated with an XOR utility. Solution: recover the repeating key from known plaintext in Git hook templates, decrypt the tree, and inspect the stash ref directly to extract the flag.
$ ls tags/ techniques/
Lost and Found — UMass Cybersecurity CTF
Description
Original task text was not preserved in the local solve artifacts.
English summary: the challenge provides a VM image with an Alpine-like filesystem. The goal is to recover what was hidden inside an XOR-obfuscated /home tree and extract the flag.
Analysis
After extracting the OVA, converting the VMDK to raw, and inspecting the ext4 filesystem, the first useful artifact was /root/.ash_history. It showed cargo install xor, git init ., later Git activity, and manual editing of .ash_history, which strongly suggested intentional filesystem tampering.
Reading the installed crate source at /root/.cargo/registry/.../xor-1.4.5 explained the layout under /home: in recursive mode, the tool XORs file contents and renames files and directories by XORing the original names and hex-encoding the result. That immediately explained the hex-looking names such as 5457501C.
Using the repeated encrypted filename for red-herring as known plaintext recovered part of the key and showed that 5457501C decrypted to .git. The full repeating 512-byte key was then recovered by XORing encrypted .git/hooks/* files against the default hook templates in /usr/share/git-core/templates/hooks/.
Solution
- Extract the VM archive, convert the disk to raw, and inspect the ext4 filesystem.
- Recover
/root/.ash_historyand identifyxorplus Git usage. - Read the local
xorcrate source to confirm recursive XOR of both file contents and names. - Use known plaintext from the repeated
red-herringfilename to identify part of the key and confirm5457501C -> .git. - Recover the full repeating key by matching encrypted
.git/hooks/*files to the stock Git hook templates. - Decrypt the entire
/hometree and restore the Git repository. - Ignore misleading extra refs and inspect
.git/refs/stashdirectly. - Read the referenced stash object/log message and extract the flag.
#!/usr/bin/env python3 from pathlib import Path ...
Permission denied (requires auth)
Sign in to read this free writeup
This writeup is free — just sign in with GitHub to read it.
$ssh [email protected]