skip to content
My Site Logo abdons blog

FAT32 Analysis

FAT32 Analysis

Introduced in August 1996 with Windows 95 Service Release 2, FAT32 remains relevant despite its age due to its lightweight design, cross-OS compatibility, and lack of permissions, making it ideal for USBs, embedded systems, and legacy devices (4GB file size limit, 2TB volume limit). However, these traits also make it vulnerable to attacks, such as Stuxnet, Mustang Panda, UNC4990, and Rubber Ducky USBs, often exploiting MITRE ATT&CK techniques like Defense Evasion (TA0005).

FAT32 Structure:

A FAT32 volume is divided into three main areas:

Reserved Area: Contains metadata for filesystem operation. FAT Area: Manages cluster allocation and file fragmentation. Data Area: Stores file and directory contents.

image.png

Reserved Area:

The Reserved Area starts at sector 0 and includes:

FieldSector NumberSize (Bytes)Explanation
Boot Sector0512Contains partition metadata (e.g., sector size, FAT location).
FSInfo Sector1512Stores info on free clusters and next available cluster.
Reserved Sectors2–52048 (4 × 512)Placeholder sectors, reserved for future use.
Backup Boot Sector6512A backup of the Boot Sector for redundancy.
Additional Reserved Sectors7–(start of FAT)VariesAdditional reserved space until the FAT area begins (determined from Boot Sector).

Sector Size: Typically 512 bytes (standard for most disks).

Total Reserved Sectors: Determined from the Boot Sector (e.g., 6270 sectors in the example, starting FAT at sector 6270).

Boot Sector:

Location: Sector 0 (first 512 bytes of the partition). Contains metadata essential for the OS to access the partition, including the layout of the FAT, Root Directory, and Data Region. Includes several fields, some of which are highlighted for forensic analysis.

image.png

Boot Sector Fields

FieldSubfieldSize (Bytes)Offset (Hex)Example Value (Hex)Translated ValueExplanation
Jump Instruction-300–02EB 58 90-Allows BIOS/bootloader to jump to boot code (e.g., jumps 88 bytes, NOP for padding).
OEM Name-803–0A4D 53 44 4F 53 35 2E 30MSDOS5.0Indicates the formatting tool (e.g., MS-DOS 5.0).
BIOS Parameter Block (BPB)Bytes per Sector20B–0C00 02512Sector size (standard: 512 bytes).
Sectors per Cluster10D011Number of sectors in a cluster (e.g., 1 sector/cluster; often 4KB in practice).
Reserved Sectors20E–0F7E 186270Total reserved sectors (includes Boot Sector, FSInfo, etc.).
Number of FATs110022Number of FATs (FAT1 + FAT2 backup).
Max Root Dir Entries211–1200 000Set to 0 for FAT32 (dynamic root directory).
Total Sectors2 or 413–1400 000Not used for FAT32; see Total Sectors 32.
Media Descriptor115F8-Indicates media type (e.g., 0xF8 = fixed disk; often inaccurate in modern OSs).
Sectors per FAT216–1700 000Not used for FAT32; see Extended BPB.
Sectors per Track218–193F 0063Logical placeholder for compatibility (not physical).
Number of Heads21A–1BFF 00255Logical placeholder for compatibility (not physical).
Hidden Sectors41C–1F00 F8 30 06103872512Sectors before partition start (e.g., 49GB for C:\ partition).
Total Sectors 32-420–2300 00 02 00131072Total sectors in partition (e.g., 64MB for the image).
Extended BPBSectors per FAT424–27C1 03 00 00961Sectors allocated to each FAT (FAT1 and FAT2).
Flags228–2900 0000 = FAT mirroring enabled (FAT1 and FAT2 are synced).
Version22A–2B00 000FAT32 version (typically 0.0).
Cluster Root Directory42C–2F02 00 00 002Root Directory starts at cluster 2 in the Data Region.
FSInfo Sector230–3101 001FSInfo Sector location (sector 1).
Backup Boot Sector232–3306 006Backup Boot Sector location (sector 6).
Boot Code-42034–1F0--Code for BIOS/UEFI to boot the volume.
Boot Sector Signature-21F0–1F155 AA-Validates the sector as bootable.

