fdisk -l disk.img
fdisk -l disk.img
fdisk -l disk.img
fdisk -l disk.img
$ fdisk -l disk.img
Disk disk.img: 100 MiB, 104857600 bytes, 204800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes Device Boot Start End Sectors Size Id Type
disk.img1 2048 43007 40960 20M 83 Linux
disk.img2 43008 122879 79872 39M 7 HPFS/NTFS/exFAT
disk.img3 124928 204799 79872 39M 8e Linux LVM
$ fdisk -l disk.img
Disk disk.img: 100 MiB, 104857600 bytes, 204800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes Device Boot Start End Sectors Size Id Type
disk.img1 2048 43007 40960 20M 83 Linux
disk.img2 43008 122879 79872 39M 7 HPFS/NTFS/exFAT
disk.img3 124928 204799 79872 39M 8e Linux LVM
$ fdisk -l disk.img
Disk disk.img: 100 MiB, 104857600 bytes, 204800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes Device Boot Start End Sectors Size Id Type
disk.img1 2048 43007 40960 20M 83 Linux
disk.img2 43008 122879 79872 39M 7 HPFS/NTFS/exFAT
disk.img3 124928 204799 79872 39M 8e Linux LVM
# Extract partition 2 — sector values from fdisk map directly to dd parameters
$ dd if=disk.img of=partition2.img bs=512 skip=43008 count=79872
# Extract partition 2 — sector values from fdisk map directly to dd parameters
$ dd if=disk.img of=partition2.img bs=512 skip=43008 count=79872
# Extract partition 2 — sector values from fdisk map directly to dd parameters
$ dd if=disk.img of=partition2.img bs=512 skip=43008 count=79872
$ file disk.img
disk.img: DOS/MBR boot record; partition 1 : ID=0x83, start-CHS (0x0,32,33),
end-CHS (0x14,223,19), startsector 2048, 40960 sectors; partition 2 : ID=0x07...
# Okay, partitions exist. Let me just mount it... $ sudo mount -o loop disk.img /mnt/disk
mount: /mnt/disk: wrong fs type, bad option, bad superblock on /dev/loop0
# Mounting the raw image without an offset doesn't work on partitioned images.
# I spent 15 minutes trying different mount flags here. $ strings disk.img | grep -i "flag\|ctf\|pico"
(no output)
# Flag was inside an unmounted filesystem, not raw ASCII in the image $ binwalk disk.img DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
0 0x0 DOS/MBR boot record
1048576 0x100000 Linux EXT2 filesystem data
# Saw the EXT2 hit and tried extracting it with dd — got a partial image that
# mounted but only contained the first partition's content. Missed partition 3. $ foremost -i disk.img -o output/
# 12 minutes later: recovered some JPEG files, none relevant
# foremost carved by signature without partition context — wrong tool here $ sudo autopsy &
# Waited 8 minutes for the browser GUI
# Autopsy found files in partition 1 and 2 — nothing in partition 3
# It had silently skipped partition 3 due to the unrecognized type ID (0x8e)
# I didn't know that's what happened until much later
$ file disk.img
disk.img: DOS/MBR boot record; partition 1 : ID=0x83, start-CHS (0x0,32,33),
end-CHS (0x14,223,19), startsector 2048, 40960 sectors; partition 2 : ID=0x07...
# Okay, partitions exist. Let me just mount it... $ sudo mount -o loop disk.img /mnt/disk
mount: /mnt/disk: wrong fs type, bad option, bad superblock on /dev/loop0
# Mounting the raw image without an offset doesn't work on partitioned images.
# I spent 15 minutes trying different mount flags here. $ strings disk.img | grep -i "flag\|ctf\|pico"
(no output)
# Flag was inside an unmounted filesystem, not raw ASCII in the image $ binwalk disk.img DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
0 0x0 DOS/MBR boot record
1048576 0x100000 Linux EXT2 filesystem data
# Saw the EXT2 hit and tried extracting it with dd — got a partial image that
# mounted but only contained the first partition's content. Missed partition 3. $ foremost -i disk.img -o output/
# 12 minutes later: recovered some JPEG files, none relevant
# foremost carved by signature without partition context — wrong tool here $ sudo autopsy &
# Waited 8 minutes for the browser GUI
# Autopsy found files in partition 1 and 2 — nothing in partition 3
# It had silently skipped partition 3 due to the unrecognized type ID (0x8e)
# I didn't know that's what happened until much later
$ file disk.img
disk.img: DOS/MBR boot record; partition 1 : ID=0x83, start-CHS (0x0,32,33),
end-CHS (0x14,223,19), startsector 2048, 40960 sectors; partition 2 : ID=0x07...
# Okay, partitions exist. Let me just mount it... $ sudo mount -o loop disk.img /mnt/disk
mount: /mnt/disk: wrong fs type, bad option, bad superblock on /dev/loop0
# Mounting the raw image without an offset doesn't work on partitioned images.
# I spent 15 minutes trying different mount flags here. $ strings disk.img | grep -i "flag\|ctf\|pico"
(no output)
# Flag was inside an unmounted filesystem, not raw ASCII in the image $ binwalk disk.img DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
0 0x0 DOS/MBR boot record
1048576 0x100000 Linux EXT2 filesystem data
# Saw the EXT2 hit and tried extracting it with dd — got a partial image that
# mounted but only contained the first partition's content. Missed partition 3. $ foremost -i disk.img -o output/
# 12 minutes later: recovered some JPEG files, none relevant
# foremost carved by signature without partition context — wrong tool here $ sudo autopsy &
# Waited 8 minutes for the browser GUI
# Autopsy found files in partition 1 and 2 — nothing in partition 3
# It had silently skipped partition 3 due to the unrecognized type ID (0x8e)
# I didn't know that's what happened until much later
/home/user/flag.txt
$ fdisk -l disk.img
...
Device Boot Start End Sectors Size Id Type
disk.img1 2048 43007 40960 20M 83 Linux
disk.img2 43008 204799 161792 79M 83 Linux # Extract partition 2: skip=Start, count=Sectors (not End)
$ dd if=disk.img of=part2.img bs=512 skip=43008 count=161792 $ file part2.img
part2.img: Linux rev 1.0 ext2 filesystem data $ mkdir /tmp/mnt && sudo mount part2.img /tmp/mnt
$ ls /tmp/mnt
flag.txt home/ lost+found/
$ fdisk -l disk.img
...
Device Boot Start End Sectors Size Id Type
disk.img1 2048 43007 40960 20M 83 Linux
disk.img2 43008 204799 161792 79M 83 Linux # Extract partition 2: skip=Start, count=Sectors (not End)
$ dd if=disk.img of=part2.img bs=512 skip=43008 count=161792 $ file part2.img
part2.img: Linux rev 1.0 ext2 filesystem data $ mkdir /tmp/mnt && sudo mount part2.img /tmp/mnt
$ ls /tmp/mnt
flag.txt home/ lost+found/
$ fdisk -l disk.img
...
Device Boot Start End Sectors Size Id Type
disk.img1 2048 43007 40960 20M 83 Linux
disk.img2 43008 204799 161792 79M 83 Linux # Extract partition 2: skip=Start, count=Sectors (not End)
$ dd if=disk.img of=part2.img bs=512 skip=43008 count=161792 $ file part2.img
part2.img: Linux rev 1.0 ext2 filesystem data $ mkdir /tmp/mnt && sudo mount part2.img /tmp/mnt
$ ls /tmp/mnt
flag.txt home/ lost+found/
$ fdisk -l tricky.img
...
Device Boot Start End Sectors Size Id Type
tricky.img1 2048 20479 18432 9M 83 Linux
tricky.img2 20480 40959 20480 10M 7f Unknown # Type 0x7f is unusual — extract and verify what's actually there
$ dd if=tricky.img of=hidden_part.img bs=512 skip=20480 count=20480 $ file hidden_part.img
hidden_part.img: Linux rev 1.0 ext2 filesystem data
# Despite the "Unknown" label — it's actually ext2 $ sudo mount hidden_part.img /tmp/hidden
$ find /tmp/hidden -name "flag*"
/tmp/hidden/secret/flag.txt
$ fdisk -l tricky.img
...
Device Boot Start End Sectors Size Id Type
tricky.img1 2048 20479 18432 9M 83 Linux
tricky.img2 20480 40959 20480 10M 7f Unknown # Type 0x7f is unusual — extract and verify what's actually there
$ dd if=tricky.img of=hidden_part.img bs=512 skip=20480 count=20480 $ file hidden_part.img
hidden_part.img: Linux rev 1.0 ext2 filesystem data
# Despite the "Unknown" label — it's actually ext2 $ sudo mount hidden_part.img /tmp/hidden
$ find /tmp/hidden -name "flag*"
/tmp/hidden/secret/flag.txt
$ fdisk -l tricky.img
...
Device Boot Start End Sectors Size Id Type
tricky.img1 2048 20479 18432 9M 83 Linux
tricky.img2 20480 40959 20480 10M 7f Unknown # Type 0x7f is unusual — extract and verify what's actually there
$ dd if=tricky.img of=hidden_part.img bs=512 skip=20480 count=20480 $ file hidden_part.img
hidden_part.img: Linux rev 1.0 ext2 filesystem data
# Despite the "Unknown" label — it's actually ext2 $ sudo mount hidden_part.img /tmp/hidden
$ find /tmp/hidden -name "flag*"
/tmp/hidden/secret/flag.txt
$ fdisk -l gappy.img
...
Device Boot Start End Sectors Size Id Type
gappy.img1 2048 20479 18432 9M 83 Linux
gappy.img2 24576 204799 180224 88M 83 Linux # Gap: sectors 20480 to 24575 = 4096 sectors = 2MB of unallocated space
# That's not alignment padding — 2MB is a deliberate gap in CTF context $ dd if=gappy.img of=gap.bin bs=512 skip=20480 count=4096 $ strings gap.bin | grep -i "flag\|ctf\|pico"
picoCTF{h1dd3n_1n_th3_g4p_a7b2c3}
$ fdisk -l gappy.img
...
Device Boot Start End Sectors Size Id Type
gappy.img1 2048 20479 18432 9M 83 Linux
gappy.img2 24576 204799 180224 88M 83 Linux # Gap: sectors 20480 to 24575 = 4096 sectors = 2MB of unallocated space
# That's not alignment padding — 2MB is a deliberate gap in CTF context $ dd if=gappy.img of=gap.bin bs=512 skip=20480 count=4096 $ strings gap.bin | grep -i "flag\|ctf\|pico"
picoCTF{h1dd3n_1n_th3_g4p_a7b2c3}
$ fdisk -l gappy.img
...
Device Boot Start End Sectors Size Id Type
gappy.img1 2048 20479 18432 9M 83 Linux
gappy.img2 24576 204799 180224 88M 83 Linux # Gap: sectors 20480 to 24575 = 4096 sectors = 2MB of unallocated space
# That's not alignment padding — 2MB is a deliberate gap in CTF context $ dd if=gappy.img of=gap.bin bs=512 skip=20480 count=4096 $ strings gap.bin | grep -i "flag\|ctf\|pico"
picoCTF{h1dd3n_1n_th3_g4p_a7b2c3}
.bash_history
$ fdisk -l multi.img
...
Device Boot Start End Sectors Size Id Type
multi.img1 2048 43007 40960 20M 83 Linux # ext2/3/4
multi.img2 43008 122879 79872 39M 7 NTFS # Windows filesystem
multi.img3 122880 143359 20480 10M 82 Linux swap # memory fragments # Swap partition: strings can find in-memory artifacts
$ dd if=multi.img of=swap.img bs=512 skip=122880 count=20480
$ strings swap.img | grep -i "password\|flag\|secret" | head -20
$ fdisk -l multi.img
...
Device Boot Start End Sectors Size Id Type
multi.img1 2048 43007 40960 20M 83 Linux # ext2/3/4
multi.img2 43008 122879 79872 39M 7 NTFS # Windows filesystem
multi.img3 122880 143359 20480 10M 82 Linux swap # memory fragments # Swap partition: strings can find in-memory artifacts
$ dd if=multi.img of=swap.img bs=512 skip=122880 count=20480
$ strings swap.img | grep -i "password\|flag\|secret" | head -20
$ fdisk -l multi.img
...
Device Boot Start End Sectors Size Id Type
multi.img1 2048 43007 40960 20M 83 Linux # ext2/3/4
multi.img2 43008 122879 79872 39M 7 NTFS # Windows filesystem
multi.img3 122880 143359 20480 10M 82 Linux swap # memory fragments # Swap partition: strings can find in-memory artifacts
$ dd if=multi.img of=swap.img bs=512 skip=122880 count=20480
$ strings swap.img | grep -i "password\|flag\|secret" | head -20
$ fdisk -l corrupted.img
GPT: not present
MBR: not present
# fdisk can't find a valid partition structure # mmls is more tolerant of malformed tables
$ mmls corrupted.img
DOS Partition Table
Offset Sector: 0
Units are in 512-byte sectors Slot Start End Length Description
000: Meta 0000000000 0000000000 0000000001 Primary Table (#0)
001: ------- 0000000000 0000002047 0000002048 Unallocated
002: 000:000 0000002048 0000043007 0000040960 Linux (0x83)
003: ------- 0000043008 0000045055 0000002048 Unallocated
004: 000:001 0000045056 0000204799 0000159744 Unknown Type (0xcc)
$ fdisk -l corrupted.img
GPT: not present
MBR: not present
# fdisk can't find a valid partition structure # mmls is more tolerant of malformed tables
$ mmls corrupted.img
DOS Partition Table
Offset Sector: 0
Units are in 512-byte sectors Slot Start End Length Description
000: Meta 0000000000 0000000000 0000000001 Primary Table (#0)
001: ------- 0000000000 0000002047 0000002048 Unallocated
002: 000:000 0000002048 0000043007 0000040960 Linux (0x83)
003: ------- 0000043008 0000045055 0000002048 Unallocated
004: 000:001 0000045056 0000204799 0000159744 Unknown Type (0xcc)
$ fdisk -l corrupted.img
GPT: not present
MBR: not present
# fdisk can't find a valid partition structure # mmls is more tolerant of malformed tables
$ mmls corrupted.img
DOS Partition Table
Offset Sector: 0
Units are in 512-byte sectors Slot Start End Length Description
000: Meta 0000000000 0000000000 0000000001 Primary Table (#0)
001: ------- 0000000000 0000002047 0000002048 Unallocated
002: 000:000 0000002048 0000043007 0000040960 Linux (0x83)
003: ------- 0000043008 0000045055 0000002048 Unallocated
004: 000:001 0000045056 0000204799 0000159744 Unknown Type (0xcc)
# Step 1: What kind of image is this?
file target.img # Step 2: What partitions exist, and are any suspicious?
fdisk -l target.img
# Look for: unusual type IDs, gaps between partitions, trailing unallocated space # Step 3: Note any gaps
# gap = next_Start - current_End - 1 (in sectors)
# If gap > 2048 sectors, extract it:
dd if=target.img of=gap.bin bs=512 skip=<end_of_prev_part+1> count=<gap_size>
strings gap.bin | grep -i "flag\|ctf" # Step 4: Extract each partition that looks interesting
dd if=target.img of=partN.img bs=512 skip=<Start> count=<Sectors> # Step 5: Verify what's actually in each extracted partition
file partN.img
# Don't trust the fdisk type label — verify with file every time # Step 6: Mount or analyze
sudo mount partN.img /tmp/mnt
ls -la /tmp/mnt
# Step 1: What kind of image is this?
file target.img # Step 2: What partitions exist, and are any suspicious?
fdisk -l target.img
# Look for: unusual type IDs, gaps between partitions, trailing unallocated space # Step 3: Note any gaps
# gap = next_Start - current_End - 1 (in sectors)
# If gap > 2048 sectors, extract it:
dd if=target.img of=gap.bin bs=512 skip=<end_of_prev_part+1> count=<gap_size>
strings gap.bin | grep -i "flag\|ctf" # Step 4: Extract each partition that looks interesting
dd if=target.img of=partN.img bs=512 skip=<Start> count=<Sectors> # Step 5: Verify what's actually in each extracted partition
file partN.img
# Don't trust the fdisk type label — verify with file every time # Step 6: Mount or analyze
sudo mount partN.img /tmp/mnt
ls -la /tmp/mnt
# Step 1: What kind of image is this?
file target.img # Step 2: What partitions exist, and are any suspicious?
fdisk -l target.img
# Look for: unusual type IDs, gaps between partitions, trailing unallocated space # Step 3: Note any gaps
# gap = next_Start - current_End - 1 (in sectors)
# If gap > 2048 sectors, extract it:
dd if=target.img of=gap.bin bs=512 skip=<end_of_prev_part+1> count=<gap_size>
strings gap.bin | grep -i "flag\|ctf" # Step 4: Extract each partition that looks interesting
dd if=target.img of=partN.img bs=512 skip=<Start> count=<Sectors> # Step 5: Verify what's actually in each extracted partition
file partN.img
# Don't trust the fdisk type label — verify with file every time # Step 6: Mount or analyze
sudo mount partN.img /tmp/mnt
ls -la /tmp/mnt
conv=notrunc