DEV Community

CTFDojo
CTFDojo

Posted on Edited on Originally published at ctfdojo.com

picoCTF Sleuthkit Apprentice Writeup: Find the Flag in a Disk Image with mmls, fls and icat

Decompress disk.flag.img.gz. mmls shows the partition table; the flag is on the last Linux partition. Pass its start sector to fls -o OFFSET -r, grep for flag to find flag.uni.txt under /root/my_folder, then icat -o OFFSET disk.flag.img INODE prints it.

  • Platform: picoGym (picoCTF 2022)
  • Category: Forensics
  • Difficulty: Beginner
  • Tools: mmlsflsicat

Challenge description

The Sleuth Kit reads file systems directly from an image, without mounting it — exactly what you want for forensics.

Provided: disk.flag.img.gz

Step 1 — Decompress and list the partitions

$ gunzip disk.flag.img.gz
$ mmls disk.flag.img
DOS Partition Table
Offset Sector: 0
Units are in 512-byte sectors

      Slot      Start        End          Length       Description
...
...   ...       0000360448   ...          ...          Linux (0x83)
Enter fullscreen mode Exit fullscreen mode

The image holds several partitions; the files you want are on the last Linux (0x83) partition. The Start column is the offset (in sectors) every other tool needs — 360448 in our image; use the value from yours.

Step 2 — Search the partition for flag files

fls lists files and directories; -r recurses, -o gives the partition offset:

$ fls -o 360448 -r disk.flag.img | grep flag
+ r/r 2082: flag.txt
+ r/r 2371: flag.uni.txt
Enter fullscreen mode Exit fullscreen mode

Both live in /root/my_folder. The number before each name is its inode, which may differ in your image. Read both — flag.uni.txt is the one that holds the flag.

Step 3 — Print the file with icat

icat outputs a file's content from its inode number:

$ icat -o 360448 disk.flag.img 2371
picoCTF{***}
Enter fullscreen mode Exit fullscreen mode

🚩 picoCTF{ flag intentionally hidden }

The flag is deliberately hidden — follow the method, you've earned it. 💪

Key takeaways

The three Sleuth Kit commands you'll reuse on every disk image:

  • mmls → partition layout and start offsets
  • fls -o OFFSET -r → every file, including deleted ones (marked *)
  • icat -o OFFSET IMAGE INODE → a file's content

Originally published on CTFdojo — join the CTFdojo Discord to discuss writeups and get notified about new ones.

Top comments (0)