Byte Order: FAT32 uses Little Endian (Least Significant Bit first). For example, 02 00 = 512 (not 2).

Key Metadata:

Partition size (Total Sectors 32).

FAT location (Reserved Sectors + Sectors per FAT).

Root Directory location (Cluster Root Directory).

FAT Area:

Location:

FAT1: Starts after Reserved Sectors (e.g., offset 0030FC00 = 6270 × 512 bytes).

FAT2 (Backup): Starts after FAT1 (e.g., offset = (6270 + 961) × 512).

Purpose: Tracks cluster allocation for files/directories. Manages fragmentation (non-contiguous clusters). Marks bad clusters for integrity.

Structure: Each FAT entry is 32 bits (4 bytes), but only 28 bits are used. FAT entries map to clusters in the Data Region (index starts at 2; clusters 0 and 1 are reserved).

FAT Entry Values

Value (Hex)MeaningExplanation
00 00 00 00Free clusterCluster is unused and available for allocation.
00 00 00 02 to 0F FF FF F6Used clusterPoints to the next cluster in the chain (e.g., 00 00 00 06 = next cluster 6).
0F FF FF F7Bad clusterCluster is defective and should not be used.
0F FF FF F8 to 0F FF FF FFEnd of File (EOF)Marks the last cluster in a chain (standard value).
FF FF FF FFEnd of File (EOF) (simplified)Alternative EOF marker (ignores reserved bits).

Example FAT Entries (from VM ):

image.png
FAT Cluster IndexData Region ClusterValue (Hex)Meaning
0-0F FF FF F8EOF (reserved cluster).
1-FF FF FF FFEOF (reserved cluster).
220F FF FF FFEOF (single-cluster chain).
7700 00 00 08Points to cluster 8 (chain: 7 → 8).
880F FF FF FFEOF (chain: 7 → 8).
9900 00 00 0APoints to cluster 10 (chain: 9 → 10).
101000 00 00 0BPoints to cluster 11 (chain: 9 → 10 → 11).
111100 00 00 0CPoints to cluster 12 (chain: 9 → 10 → 11 → 12).
12120F FF FF FFEOF (chain: 9 → 10 → 11 → 12).

Cluster Chains:

Files are stored in clusters, and the FAT tracks the chain of clusters (e.g., file at cluster 9 spans clusters 9 → 10 → 11 → 12). Each FAT entry points to the next cluster or marks EOF.

Data Area

Components:

Root Directory: Acts as an index, storing metadata about files and directories. Data Region: Stores the actual contents of files.

Location:

Starts after the FAT Area (FAT1 and FAT2). First two clusters (0 and 1) are reserved for system use (virtual, not physical). Root Directory begins at cluster 2 (third cluster, since numbering starts at 0).

Dynamic Growth:

Since FAT32, the Root Directory does not have a fixed size or reserved clusters. It starts at cluster 2 and expands to the next free cluster (tracked by the FAT) as needed.

Root Directory

Stores metadata for files and directories in the Data Region.

Entry Types:

Long File Name (LFN): Stores the full filename in UTF-16, overcoming Short File Name limitations.

Short File Name (SFN): Stores file attributes, timestamps, starting cluster, and size in the 8.3 format.

Long File Name (LFN) Entry

Stores the full filename (up to 255 characters) in UTF-16, linked to an SFN entry. Each LFN entry is 32 bytes and can span multiple entries for long names.

Fields:

41 41 00 62 00 6F 00 75 00 74 00 0F 00 36 5F 00 54 00 48 00 4D 00 2E 00 74 00 00 00 78 00 74 00

Offset (Hex)Size (Bytes)DescriptionExample Value (Hex)Meaning
0x001Sequence number, last entry flag, deleted flag41Sequence 1, last entry
0x0110First 5 characters (UTF-16)41 00 62 00 6F 00 75 00 74 00”about”
0x0B1Attributes (0x0F for LFN)0FLFN entry
0x0C1Type (reserved)00Reserved (0x00)
0x0D1Checksum of short name36Checksum 36
0x0E12Next 6 characters (UTF-16)5F 00 54 00 48 00 4D 00 2E 00 74 00”_THM.t”
0x1A2Reserved (FAT first cluster, legacy)00 00Always 0 (compatibility)
0x1C4Last 2 characters (UTF-16)78 00 74 00”xt”

