Showing posts with label File Signature. Show all posts
Showing posts with label File Signature. Show all posts

Saturday, January 17, 2026

DIGITAL FORENSICS:PicoCTF Writeups: extensions

PicoCTF Writeups: extensions

Challenge Overview

  • Event: PicoCTF 2019
  • Challenge Name: Extensions
  • Category: Forensics

DIGITAL FORENSICS:ePicoCTF Writeups: extensions

This is a really weird text file. Can you find the flag?

Get the flag from TXT.

DIGITAL FORENSICS:ePicoCTF Writeups: extensions

Step 1: Understanding File Extensions and Magic Numbers

Operating systems don’t rely only on a file’s extension (like .txt or .png) to identify its type. Instead, they check the:


1.What is a Magic Number?

A Magic Number (or File Signature) is a specific set of bytes at the very beginning of a file that identifies its actual format. Unlike file extensions (like .txt or .jpg), which are easily changed by a user, Magic Numbers are required by software to correctly interpret and render the file data.

 

Solution

 


I started by downloading the provided file, flag.txt, onto my Windows  virtual machine. Opening it in Notepad revealed this:

Inspecting the Internal Structure

When opening flag.txt with Notepad, the data appears unreadable, but the first few characters are key:

  • Appears as‰PNG

DIGITAL FORENSICS:ePicoCTF Writeups: extensions

2. Evidence of File Obfuscation

In your provided images, there is a clear mismatch between the file's name and its internal structure:

  • Deceptive Name: The file is named flag.txt, making it look like a simple text document.

  • Header Signature (ASCII): When opened in Notepad, the first few characters are ‰PNG  . This is the standard header for a PNG image.

  • Hexadecimal Signature: In the hex view (likely from FTK Imager), the first four bytes are 89 50 4E 47. This is the unique hexadecimal signature that every PNG file must start with.


Verification and Tools

  • Linux file Command: When run against this file, the command returns PNG image data. This tool works by reading the Magic Number rather than trusting the .txt extension.

Checking the file with file.

It's a PNG picture file, not a text file.

When checking this file in a Linux system (such as Kali) using the file command, the result

DIGITAL FORENSICS:ePicoCTF Writeups: extensions

It's a PNG picture file, not a text file.


4. Conclusion

The file flag.txt is not a text file; it is a PNG image. To view the content correctly as an image, you can simply rename the file back to flag.png. Changing a file’s extension doesn’t modify its content—it just helps the operating system interpret the file correctly.

DIGITAL FORENSICS:ePicoCTF Writeups: extensions

 Opening the file

After renaming the file, I opened it as a PNG image:

DIGITAL FORENSICS:ePicoCTF Writeups: extensions

File Magic Numbers 

Magic numbers are the first bits of a file which uniquely identify the type of file.

DIGITAL FORENSICS:PicoCTF Writeups: extensions
photo credit:  gist.github.com

Why is the Magic Number Important in Forensics?

During an investigation, suspects often change file extensions to hide evidence (e.g., renaming an incriminating image from .jpg to .dll or .txt).

  • Antivirus/Forensic Tools: These tools perform a "Signature Mismatch" analysis to detect files that are attempting to hide their true identity.

  • Data Recovery: If the file system structure is damaged and the extensions are lost, recovery software uses these Magic Numbers to identify and reconstruct the original file types.

Summary from the example: Your file is a PNG image that has been renamed with a .txt extension. If you change the extension back to .png, you will be able to view the image normally.

Ref:PocoCTF

อ่านเพิ่มเติม:



หมายเหตุ:เนื้อหาในเว็บไซต์นี้มีขึ้นเพื่อวัตถุประสงค์ในการให้ข้อมูลและเพื่อการศึกษาเท่านั้น ช่วยเตือนความจำ


* หากมีข้อมูลข้อผิดพลาดประการใด ขออภัยมา ณ ที่นี้ด้วย  รบกวนแจ้ง Admin เพื่อแก้ไขต่อไป
ขอบคุณครับ

