Saturday, March 7, 2026

Essential Linux Commands for Log Analysis

Essential Linux Commands for Log Analysis

Prepare Sample SSH Log Files

Log download  the log files contain relevant SSH events, including timestamps, source IP addresses, usernames, actions (login, logout), etc.

Essential Linux Commands for Log Analysis

Commands for Hashing Log Files

1. Generating a Hash (SHA-256)

The most common and secure standard for forensic imaging and log analysis is SHA-256.

  • Command: sha256sum ssh.log

    Essential Linux Commands for Log Analysis

  • Explanation: This command calculates the SHA-256 hash of the file ssh.log. It will output a 64-character hexadecimal string followed by the filename.

2. Saving the Hash to a Verification File

In a forensic investigation, you must save the hash immediately after collecting the evidence.

  • Command: sha256sum ssh.log > ssh.log.sha256

    Essential Linux Commands for Log Analysis

  • Explanation: The > operator redirects the output into a new file named ssh.log.sha256. This file acts as your "Evidence Reference".

3. Verifying the Integrity

To check if the log file has been tampered with or corrupted later:

  • Command: sha256sum -c ssh.log.sha256

  • Explanation: The -c (check) flag tells the system to read the hash from the .sha256 file and compare it with the current state of ssh.log.

    • Result OK: The file is identical to the original.

      Essential Linux Commands for Log Analysis

    • Result FAILED: The file has been modified or corrupted.


Essential Linux Commands for Log Analysis

1. grep (Global Regular Expression Print)

Used to search for specific text patterns within the log file.

  • Command: grep "success" ssh.log

  • Purpose: To filter and display only the lines where a login was successful.

  • Command: grep "failure" ssh.log | wc -l

  • Purpose: To count the total number of failed login attempts.

    Essential Linux Commands for Log Analysis

Steps to Analyze SSH Log Files

#cat Desktop/Web_Server_Logs/ssh.log 

Essential Linux Commands for Log Analysis

Analyze failed login attempts:

 #cat Desktop/Web_Server_Logs/ssh.log | grep failure 


Essential Linux Commands for Log Analysis

Investigate SSH sessions from unusual or suspicious source IP addresses: 

awk (Pattern Scanning and Processing)

Used to extract specific columns (fields) from the log.

  • Command: awk '{print $3}' ssh.log

  • Purpose: To extract the Source IP address (which is in the 3rd column)

    Essential Linux Commands for Log Analysis

  • Command: awk '{print $5}' ssh.log

  • Purpose: To extract the Destination IP address (which is in the 5th column).

    Essential Linux Commands for Log Analysis

If you want to find the Top 10 IP addresses trying to hack your server, use this combined

Step-by-step breakdown:

  1. awk '{print $3}': Get all Source IPs.

  2. sort: Group identical IPs together.

  3. uniq -c: Count how many attempts each IP made.

  4. sort -nr: Sort numerically in reverse (highest count at the top).

  5. head -n 10: Show only the top 10 results.

#awk '{print $3}' Desktop/Web_Server_Logs/ssh.log | sort | uniq -c | sort -nr | head -n 10

Essential Linux Commands for Log Analysis

Top Target (Destination) IPs:

  • 192.168.28.254 (High frequency of attempts)

    Essential Linux Commands for Log Analysis

  • 192.168.23.203 (High frequency of attempts)

  • Essential Linux Commands for Log Analysis

  • 192.168.27.203 (High frequency of attempts)

  • Essential Linux Commands for Log Analysis
  1. 1331904022.010000
    → Unix Timestamp (เวลาที่เกิดเหตุการณ์)

  2. CU46Bb2UypzdF4eTW
    → Session ID / Connection ID ของ SSH

  3. 192.168.202.110
    → Source IP (เครื่องที่พยายามเชื่อมต่อ)

  4. 36586
    → Source Port

  5. 192.168.27.203
    → Destination IP (เครื่องปลายทาง = SSH Server)

  6. 22
    → Destination Port (SSH)

  7. undetermined / failure
    → สถานะการเชื่อมต่อ

  • undetermined = ยังไม่ทราบผล (handshake)

  • failure = login ล้มเหลว

  1. INBOUND
    → เป็นการเชื่อมต่อขาเข้า (incoming connection)

  2. SSH-2.0-OpenSSH_5.8p1 Debian-ubuntu3
    → Banner ของ SSH 

  • The SSH log indicates repeated inbound connection attempts from IP address 192.168.202.110 targeting the SSH service on 192.168.27.203 over port 22.
    Multiple sessions resulted in authentication failures, which is consistent with a brute-force or unauthorized login attempt.

 Time Conversion Command