Example Filename: From the LFN entry at offset 00400100: Full name: about_THM.txt.

Sequence Number:First nibble: Flags (e.g., last entry, deleted). Second nibble: Sequence number (e.g., 41 = sequence 1, last entry).

Short File Name (SFN) Entry

Stores file metadata, including the 8.3 filename, attributes, timestamps, starting cluster, and size. Each SFN entry is 32 bytes.

Fields:

41 42 4F 55 54 5F 7E 31 54 58 54 20 00 BD F4 84 83 59 83 59 00 00 21 85 83 59 07 00 22 02 00 00

Offset (Hex)Size (Bytes)Field NameExample Value (Hex)Meaning
0x0011File Name (8.3 format)41 42 4F 55 54 5F 7E 31 54 58 54ABOUT_~1TXT
0x0B1Attributes20ARCHIVE (0x20)
0x0C1Reserved00Reserved (0x00)
0x0D1Creation Time (Tenths)BD20 ms
0x0E2Creation TimeF4 8416:39:40 (4:39:40 PM)
0x102Creation Date83 592024-12-03
0x122Last Access Date83 592024-12-03
0x142High Word First Cluster00 000000 0000 0000 0000
0x162Last Modification Time21 8516:41:02 (4:41:02 PM)
0x182Last Modification Date83 592024-12-03
0x1A2Low Word First Cluster07 000000 0111 0000 0000 (cluster 7)
0x1C4File Size22 02 00 00546 bytes

Example File: From the SFN entry at offset 00400120:

Short name: ABOUT_~1TXT (corresponds to about_THM.txt).

Attributes: ARCHIVE (0x20).

Timestamps: Created: 2024-12-03, 16:39:40 (20 ms). Last Accessed: 2024-12-03. Last Modified: 2024-12-03, 16:41:02 . Starting Cluster: 7 (combine High Word 00 00 and Low Word 07 00). File Size: 546 bytes.

Data Region

Stores the actual contents of files. Starts after the Root Directory, using clusters tracked by the FAT.

Cluster Mapping: Each file’s starting cluster is stored in its SFN entry (e.g., cluster 7 for about_THM.txt). The FAT maps the cluster chain (e.g., cluster 7 → 8 → EOF).

some things you can do:

you may use autopsy to see have a better view of the disk you have , while still having the same hex view u would have in HxD

Hidden files & directories:

using autopsy , you will have an interface just like this ,

image.png

if you select a file you will access the bouton panel like hex , text if the file contain text , meta data , and so on

image.png

Change the timestamps:

Attackers often modify file timestamps— Creation Time , Modified Time , and Last Access Time—to hide malicious activity. By altering these values, they make malicious files appear legitimate or blend them with normal system files.

to detect it we we’ll use autopsy again navigating into the timeline tab

image.png image.png

from here we can see a time line of all the files if we see small events in an order year this may indicate the file time stamp was altered , logically speaking the user will have all the files created in close time periods

Common Mistakes Attackers Make:

Illogical Timestamps:

Creation time later than Modified time: (impossible in normal operations). Timestamps older than the OS installation date (e.g., a file “created” in 1999 on a 2020 system).

Uniform Timestamps:

Multiple files with identical Creation/Modified times suggest bulk manipulation.

Mismatch with Logs:

Windows Event Logs (Event ID 4663 for file access) may show the real access time, conflicting with the altered timestamp.

File Deletion and Clear Persistence:

When attackers compromise a system, they often delete file or manipulate timestamps  to hide their activity. On FAT32 file systems, forensic analysis can uncover these actions by examining: Deleted file entries (marked with 0xE5 in directory structures). FAT table clusters to recover file chains. Timestamp anomalies (e.g., creation/modified time mismatches).

yet again we will use my dude autopsy , thankfully it have some features that can help us like it reserving deleted items , having the recycle bin directory / and the deleted files tab

image.png