#WindowsForensic #ComputerForensics #dfir #forensics #digitalforensics #computerforensic #investigation #cybercrime #fraud

Wednesday, December 29, 2021

Digital Forensics Professional - INE Lab 3 สอบ (ECDFP)

Digital Forensics Professional - INE Lab สอบ (ECDFP) 

วันนี้จะมาเตรียมสอบ  ECDFP  โดยการฝึกทำ LAB  Digital Forensics Professional - INE  Course

ขั้นแรกคือ การเข้าไปทำ Lab  

1. ทำการ download VPN File   ตัวอย่าง Basic File Header Analysis

LAB 3


เรียนคำสั้งเพื่อเชื่อมต่อ VPN 

#sudo openvpn /home/kali/Desktop/lab-3-basic-file-header-analysis.ovpn 

และใส่  User Password 

 


Connection Type: VNC
vncviewer 172.16.82.100  และ login password






Goals

Learn and use various tools to analyze and examine various file headers.



Those files can be found in the C:\DFP\Labs\Module03\Lab3 directory of the Win10 machine.


ไฟล์ที่ 1: ตรวจสอบไฟล์ "2D3Fa2a"


หลังจากเชื่อมต่อกับเครื่อง Win10  เปิดโปรแกรม Hex [อยู่ที่เดสก์ท็อป] และโหลดไฟล์ 2D3FA2A [อยู่ใน C:\DFP\Labs\Module03\Lab3]
การตรวจสอบส่วนหัวของไฟล์หลังจากเปิดด้วย  HXD ทำให้เราสามารถระบุประเภทของไฟล์ได้ทันที
จากส่วนหัว (%PDF_1.5 . .%) และสองสามไบต์แรก (25 50 44 46 ) ซึ่งเป็นหมายเลข magic number ของไฟล์ PDF เราสามารถสรุปได้ว่าไฟล์นี้เป็นไฟล์ PDF


ไฟล์ที่ 2: ตรวจสอบไฟล์ "AW3DXW"



ส่วนหัวของไฟล์ที่สองไม่ชัดเจน  เนื่องจากบรรทัดแรกไม่มีนามสกุลที่เป็นที่รู้จัก

อย่างไรก็ตาม เราสามารถสังเกตได้ว่าไฟล์เริ่มต้นด้วย (FF D8) ไบต์; นี่คือ magic number สำหรับไฟล์ JPEG นอกจากนี้เรายังสามารถสังเกตเห็น JFIF ภายในไฟล์ เราสามารถสรุปได้ว่าเรากำลังวิเคราะห์ไฟล์ที่มีรูปแบบ JPEG


ไฟล์ที่  3: ตรวจสอบไฟล์ "Mx#234"
ไฟล์ที่สามค่อนข้างสับสนกว่าตัวอย่างก่อนหน้าเล็กน้อย เราจะเห็นว่าไฟล์เริ่มต้นด้วยค่า (50 4B 03 04)


เมื่อดูออนไลน์เราจะเห็นว่านี่คือ Magic Number สำหรับไฟล์ Microsoft 2010



ปัญหาคือ Magic Number นี้ไม่สามารถช่วยให้เราแยกความแตกต่างระหว่างไฟล์ Word, PowerPoint หรือ Excel ได้ เนื่องจาก   มีไฟล์สามประเภทภายในโฟลเดอร์ที่ติดไวรัส นั่นหมายความว่าเราต้องมองหาที่อื่นเพื่อพิจารณาว่าไฟล์นี้เป็น Microsoft Office ประเภทใด ในตัวอย่างนี้ เป็นส่วนท้ายของไฟล์ที่จะช่วยเรา ไม่ใช่ส่วนหัว

