Logo
Overview

MetaCTF - Digital Forensics Walkthroughs

January 15, 2025
7 min read

Introduction

This collection covers MetaCTF On Demand Labs - a series of digital forensics challenges perfect for beginners. These walkthroughs demonstrate fundamental DFIR techniques including file analysis, network packet inspection, metadata extraction, and basic steganography.

Difficulty: Beginner to Intermediate
Skills Covered: File type identification, Wireshark, exiftool, base64 encoding, hex editors, SQLite forensics


I’ve Got The Magic

Magic In Me

File provided: magicinme

Solution

By typing file magicinme into our terminal - we discover the file type without the file having the correct extension (i.e .7z or .zip).

We then add the correct extension to the file:

Terminal window
mv magicinme magicinme.7z

Magic In Me 1

Then, we unzip with:

Terminal window
7z e magicinme.7z

Magic In Me 2

Open the file with xdg-open flag.jpg

Magic In Me 3

Key Takeaway: The file command identifies file types by analyzing magic bytes, not file extensions.


Forensics, Here I Come

Here I Come

Terminal window
xxd -l 2 [filename]

Breakdown of the command:

  • xxd: Creates a hex dump of a file
  • -l 2: Limits the output to the first 2 bytes
  • [filename]: The file you want to examine

Example output for a Windows executable:

Here I Come 1

Key Takeaway: The magic bytes 4D 5A (MZ) identify Windows PE executables.


Can PowerShell Please Join Us On the Stage?

Can Powershell Please

To solve this we take the base64 encoded blob and throw it into CyberChef selecting From Base64 and dragging it into the Recipe Section.

Can Powershell Please 1

In PowerShell, the flag -eC (or -EncodedCommand) tells PowerShell to expect the following argument as a Base64-encoded string that represents the script/command to run.

Use the recipe:

  1. From Base64
  2. Decode Text UTF-16LE (1200)

Key Takeaway: PowerShell -EncodedCommand uses UTF-16LE encoded Base64 to obfuscate malicious commands.


On The Wire

On The Wire

Opening the provided .pcap file in Wireshark shows plaintext unencrypted credentials in the packet stream.

On The Wire 2

Key Takeaway: Never transmit credentials over unencrypted protocols. Always use TLS/SSL.


Anonymoose

Anonymoose

Using exiftool we are able to view the metadata in the provided PDF:

Terminal window
exiftool D34DM0053_Open_Letter_Mental_Health.pdf

Anonymoose 1

Key Takeaway: Document metadata often contains valuable information about the creator, software used, and editing history.


runCAPTCHA

runCAPTCHA

Visiting the provided URL - Right click > Inspect brings up Google Chrome’s Developer Tools.

We find a function that looks suspicious:

runCAPTCHA 2

From here we take this Base64 blob and bring it into CyberChef using the From Base64 and Decode Text UTF-16LE (1200) recipes.

From here we find the malicious URL and our flag:

runCAPTCHA 3

Key Takeaway: JavaScript can be obfuscated using Base64 encoding to hide malicious URLs and behavior.


Browser, Wowser

Browser Wowser

Knowing what we are looking for "MetaCTF", we can use strings to extract the flag with minimal effort:

Terminal window
strings places.sqlite | grep MetaCTF{

Browser Wowser 2

Key Takeaway: Browser artifacts like places.sqlite (Firefox) contain browsing history that can be extracted with forensic tools or simple string searches.


Spam to Ham

Spam to Ham Challenge

This challenge gives us an email that was intercepted with base64 encoded contents. Inspecting the file reveals a clue: I've attached an image in this email.

Spam to Ham Email

Taking the large base64 encoded blob and putting it into CyberChef shows PNG magic bytes.

Spam to Ham CyberChef

Copy the base64 into a file named flag.64:

Spam Not Ham 1

Decode it:

Terminal window
base64 -d flag.64 > flag_64.png
file flag_64.png

Spam Not Ham 2

Spam Not Ham 3

Spam Not Ham

Key Takeaway: Email attachments can be embedded as base64-encoded content in the message body.


Flags Over The Wire

Flags Over The Wire Challenge

  1. Open the PCAP in Wireshark
  2. In the menu: File → Export Objects → FTP-DATA…

Flags Over The Wire 1

  1. Select flags.zip and click Save…

Flags Over The Wire 2

  1. Unzip and find flags.png

Flags Over The Wire 3

Key Takeaway: Wireshark can automatically extract files transferred over various protocols (HTTP, FTP, SMB, etc.) using the Export Objects feature.


Corruption

Corruption Challenge

“Oh no! I tried downloading a picture for my upcoming conference talk but it won’t open! Can you see if you can fix it and open it?”

Use file to identify file type:

Terminal window
file corrupted.png

Corruption 1

It looks like a PDF! Use pdfimages to extract images:

Terminal window
pdfimages -list corrupted.png
mkdir -p recovered/pdfimages && pdfimages -all corrupted.png recovered/pdfimages/img

Corruption 2

Opening the recovered PNG reveals the flag:

Corruption Solve

Key Takeaway: File format corruption can often be fixed by understanding the file structure and manually repairing magic bytes or headers.


All Your Files are Mine

All Your Files Challenge

Use file to identify the file type:

Terminal window
file abc.xyz

All Your Files 1

It’s a zip file! Rename and extract:

Terminal window
mv abc.xyz abc.xyz.zip
7z e abc.xyz.zip

All Your Files 2

Open evil_plan.txt to find the flag:

All Your Files Solve

Key Takeaway: Malicious actors often disguise file types using incorrect extensions. Always verify with the file command.


Top Secret

Top Secret Challenge

“The folks at NSA got too tired of having to physically print out and redact documents, so they decided to try a new digital tool. Check out how good it is at doing its job on this redacted document.”

Top Secret 1

The PDF only overlays black rectangles in its content stream; the underlying JPEG still contains the unredacted text, so direct image extraction bypasses the redaction:

Terminal window
pdfimages -all Nuclear_Codes_REDACTED.pdf img

Top Secret 2

Use OCR to extract text:

Terminal window
tesseract img-000.jpg stdout

Top Secret 3

Or just open the jpg manually:

Top Secret Solve

Key Takeaway: Improper redaction techniques (like overlaying black boxes) don’t actually remove sensitive information from documents. Proper redaction requires permanently removing the data.


Remote Data Pwnage 2 (Part 1)

RDP Challenge

“A malicious actor compromised a machine on our network and used it as a proxy to perform other attacks and connect to other machines. Our IR team managed to recover a partial file system dump of that machine. Take a look and see if you can reconstruct anything useful.”

Looking in C:\Administrator\AppData\Local\Microsoft\Terminal Server Client\Cache\ we find a .bin file:

RDP 1

We can use bmc-tools.py to extract thousands of image fragments:

RDP 2

The entire collage looks like this:

RDP 3

Very difficult to figure out what is going on here. For this, we use RdpCacheStitcher.

This can be quite time consuming to piece together all of these individual frames:

RDP 4

From here we can take frames and piece them together manually - like putting together pieces of a puzzle but for digital forensics:

RDP Solve

Key Takeaway: RDP cache files can be reconstructed to reveal what was displayed on screen during remote sessions, making them valuable artifacts in forensic investigations.


Summary & Key Takeaways

Essential Tools for Digital Forensics

  • file - Identify file types by magic bytes
  • xxd/hexdump - Hex editors for low-level file analysis
  • strings - Extract readable strings from binary files
  • exiftool - Metadata extraction from documents and images
  • CyberChef - Swiss Army knife for encoding/decoding
  • Wireshark - Network traffic analysis and packet inspection
  • SQLite Browser - Examine browser history and application databases
  • base64 - Decode Base64-encoded data

Forensic Concepts Covered

  1. Magic Bytes: File type identification independent of extension
  2. Metadata Analysis: Documents contain hidden information about creators and tools
  3. Network Forensics: Unencrypted protocols leak sensitive data
  4. Browser Artifacts: History databases preserve user activity
  5. Obfuscation Techniques: Base64 encoding commonly hides malicious content
  6. File Carving: Extract embedded or transferred files from larger datasets
  7. File Repair: Understanding file formats enables manual corruption fixes

Best Practices

  • Always verify file types with file command, not extensions
  • Use encrypted protocols (HTTPS, SFTP, SSH) for sensitive data transmission
  • Check document metadata before sharing to avoid information leakage
  • Understand common obfuscation techniques (Base64, hex encoding, compression)
  • Master CyberChef for quick encoding/decoding tasks
  • Practice with different file formats to recognize corruption patterns

Conclusion

These challenges provide an excellent introduction to digital forensics fundamentals. They demonstrate that many forensic tasks don’t require specialized tools - often, standard Linux utilities combined with an understanding of file formats and protocols are sufficient.

Next Steps:

  • Practice with more complex challenges involving memory forensics (Volatility)
  • Learn disk forensics with tools like Autopsy and FTK Imager
  • Explore malware analysis and reverse engineering
  • Study incident response frameworks (NIST, SANS)

Resources:

Happy hunting! 🕵️‍♂️