← Back to Tomes

[WRITE UP] SEC PLAYGROUND Half Year CTF 2024: Forensic File HuntSecplayground Half Year CTF Event 2024 — Forensic File Hunt (Medium)

Hi everyone who might be reading this — it's my very first write-up, so apologies in advance if anything is unclear!

On July 26, 2024, I took part in the SEC PLAYGROUND Half Year CTF Event 2024.

It's a CTF competition on the Secplayground platform, open to anyone interested in Cyber Security — teams of up to 4.

This year's challenges covered both Offensive and Defensive categories including Web Application, Digital Forensics, Reverse Engineering, Cryptography, Network Analysis, Incident, and Hor D'oeuvres (appetiser-type challenges).

In this write-up I'm covering: Digital Forensics: Forensic File Hunt (Medium)

The challenge description hinted that we need to find an Excel file containing the flag — vibes from Ready Player One (https://www.imdb.com/title/tt1677720/): "Find the key, find the egg" — except here it's "Find the Excel, find the Flag."

Downloading the provided file — a massive 7.0 GB file.

The file is named SPGCTF.E01. Researching the E01 format reveals it's a forensic disk image used in digital forensics and cybersecurity — suitable for evidence preservation in court cases. Reference: https://files101.com/extension/e01

Knowing it's a disk image, we need a tool to open it. Research points to Autopsy (https://www.autopsy.com/) — a digital forensics platform. Import the file into Autopsy and off we go.

Inside Autopsy, there are many menu options — but since we're looking for an Excel file, we jump straight to the Documents section.

There it is — flag.xlsx. But if it were this easy it wouldn't be Medium difficulty. Export the file and open it…

The "flag" is literally flag imagery (the Excel is full of actual flag pictures). Time to use a hint. Hints cost: Easy = -1pt, Medium = -2pt, Hard = -3pt.

Password is in John — John probably means John The Ripper.

So we need to find an encrypted file in Autopsy. The Encryption Detected menu is perfect for this — and we find:

speedbird.zip and catdata.zip

Export them and crack the password using John The Ripper.

Method: use zip2john to extract the hash, then crack it. Reference: https://medium.com/@ujjawal.soni2002/...

zip2john speedbird.zip >> hashspeed

Then crack with rockyou.txt:

john hashspeed --wordlist=rockyou.txt

Password obtained: firebird

Inside the zip — nothing but cat pictures. Many, many cats.

Check all images for hidden data using binwalk (https://www.kali.org/tools/binwalk/):

binwalk *

Using * to scan everything at once.

Scanning through the results…

cat8.png has something hidden inside — a zip file. Extract it:

binwalk -e -c cat8.png

Output: a file named 1B103.zip. Checking its type:

file 1B103.zip

It's a Microsoft Excel 2007+ file. Rename to .xls and open it. There's a suspiciously unusual string — looks like Hex. Throw it into CyberChef:

CyberChef (https://cyberchef.org/) shows it's Hex with a Base64 layer inside.

Find the Excel, find the Flag: forensic{Kuch1ng}

Thank you SECPLAYGROUND for a great event :)

สวัสดีทุกคนที่อาจจะเข้ามาอ่าน นี่เป็นการเขียนครั้งแรกของผม หากผิดพลาดประการใดก็ขออภัยล่วงหน้าเลยนะครับ

เข้าเรื่องกันครับ สวัสดีครับเมื่อวันที่ 26 กรกฎาคม 2567 ผมได้เข้าร่วมแข่งขัน CTF รายการหนึ่งชื่อว่า SEC PLAYGROUND Haft Year CTF Event 2024

ซึ่งเป็นรายการแข่งขัน CTF บน platform Secplayground ซึ่งเปิดให้ผู้ที่สนใจในด้าน Cyber Security สามารถลงแข่งขันได้ ทีมละ 4 คน

โจทย์สำหรับการแข่งขันปีนี้จะมีทั้งฝั่งของ Offensive และ Defensive ในหมวดหมู่ต่างๆ อาทิเช่น Web Application, Digital Forensic, Reverse Engineering, Cryptography, Network Analysis, Incident และสุดท้าย Hor D’oeuvres (อาหารเรียกน้ำย่อย) ตามซ้ายมือของรูปเลย

ใน Write Up นี้ผมจะมาในหัวข้อของ Digital Forensic: Forensic File Hunt (Medium)

เริ่มแรกโจทย์จะมีการอธิบายถึงช่องทางของการที่เราจะหา Flag ได้ โดยสรุปง่ายคือให้เราหาไฟล์ excel แล้วในนั้นจะมี Flag อารมณ์เหมือนหนังเรื่อง Ready Player One (https://www.imdb.com/title/tt1677720/)วลีเด็ดตอนแข่งรถ “ใครเจอกุญแจคนนั้นเจอไข่” ส่วนของข้อนี้ “ใครเจอ Excel คนนั้นเจอ Flag

ว่าแล้วก็ทำการ Download ไฟล์มาดูว่าเป็นไฟล์เกี่ยวกับอะไรซึ่งบอกเลยว่าไฟล์ใหญ่มากประมาณ 7.0 GB ตามภาพเลย

เมื่อเรา Download ไฟล์มาแล้วก็พบกับไฟล์ที่ชื่อว่า SPGCTF.E01 ไฟล์ Type เป็น E01 เราก็ทำการหาดูว่า E01 คืออะไรก็พบว่า มันคือ (ไฟล์สำหรับจัดเก็บข้อมูลที่สำคัญสำหรับนิติวิทยาศาสตร์ดิจิทัลความปลอดภัยในโลกไซเบอร์ สามารถใช้ในการพิจารณาคดีเพื่อรักษาและนำเสนอหลักฐานดิจิทัล) อ้างอิง:https://files101.com/extension/e01

เรารู้แล้วว่ามันคือไฟล์ Image แต่เราจะใช้อะไรสำหรับการเปิดมันกันละก็ Research ต่อพบกับว่าเราสามารถใช้ Tools ที่มีชื่อว่า AutoSpy https://www.autopsy.com/
ซึ่งเอาไว้ทำการ Investigate ไฟล์ต่างได้ๆ ว่าแล้วก็ไปกันเลย 
เมื่อเราได้ไฟล์สำหรับการ Investigate ได้เครื่องมือพร้อมก็ทำการนำไฟล์ Import เข้า AutoPsy ได้เลย

เมื่อเข้ามาแล้วก็จะเจอกับหน้าตาของ AutoPsy จะสังเกตว่ามีเมนูให้เราทำการใช้งานได้มากมาย แต่เนื่องจากเราไม่มีเวลามากจึงทำการกลับไที่โจทย์เพื่อดูว่าโจทย์ต้องการอะไร โจทย์คือให้เราหาไฟล์ excel แล้วในนั้นจะมี Flag โอเคเราก็เลือกเมนูที่เป็น Document เลยไปแบบไวๆ

นั่นไงเราเจอไฟล์ flag.xlsx แล้วแต่เดี๋ยวก่อนถ้าหาเจอง่ายขนาดนี้จะเป็นข้อ Medium ได้ไง ลอง Export ไฟล์ออกมา

Flag จริงๆ มาเป็นธงชาติเลยก็จรองของเขานะ Flag แปลว่า ธง เอาละเมื่อเป็นแบบนี้ก็ต้องใช้ตัวช่วยละกด “Hint” ละกัน เงื่อนไขการกด Hint หาเป็นแบบง่ายจะถูกตัด 1 คะแนน Medium 2 คะแนน และ Hard น่าจะ 3 คะแนน

Password is in John เอิ่ม!!! พูดถึง John ก็น่าจะหมายถึง John Ripper หรือป่าวน้า

เบาะแสก็คือหาไฟล์ที่ทำการเข้ารหัสไว้ใน AutoPsy จะมีเมนูนึงที่เป็นเกี่ยวกับตรวจสอบไฟล์ที่เข้ารหัสไว้นั่นคือ “Encryption Detected” และเราก็พบไฟล์เหล่านั้น

นั่นคือไฟล์ที่ชื่อ speedbird.zip กับ catdata.zip

เมื่อเราเจอไฟล์เหล่านี้ก็ทำการ Export ออกมาเพื่อทำการ Crack Password โดยใช้ John The Ripper

วิธีการคือในการที่จะ crack password วิธีที่ใช้คือ “zip2john” อ้างอิงจาก https://medium.com/@ujjawal.soni2002/cracking-a-password-protected-zip-file-using-john-the-ripper-f39e657cbfa8

zip2john "ตามด้วยชื่อไฟล์ที่ต้องการ crack password" >> hashfile
zip2john speedbird.zip >> hashspeed

เมื่อทำการ zip2john เราจะได้ค่า hash มาซึ่งเราจะนำค่า Hash นี้ไปทำการ Crack Password โดยใช้ command ตามนี้ได้เลย

wordlist ที่ใช้จะใช้ rockyou.txt ซึ่งเป็น wordlist ยอดนิยม

john ไฟล์ hash ที่ได้จาก command ด้านบน --wordlist=rockyou.txt
john hashspeed --wordlist=rockyou.txt 

เมื่อเสร็จแล้วจะได้ค่า Password ของไฟล์ zip ออกมา (firebird)

ได้ Password แล้วก็จัดการตรวจสอบไฟล์ด้านในต่อได้เลย

เปิดมาต้องตกใจไปอีกเนื่องจากมีไฟล์รูปมากมายเต็มไปหมดมีแต่รูปแมวเต็มไปหมดเลยย

เมื่อเจอรูปภาพแบบนี้สิ่งที่ทำไดคือตรวจสอบไฟล์ว่ามีการซ่อนอะไรไว้ในไฟล์ไหมด้วยการใช้ Tools ที่ชื่อ binwalk https://www.kali.org/tools/binwalk/

binwalk * 

ที่ใช้ “*” เนื่องจากขี้เกียจหาทีละไฟล์ก็หามันทีเดียวไปเลยย

เนื่องจากไฟล์ค่อนข้างเยอะก็จะไล่แบบไวๆ ไปเจอกับบางอย่างเข้า

และแล้วก็เจอสิ่งไม่คาดฝันนั้นคือไฟล์ที่มีชื่อว่า “cat8.png” มีการซ่อนไฟล์ zip บางอย่างไว้ในนั้น

binwalk -e -c cat8.png

เมื่อทำการ binwalk ออกมาจะพบกับไฟล์ที่น่าสง 1 ไฟล์นั่นคือ “1B103.zip”

และทำการเช็คไฟล์โยใช้ค่ำสั่ง

file ตามด้วยชื่อไฟล์

เมื่อตรวจสอบพบว่าไฟล์เป็น Microsoft Excel 2007+ อ้าวแบบนี้ก็เท่ากับ “เจอ excel เท่ากับเจอ Flag” ทำการเปลี่ยนนามสกุลไฟล์ให้เป็น .xls

เปลี่ยนไฟล์เสร็จเรียบร้อยก็ทำการเปิดไฟล์ดูผ่านไม่น่าจะมีอะไรสำคัญแต่เอะใจเจอข้อความแปลกนี่มันค่า Hex นิจัดการเอาเข้า cyberchef

นำค่า Hex ไปเข้า Cyberchef (https://cyberchef.org/) อ่าวยังมีซ้อนด้วย base64 อีก

ใครเจอ Excel คนนั้นเจอ Flag “forensic{Kuch1ng}”

สุดท้ายนี้ขอบคุณกิจกรรมดีจากทาง SECPLAYGROUND :)