Since the log uses Unix Epoch Time, you can convert it to a human-readable format using the date command.

  • Command: date -d @1332017793.040000 

  • Purpose: Converts the timestamp 1332017793.040000  into a standard Date/Time format.

Essential Linux Commands for Log Analysis


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

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


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

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

Friday, March 6, 2026

Windows Forensic — Audit Log Cleared

Windows Forensic — Audit Log Cleared

picoCTF เป็นเกม ด้าน computer security ที่จัดโดย มหาวิทยาลัย Carnegie Mellon หรือ CMU ที่มุ่งเป้าไปที่นักเรียนมัธยมและ มหาวิทยาลัยให้มาแสดงทักษะความสามารถ

Windows Forensic — Audit Log Cleared
photo Credit:PicoCTF

Description

One of the employees at your company has their computer infected by malware! Turns out every time they try to switch on the computer, it shuts down right after they log in. The story given by the employee is as follows:
  1. They installed software using an installer they downloaded online
  2. They ran the installed software but it seemed to do nothing
  3. Now every time they bootup and login to their computer, a black command prompt screen quickly opens and closes and their computer shuts down instantly.
See if you can find evidence for the each of these events and retrieve the flag (split into 3 pieces) from the correct logs!
The analysis of Windows Event Logs should follow the digital forensic methodology recommended by the National Institute of Standards and Technology (NIST SP 800-86), which includes the stages of collection, examination, analysis, and reporting.

Collection of digital evidence


1️⃣ Evidence Identification (ระบุหลักฐาน)
File Name: Windows_Logs.evtx
Source: Employee Workstation(PicoCTF) Download the Windows Log file here
Evidence Type: Windows Event Log

Windows Forensic — Audit Log Cleared



2️⃣ Evidence Preservation (การรักษาหลักฐาน)

Windows Forensic — Audit Log Cleared

#Get-FileHash Windows_Logs.evtx
MD5    checksum:       630F28FF65702E0794256E87172C39CB
SHA1    checksum:      7D242525D3A1FA26923821F9C4416A895BB3C7F6
 
Step > Action
Receive evidence> Investigator
Calculate hash > SHA1 ,MD5
Store copy > Forensic workstation

3️⃣ Create Working Copy
Windows_Logs_original.evtx > Windows_Logs_analysis.evtx
4️⃣ Evidence Examination
Forensic tools
  • Event Viewer
  • PowerShell

Examination of forensic artifacts


5️⃣ Event Log Classification
Log TypeDescription
SecurityAuthentication events
6️⃣  Identify Suspicious Events

Event ID Description
  • 1102 Audit Log Cleared
  • 1033 Windows Installer
  • 4657 Registry Value Modified
  • 1074 System Shutdown

Windows Forensic — Audit Log Cleared

Event Analysis: Event ID 1102 – Audit Log Cleared
The screenshot shows a Windows Security Event Log entry with Event ID 1102.
 In digital forensic investigations, Event ID 1102 is considered a highly suspicious event because it may indicate an attempt to remove evidence from the system.

Attackers or malicious software may clear logs in order to:

  • hide malicious activities

  • remove traces of system compromise

  • prevent investigators from reconstructing the attack timeline

Therefore, this event is often associated with anti-forensic behavior.

Windows Forensic — Audit Log Cleared

Event Analysis: Event ID 1033 – Windows Installer Activity
The screenshot shows a Windows Application Event Log entry with Event ID 1033, generated by the Windows Installer service. However, the Manufacturer field contains an encoded value, which is unusual and may indicate hidden information. 

cGljb0NURntFdjNudF92aTN3djNyXw== This format resembles Base64 encoding, a common encoding method used to represent binary or text data. 
Malicious software installers sometimes embed encoded or obfuscated values in metadata fields to:
  • hide commands
  • store configuration data
  • conceal indicators of compromise

Windows Forensic — Audit Log Cleared


Event ID 4657 – Registry Value Modified 
The screenshot shows a Windows Security Event Log entry with Event ID 4657, which indicates that a registry value has been modified on the system.

The presence of Event ID 4657 suggests that the installed program modified the Windows Registry, which may indicate that malware created a persistence mechanism.

Windows Forensic — Audit Log Cleared

Event ID 1074 — System Shutdown Initiated The screenshot shows a Windows System Event Log entry with Event ID 1074, which records that a process initiated a system shutdown or restart.

Relationship to the Incident Scenario

The employee reported:

1️⃣ They installed software downloaded from the internet
2️⃣ The software appeared to do nothing
3️⃣ A command prompt briefly appears during login
4️⃣ The computer shuts down immediately

The forensic evidence supports this narrative.

Evidence Correlation Timeline

Analysis and timeline reconstruction


7️⃣ Timeline Reconstruction
Time Event ID     Event

03:55:14 1102     Audit log cleared

03:55:57 1033     Software installed

03:56:19 4657     Registry modified

05:02:35 1074     System shutdown


Reporting and documentation of findings


Investigation Conclusion

The analysis of Windows Event Logs revealed a sequence of suspicious events.

Key findings include:

  • Installation of potentially malicious software

  • Registry modification suggesting persistence mechanism

  • Programmatic system shutdown initiated by shutdown.exe

These events indicate a likely malware infection affecting the system.

Further investigation should include:

  • malware analysis

  • registry artifact examination

  • disk forensic analysis

Windows Forensic — Audit Log Cleared

Windows Forensic — Audit Log Cleared

Ref: 

PicoCTF

Digital forensic analysis conducted according to:

    • NIST SP 800-86 Guide to Integrating Forensic Techniques into Incident Response

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


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


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

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

Friday, January 23, 2026

Forensic Workstation

Forensic Workstation

Definition of topic
A forensic workstation is defined as a specialized computer setup used by forensic analysts for dedicated processes such as forensic imaging and malware testing, typically connected to a forensic network for information storage and printing facilities. These workstations can be frequently rebuilt or upgraded as needed for specific cases.
Ref: sciencedirect[.]com/topics/computer-science/forensic-workstation
Forensic Workstation คือคอมพิวเตอร์สมรรถนะสูงที่ออกแบบมาเพื่อการสืบสวนคดีดิจิทัลโดยเฉพาะ รองรับการทำ Disk Imaging, กู้คืนข้อมูล, และวิเคราะห์หลักฐานจาก Windows, macOS, Linux, Android และ iOS อย่างครบวงจร มาพร้อม CPU หลายคอร์, RAM ขนาดใหญ่, NVMe SSD ความเร็วสูง และ Hardware Write Blocker เพื่อรักษาความสมบูรณ์ของหลักฐาน
คุณสมบัติสำคัญของ Forensic Workstation
  • ความเร็วและประสิทธิภาพสูง: ใช้หน่วยประมวลผล Intel หรือ AMD (16 คอร์ขึ้นไป) และ GPU acceleration สำหรับการถอดรหัส (Decryption) และวิเคราะห์หลักฐานที่รวดเร็ว
  • Hardware-level Protection: มีอุปกรณ์ป้องกันการเขียนข้อมูลลงบนหลักฐาน (Write Blocker) ทั้งแบบ Built-in หรือ external เพื่อป้องกันข้อมูลหลักฐานถูกแก้ไข
  • การจัดเก็บข้อมูลขนาดใหญ่: ใช้ระบบ RAID Storage ที่มีความจุสูงและเสถียรภาพ เพื่อรองรับข้อมูลหลักฐานจำนวนมาก
  • ซอฟต์แวร์วิเคราะห์ที่รองรับ: สามารถใช้งานร่วมกับเครื่องมือมาตรฐาน เช่น EnCase, FTKMAGNET AXIOM ,Oxygen Forensics  ,Belkasof  หรือเครื่องมือ Open-source Autopsy
  • รองรับการทำงานหลากหลาย: ใช้ในงานกู้คืนไฟล์, วิเคราะห์ไฟล์ระบบ, และตรวจสอบหลักฐานจากมือถือ เซิร์ฟเวอร์ และคลาวด์
ประเภทของเครื่องมือ
  • Desktop Forensic Workstations: เน้นประสิทธิภาพสูงสุด เหมาะสำหรับห้องปฏิบัติการ เช่น FRED (Forensic Recovery of Evidence Device)  
Forensic Workstation
Photo credit:https[:]//digitalintelligence[.]com

Forensic Workstation

Photo credit:https[:]//digitalintelligence[.]com

Forensic Workstation
Photo credit:https[:]//digitalintelligence[.]com

Forensic Workstation
Photo credit:https[:]//digitalintelligence[.]com
  • Portable/Field Workstations: เครื่องขนาดพกพา เหมาะสำหรับเก็บหลักฐานนอกสถานที่

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


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

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

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

Essential Linux Commands for Log Analysis

Essential Linux Commands for Log Analysis Prepare Sample SSH Log Files Log download    the log files contain relevant SSH events, including ...