Writeups PicoCTFForensicsDisk ImageSleuthkit

Sleuthkit Apprentice Writeup - PicoGym

Writeup for the Sleuthkit Apprentice challenge from PicoCTF PicoGym.

Contents

Category: Forensics

Difficulty: Medium

Points: 200

Description

A compressed disk image (disk.flag.img.gz) is provided. The flag is stored in a file somewhere on the filesystem. The challenge requires navigating the disk image using The Sleuth Kit without mounting it.

Overview

Background: The Sleuth Kit

Solution

Step 1: Decompress the Disk Image

run_bash(["gunzip", "disk.flag.img.gz"])

Step 2: List Partitions with mmls

out, _ = run_bash(["mmls", "disk.flag.img"])
offsets = [line.split()[2] for line in out.splitlines()[5:]]

Step 3: Find the Root Filesystem

for offset in offsets:
    out, _ = run_bash(["fls", "-o", offset, "disk.flag.img"])
    if "root" in out:
        break

Step 4: Navigate to the Flag File

# Get inode of /root directory
root_inum = [row[1] for row in parsed if "root" in row[2]][0]

# List /root
out, _ = run_bash(["fls", "-o", offset, "disk.flag.img", root_inum])

# Get inode of my_folder
folder_inum = [row[1] for row in parsed if "my_folder" in row[2]][0]

# List my_folder
out, _ = run_bash(["fls", "-o", offset, "disk.flag.img", folder_inum])

# Get inode of flag.uni.txt
flag_inum = [row[1] for row in parsed if "flag.uni.txt" in row[2]][0]

Step 5: Extract the File Content with icat

out, _ = run_bash(["icat", "-o", offset, "disk.flag.img", flag_inum])
result = out.strip()

Flag

picoCTF{by73_5urf3r_2f22df38}

← Back to Blog