InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/

Follow publication

picoCTF 2024 — Write-up — Forensics

Abdul Issa
InfoSec Write-ups
Published in
21 min readApr 2, 2024

picoCTF 2024 Forensics Challenges
picoCTF 2024 Forensics Challenges (Source: picoCTF.org)

Challenges

· Scan Surprise
· Verify
· CanYouSee
· Secret of the Polyglot
· Mob Psycho
· Blast from the past
· Dear Diary
· Conclusion

Scan Surprise

Challenge QR Code
Challenge QR Code

Stay safe! Never scan QR codes from unfamiliar or public sources to avoid potential malware or security risks.

QR code led us to the flag
QR code led us to the flag

Verify

Verify challenge
Verify challenge. (Source: picoCTF.org)
$ cd home/ctf-player/drop-in

$
ls -la

total 28
drwxr-xr-x 3 cybersecmav cybersecmav 4096 Mar 9 17:05 .
drwxr-xr-x 3 cybersecmav cybersecmav 4096 Mar 24 16:54 ..
-rw-r--r-- 1 cybersecmav cybersecmav 65 Mar 9 17:05 checksum.txt
-rwxr-xr-x 1 cybersecmav cybersecmav 856 Mar 9 17:05 decrypt.sh
drwxr-xr-x 2 cybersecmav cybersecmav 12288 Mar 9 17:05 files
$ ls -la files/*

total 1220
drwxr-xr-x 2 cybersecmav cybersecmav 12288 Mar 9 17:05 .
drwxr-xr-x 3 cybersecmav cybersecmav 4096 Mar 9 17:05 ..
-rw-r--r-- 1 cybersecmav cybersecmav 64 Mar 9 17:05 047MJYW7
-rw-r--r-- 1 cybersecmav cybersecmav 64 Mar 9 17:05 0CbGv6a3
-rw-r--r-- 1 cybersecmav cybersecmav 64 Mar 9 17:05 0E56AVSC
-rw-r--r-- 1 cybersecmav cybersecmav 64 Mar 9 17:05 0QUxtltc
-rw-r--r-- 1 cybersecmav cybersecmav 64 Mar 9 17:05 0XKkalUj
-rw-r--r-- 1 cybersecmav cybersecmav 64 Mar 9 17:05 0hBYiFqV
-rw-r--r-- 1 cybersecmav cybersecmav 64 Mar 9 17:05 0xx1tyUI
-rw-r--r-- 1 cybersecmav cybersecmav 64 Mar 9 17:05 1VpyYwwh

--SNIP--
$ cat checksum.txt

467a10447deb3d4e17634cacc2a68ba6c2bb62a6637dad9145ea673bf0be5e02
$ sha256sum * | grep "7dad9145ea673bf0be5e02"

467a10447deb3d4e17634cacc2a68ba6c2bb62a6637dad9145ea673bf0be5e02 c6c8b911
$ cat c6c8b911

Salted__���05�.Q�+�P��&pE�?B�{M:��e�Wm�a4Wua��l�5�yU!����NA�
$ ./decrypt.sh files/c6c8b911 

Error: 'files/c6c8b911' is not a valid file. Look inside the 'files' folder with 'ls -R'!
#!/bin/bash

# Check if the user provided a file name as an argument
if [ $# -eq 0 ]; then
echo "Expected usage: decrypt.sh <filename>"
exit 1
fi

# Store the provided filename in a variable
file_name="$1"

# Check if the provided argument is a file and not a folder
if [ ! -f "/home/ctf-player/drop-in/$file_name" ]; then
echo "Error: '$file_name' is not a valid file. Look inside the 'files' folder with 'ls -R'!"
exit 1
fi

# If there's an error reading the file, print an error message
if ! openssl enc -d -aes-256-cbc -pbkdf2 -iter 100000 -salt -in "/home/ctf-player/drop-in/$file_name" -k picoCTF; then
echo "Error: Failed to decrypt '$file_name'. This flag is fake! Keep looking!"
openssl enc -d -aes-256-cbc -pbkdf2 -iter 100000 -salt -in  files/c6c8b911 -k picoCTF

picoCTF{trust_but_verify_c6c8b911}

CanYouSee

CanYouSee
CanYouSee challenge. (Source: picoCTF.org)
Challenge image ukn_reality.jpg
Challenge image ukn_reality.jpg. Source: picoCTF 2024
$ exiftool ukn_reality.jpg 

ExifTool Version Number : 12.76
File Name : ukn_reality.jpg
Directory : .
File Size : 2.3 MB
File Modification Date/Time : 2024:02:15 22:40:14+00:00
File Access Date/Time : 2024:02:15 22:40:14+00:00
File Inode Change Date/Time : 2024:03:24 17:20:43+00:00
File Permissions : -rw-r--r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
JFIF Version : 1.01
Resolution Unit : inches
X Resolution : 72
Y Resolution : 72
XMP Toolkit : Image::ExifTool 11.88
Attribution URL : $ echo "cGljb0NURntNRTc0RDQ3QV9ISUREM05fZGVjYTA2ZmJ9Cg==" | base64 -d
picoCTF{ME74D47A_HIDD3N_deca06fb}==
Image Width : 4308
Image Height : 2875
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Image Size : 4308x2875
Megapixels : 12.4
$ echo "cGljb0NURntNRTc0RDQ3QV9ISUREM05fZGVjYTA2ZmJ9Cg==" | base64 -d
picoCTF{ME74D47A_HIDD3N_deca06fb}

Secret of the Polyglot

Secret of the Polyglot challenge
Secret of the Polyglot challenge (Source: picoCTF.org)
PDF contained Part 2 of the flag
PDF contained Part 2 of the flag
$ pdfinfo flag2of2-final.pdf

Producer: GPL Ghostscript 10.01.2
CreationDate: Wed Feb 7 17:50:31 2024 GMT
ModDate: Wed Feb 7 17:50:31 2024 GMT
Custom Metadata: no
Metadata Stream: yes
Tagged: no
UserProperties: no
Suspects: no
Form: none
JavaScript: no
Pages: 1
Encrypted: no
Page size: 595 x 842 pts (A4)
Page rot: 0
File size: 3362 bytes
Optimized: no
PDF version: 1.4
$ file flag2of2-final.pdf  
flag2of2-final.pdf: PNG image data, 50 x 50, 8-bit/color RGBA, non-interlaced
flag2of2.png has part 1 of the flag
flag2of2.png has part 1 of the flag
$ strings flag2of2-final.png
Strings search result
Strings search result
$ gs -dSAFER -dBATCH flag2of2-final.png
Ghostscript file format also reveals part 2 of the flag
Ghostscript file format also reveals part 2 of the flag

Mob Psycho

Mob Psycho challenge
Mob Psycho challenge (Source: picoCTF.org)
$ unzip mobpsycho.apk
$ tree

├── AndroidManifest.xml
├── META-INF
│ ├── androidx.activity_activity.version
│ ├── androidx.annotation_annotation-experimental.version
│ ├── androidx.coordinatorlayout_coordinatorlayout.version
│ ├── androidx.fragment_fragment.version
│ ├── androidx.interpolator_interpolator.version
│ ├── androidx.versionedparcelable_versionedparcelable.version
│ ├── com
│ │ └── android
│ │ └── build
│ │ └── gradle
│ │ └── app-metadata.properties
│ ├── com.google.android.material_material.version
│ ├── kotlinx_coroutines_android.version
│ ├── kotlinx_coroutines_core.version
│ └── services
│ ├── kotlinx.coroutines.CoroutineExceptionHandler
│ └── kotlinx.coroutines.internal.MainDispatcherFactory
├── classes.dex
├── classes2.dex
├── classes3.dex
├── mobpsycho.apk
├── res
│ ├── anim
│ │ ├── abc_fade_in.xml
│ │ ├── abc_fade_out.xml
│ │ ├── abc_grow_fade_in_from_bottom.xml
│ │ ├── design_snackbar_out.xml
│ │ └── mtrl_card_lowers_interpolator.xml
│ ├── anim-v21
│ │ ├── design_bottom_sheet_slide_in.xml
│ │ ├── design_bottom_sheet_slide_out.xml
│ │ ├── fragment_fast_out_extra_slow_in.xml
│ ├── animator
│ │ ├── design_fab_hide_motion_spec.xml
│ │ ├── design_fab_show_motion_spec.xml


--SNIP--
$ find -name *flag* 
./res/color/flag.txt
cat ./res/color/flag.txt
7069636f4354467b6178386d433052553676655f4e5838356c346178386d436c5f35326135653264657d
$ cat ./res/color/flag.txt | xxd -p -r                                        
picoCTF{ax8mC0RU6ve_NX85l4ax8mCl_52a5e2de}

Blast from the past

Blast from the past challenge (Source: picoCTF.org)
$ exiftool original.jpg 

File Name : original.jpg
File Modification Date/Time : 2024:03:13 17:44:22+00:00
File Access Date/Time : 2024:03:24 20:59:55+00:00
File Inode Change Date/Time : 2024:03:24 20:59:44+00:00
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
Make : samsung
Camera Model Name : SM-A326U
Software : MediaTek Camera Application
Modify Date : 2023:11:20 15:46:23
Date/Time Original : 2023:11:20 15:46:23
Create Date : 2023:11:20 15:46:23
Time Stamp : 2023:11:20 20:46:21.420+00:00
Create Date : 2023:11:20 15:46:23.703
Date/Time Original : 2023:11:20 15:46:23.703
Modify Date : 2023:11:20 15:46:23.703
$ exiftool original.jpg | grep -E 'Time|Date'                                                                                                                                                      
File Modification Date/Time : 2024:03:13 17:44:22+00:00
File Access Date/Time : 2024:03:24 19:09:04+00:00
File Inode Change Date/Time : 2024:03:24 19:08:48+00:00
Modify Date : 2023:11:20 15:46:23
Exposure Time : 1/24
Date/Time Original : 2023:11:20 15:46:23
Create Date : 2023:11:20 15:46:23
Sub Sec Time : 703
Sub Sec Time Original : 703
Sub Sec Time Digitized : 703
Time Stamp : 2023:11:20 20:46:21.420+00:00
Create Date : 2023:11:20 15:46:23.703
Date/Time Original : 2023:11:20 15:46:23.703
Modify Date : 2023:11:20 15:46:23.703
$ cp original.jpg copy.jpg
$ exiftool -DateTimeOriginal='1970:01:01 00:00:00.001' \
-ModifyDate='1970:01:01 00:00:00.001' \
-CreateDate='1970:01:01 00:00:00.001' \
-DateTime='1970:01:01 00:00:00.001' \
-SubSecTimeOriginal='001' \
-SubSecTime='001' \
-SubSecTimeDigitized='001' \
-SubSecCreateDate='001' \
-SubSecDateTimeOriginal='001' \
-SubSecModifyDate='001' \
-SubSecDateTime='001' \
-ImageTimeStamp='1970:01:01 00:00:00.001' copy.jpg

Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in Composite:SubSecCreateDate (PrintConvInv)
Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in Composite:SubSecDateTimeOriginal (PrintConvInv)
Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in Composite:SubSecModifyDate (PrintConvInv)
Warning: Tag 'SubSecDateTime' is not defined
Warning: Tag 'ImageTimeStamp' is not defined
1 image files updated
$ exiftool copy.jpg | grep -E ('Time'|'Date') 

--SNIP--
Modify Date : 1970:01:01 00:00:00
Date/Time Original : 1970:01:01 00:00:00
Create Date : 1970:01:01 00:00:00
Sub Sec Time : 001
Sub Sec Time Original : 001
Sub Sec Time Digitized : 001
Date/Time Modified : 1970:01:01 00:00:00.001
Time Stamp : 2023:11:20 20:46:21.420+00:00
Create Date : 1970:01:01 00:00:00.001
Date/Time Original : 1970:01:01 00:00:00.001
Modify Date : 1970:01:01 00:00:00.001
nc -w 2 mimas.picoctf.net 63462 < copy.jpg
$ nc mimas.picoctf.net 52225                 
MD5 of your picture:
b62538a2cfb92ad958408424fff76252 test.out

Checking tag 1/7
Looking at IFD0: ModifyDate
Looking for '1970:01:01 00:00:00'
Found: 1970:01:01 00:00:00
Great job, you got that one!

Checking tag 2/7
Looking at ExifIFD: DateTimeOriginal
Looking for '1970:01:01 00:00:00'
Found: 1970:01:01 00:00:00
Great job, you got that one!

Checking tag 3/7
Looking at ExifIFD: CreateDate
Looking for '1970:01:01 00:00:00'
Found: 1970:01:01 00:00:00
Great job, you got that one!

Checking tag 4/7
Looking at Composite: SubSecCreateDate
Looking for '1970:01:01 00:00:00.001'
Found: 1970:01:01 00:00:00.001
Great job, you got that one!

Checking tag 5/7
Looking at Composite: SubSecDateTimeOriginal
Looking for '1970:01:01 00:00:00.001'
Found: 1970:01:01 00:00:00.001
Great job, you got that one!

Checking tag 6/7
Looking at Composite: SubSecModifyDate
Looking for '1970:01:01 00:00:00.001'
Found: 1970:01:01 00:00:00.001
Great job, you got that one!

Checking tag 7/7
Timezones do not have to match, as long as it's the equivalent time.
Looking at Samsung: TimeStamp
Looking for '1970:01:01 00:00:00.001+00:00'
Found: 2023:11:20 20:46:21.420+00:00
Oops! That tag isn't right. Please try again.
$ $strings original.jpg
8 /lR
yGFE`
(x94
*b*I*:
+!r }
@=9_^
Mn`
l
Image_UTC_Data1700513181420
MCC_Data310
Camera_Capture_Mode_Info1SEFHk
SEFT
Epoch Unix Timestamp
Epoch Unix Timestamp. Source: www.unixtimestamp.com
Date converted to Epoch Unix Timestamp
Our date converted to Epoch Unix Timestamp. Source: www.unixtimestamp.com
Hex view of the “Time Stamp” field before the change
Hex view of the “Time Stamp” field before the change
$ nc mimas.picoctf.net 59195
MD5 of your picture:
ea6909b837942ec23429708b4e2bdd07 test.out

Checking tag 1/7
Looking at IFD0: ModifyDate
Looking for '1970:01:01 00:00:00'
Found: 1970:01:01 00:00:00
Great job, you got that one!

Checking tag 2/7
Looking at ExifIFD: DateTimeOriginal
Looking for '1970:01:01 00:00:00'
Found: 1970:01:01 00:00:00
Great job, you got that one!

Checking tag 3/7
Looking at ExifIFD: CreateDate
Looking for '1970:01:01 00:00:00'
Found: 1970:01:01 00:00:00
Great job, you got that one!

Checking tag 4/7
Looking at Composite: SubSecCreateDate
Looking for '1970:01:01 00:00:00.001'
Found: 1970:01:01 00:00:00.001
Great job, you got that one!

Checking tag 5/7
Looking at Composite: SubSecDateTimeOriginal
Looking for '1970:01:01 00:00:00.001'
Found: 1970:01:01 00:00:00.001
Great job, you got that one!

Checking tag 6/7
Looking at Composite: SubSecModifyDate
Looking for '1970:01:01 00:00:00.001'
Found: 1970:01:01 00:00:00.001
Great job, you got that one!

Checking tag 7/7
Your picture doesn't have the Samsung: TimeStamp tag. Are you using the given picture in the problem description?

Hex edit the image to reflect a time of 00:00:00.001
Hex edit the image to reflect a time of 00:00:00.001
$ exiftool copy.jpg | grep -E ('Time'|'Date')
--SNIP--
Time Stamp : 1970:01:01 01:00:00.001+01:00
All checks were successful. The flag has been received
All checks were successful. The flag has been received

Dear Diary

Dear Diary challenge
Dear Diary challenge (Source: picoCTF.org)
Autopsy on Linux
Autopsy on Linux

However, we don’t want our final challenge to be that easy, do we? We won’t learn new and exciting things if we choose the quickest and easiest path always!

gunzip disk.flag.img.gz
$ file disk.flag.img 

disk.flag.img: DOS/MBR boot sector; partition 1 : ID=0x83, active, start-CHS (0x0,32,33), end-CHS (0x26,94,56), startsector 2048, 614400 sectors; partition 2 : ID=0x82, start-CHS (0x26,94,57), end-CHS (0x47,1,58), startsector 616448, 524288 sectors; partition 3 : ID=0x83, start-CHS (0x47,1,59), end-CHS (0x82,138,8), startsector 1140736, 956416 sectors
mmls disk.flag.img
The mmls command displays the layout of partitions within the disk image
The mmls command displays the layout of partitions within the disk image
$ fls -o 2048  disk.flag.img 

d/d 11: lost+found
r/r 13: ldlinux.sys
r/r 14: ldlinux.c32
r/r 16: config-virt
r/r 17: vmlinuz-virt
r/r 18: initramfs-virt
l/l 19: boot
r/r 21: libutil.c32
r/r 20: extlinux.conf
r/r 22: libcom32.c32
r/r 23: mboot.c32
r/r 24: menu.c32
r/r 15: System.map-virt
r/r 25: vesamenu.c32
V/V 76913: $OrphanFiles
$ fls -o 0001140736  disk.flag.img
d/d 32513: home
d/d 11: lost+found
d/d 32385: boot
d/d 64769: etc
d/d 32386: proc
d/d 13: dev
d/d 32387: tmp
d/d 14: lib
d/d 32388: var
d/d 21: usr
d/d 32393: bin
d/d 32395: sbin
d/d 32539: media
d/d 203: mnt
d/d 32543: opt
d/d 204: root
d/d 32544: run
d/d 205: srv
d/d 32545: sys
d/d 32530: swap
V/V 119417: $OrphanFiles
$ fls -o 0001140736 disk.flag.img 204
r/r 1837: .ash_history
d/d 1842: secret-secrets
$ fls -o 0001140736 disk.flag.img 1842
r/r 1843: force-wait.sh
r/r 1844: innocuous-file.txt
r/r 1845: its-all-in-the-name
icat -o 0001140736  disk.flag.img 8 | strings 
$ icat -o 0001140736  disk.flag.img 8 | strings | sort | uniq | grep "file"

base.files
bootchart.files
btrfs.files
cachefiles
cachefiles.ko.gz
cryptkey.files
cryptsetup.files
dhcp.files
ewaitfile
filelayout
flexfilelayout
https.files
innocuous-file.txt
keymap.files
lvm.files
nbd.files
network.files
nfs_layout_flexfiles.ko.gz
nfs_layout_nfsv41_files.ko.gz
original-filename
profile
profile.d
raid.files
wireguard.files
xfs.files
zfs.files
icat -o 0001140736  disk.flag.img 8 |xxd | grep ".txt"
Hex view of Partition 3’s contents
Hex view of Partition 3’s contents
icat -o 0001140736  disk.flag.img 8 |xxd |grep ".txt" -A3
The fragmented flag is now visible to us
The fragmented flag is now visible to us

Conclusion

This highlights the importance of exploring various tools and techniques, not solely relying on GUI applications for investigative forensics work or incident handling & response. Proficiency in command-line-based Linux tools is essential, especially in scenarios where access to a remote headless server with no Desktop environment is required. Being prepared for such situations is crucial.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Published in InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/

Written by Abdul Issa

Penetration Tester, Linux Evangelist, Security Geek, Blogs about Ethical Hacking, CTF, Cybersecurity Career & Certifications. www.linkedin.com/in/abdul-issa

Responses (2)

Write a response

These were very nice write ups and I used them to bounce off of some of my notes. (I'm not very good and still learning. lol.) I even revised some of my notes with yours!
I wanted to mention that you noted at the end how it is good to use the command…

50