ต่างจากตัวอย่างก่อนหน้านี้ โดยการตรวจสอบส่วนท้ายของแต่ละไฟล์ เราจะเห็นได้ว่า Microsoft 2010 เพิ่มประเภทเนื้อหาไว้ใกล้กับส่วนท้ายของไฟล์ เราสามารถดูการอ้างอิงสตริง PPT จำนวนมากที่เขียนไว้ในส่วนท้ายของไฟล์

ซึ่งจะช่วยให้เราระบุไฟล์นี้เป็นไฟล์ PowerPoint


ไฟล์ที่  4: ตรวจสอบไฟล์ "QW#@g#"
ไฟล์นี้ดูง่ายกว่าตัวอย่างอื่นๆ ก่อนหน้านี้ที่เราเคยเห็นมา



ฟังก์ชันการแสดงข้อความ ASCII อัตโนมัติที่ใช้งานภายใน Hex Workshop มีประโยชน์มากในตัวอย่างนี้ ข้อความ  ASCII ธรรมดาที่เขียนในไฟล์แสดงว่าเป็นไฟล์ข้อความปกติที่สามารถเปิดได้โดยใช้ Notepad

ดังที่เราเห็นก่อนหน้านี้ ไฟล์ข้อความปกติซึ่งมักจะเปิดโดยใช้ Notepad ไม่มีส่วนหัวหรือส่วนท้าย(  header or footer ) ( เราสามารถระบุได้ว่านี่คือไฟล์ข้อความ (Test File )โดยการตรวจสอบเนื้อหาและ อักขระ ASCII


ไฟล์ที่  5: ตรวจสอบไฟล์ "XFaWxVa"
ในตัวอย่างนี้ เรายังพบเลขMagic Number ของ Microsoft Office 2010 ที่จุดเริ่มต้นของไฟล์



เราสามารถใช้วิธีเดียวกับที่เราทำตามก่อนหน้านี้โดยตรวจสอบจุดสิ้นสุดของไฟล์ เพื่อพิจารณาว่าไฟล์นี้เป็นไฟล์ประเภทใด ใกล้ถึงจุดสิ้นสุดของไฟล์ เราจะเห็นเอกสารอ้างอิงซึ่งบ่งชี้ว่าน่าจะเป็นเอกสาร Microsoft Office Word



งาน 6: ตรวจสอบไฟล์ "ZC2f2d2"
เราพบหมายเลขมายากลของ Microsoft Office 2010 ที่ส่วนหัวของไฟล์อีกครั้ง



ตอนนี้เราได้ทำไปแล้วสองครั้งแล้ว เรารู้แล้วว่าเราต้องไปที่ใดและดูว่าไฟล์นี้เป็น Microsoft Office 2010 ประเภทใด ที่ส่วนท้ายของไฟล์ เราสามารถค้นหาข้อมูลอ้างอิงมากมาย เช่น XL, worksheet, and workbook   ซึ่งชี้ให้เห็นถึงข้อเท็จจริงที่ว่านี่คือไฟล์ Microsoft Office 2010 Excel


INE Cyber Security – Connecting to Your First Lab



อ่านเพิ่มเตรียมสอบ 


Reference ine.com

หมายเหตุ:เนื้อหาในเว็บไซต์นี้มีขึ้นเพื่อวัตถุประสงค์ในการให้ข้อมูลและเพื่อการศึกษาเท่านั้น ช่วยเตือนความจำ

* หากมีข้อมูลข้อผิดพลาดประการใด ขออภัยมา ณ ที่นี้ด้วย  รบกวนแจ้ง Admin เพื่อแก้ไขต่อไป
ขอบคุณครับ

#WINDOWSFORENSIC #COMPUTERFORENSICS #DFIR #FORENSICS #DIGITALFORENSICS #COMPUTERFORENSIC #INVESTIGATION #CYBERCRIME #FRAUD 

Volatility Lab

Volatility Lab  Image Wanna.vmem P.73 windows.info #python3  vol.py   -f '/home/kali/Desktop/Wanna/Wanna-MEM.vmem' windows.info     ...