Forensic ArtifactWindows: Filesystem

$LogFile — NTFS Transaction Log

The NTFS transaction log records all metadata changes to the filesystem in a circular 64 MB buffer. It contains MFT record modifications that enable recovery of recent file operations after MFT tampering, timestomping, or anti-forensics cleanup.

When an adversary modifies MFT timestamps, deletes files, or attempts to clean up their tracks on an NTFS volume, the filesystem’s own transaction journal silently records every metadata change they make. $LogFile is NTFS’s crash-recovery mechanism repurposed as a forensic artifact — a circular buffer that captures the before-and-after state of every MFT record modification, providing investigators with a recent-history replay of filesystem activity that survives most anti-forensics techniques.

What Is $LogFile?

$LogFile is the NTFS transaction log, a system metafile stored in the root of every NTFS volume at C:\$LogFile (inode 2 in the MFT). Its primary purpose is crash recovery: NTFS uses a write-ahead logging model where all metadata changes are first written to $LogFile before being committed to the MFT and other metadata structures. If the system crashes before the commit completes, the NTFS driver replays the log on the next mount to restore filesystem consistency.

From a forensic perspective, $LogFile contains redo and undo records for recent MFT changes. A redo record describes the change that was made. An undo record describes how to reverse the change. Together, these records provide a timeline of metadata modifications — including file creation, deletion, renaming, attribute changes, and timestomping.

$LogFile operates as a circular buffer, typically 64 MB in size. When the buffer is full, the oldest records are overwritten. On an active system, the effective retention window ranges from a few hours to several days depending on filesystem activity.

Key Insight

$LogFile records the previous values of modified MFT attributes in its undo records. When an attacker timestomps a file, $LogFile preserves the original timestamps in the undo data. This is one of the very few mechanisms that can prove timestomping occurred and recover the true original timestamps.

Location & Format

PropertyDetail
PathC:\$LogFile (root of every NTFS volume)
MFT EntryInode 2 (fixed position in MFT)
Typical Size64 MB (can range from 2 MB to 256+ MB)
Buffer TypeCircular — oldest records overwritten when full
Record TypesRestart records, client records (redo/undo operations)
VisibilityHidden system metafile; requires raw disk access or forensic tools

Internal Structure

$LogFile consists of two restart areas (at the beginning, for redundancy) and a logging area containing the circular buffer. Each log record contains a Log Sequence Number (LSN) that monotonically increases, providing strict ordering. Records contain operation codes specifying the metadata change type.

Record Types & Operation Codes

Operation CodeNameForensic Meaning
0x02InitializeFileRecordSegmentNew file or directory created — the full MFT record is logged
0x03DeallocateFileRecordSegmentFile or directory deleted — the MFT record is freed
0x05CreateAttributeNew attribute added to an MFT record
0x09UpdateResidentValueResident attribute data modified — includes timestamp changes (timestomping)
0x0BUpdateMappingPairsNon-resident data run mappings changed (file extents modified)
0x0FSetNewAttributeSizesAttribute size changed — file grew or was truncated
0x13AddIndexEntryAllocationDirectory entry added — file appeared in a parent directory
0x14DeleteIndexEntryAllocationDirectory entry removed — file removed from parent directory
Redo vs Undo

Each log record pair contains both the redo data (the new state) and the undo data (the previous state). For timestomping detection, the undo data preserves the original timestamps. For deleted file recovery, the redo data from InitializeFileRecordSegment contains the complete MFT record as it existed at creation time.

What $LogFile Reveals

Forensic Use Cases

1. Timestomping Detection

An attacker sets their malware’s timestamps to match legitimate system files. The $MFT $STANDARD_INFORMATION shows the forged times. However, $LogFile contains an UpdateResidentValue record with the undo data showing the original timestamps and the redo data showing the forged timestamps. The LSN ordering proves the modification occurred after file creation.

2. Deleted Tool Recovery

An attacker drops a tool into C:\Windows\Temp\, executes it, then deletes it. The MFT entry may be reallocated. $LogFile’s InitializeFileRecordSegment record from creation contains the complete MFT record including file name, size, and timestamps — recoverable even after the MFT entry is overwritten.

3. Anti-Forensics Timeline Reconstruction

After a breach, the attacker ran a cleanup script deleting tools, logs, and Prefetch files. $LogFile contains DeallocateFileRecordSegment records for each deleted file and DeleteIndexEntryAllocation for directory removals. The LSN ordering reconstructs the exact cleanup sequence.

4. Ransomware Encryption Timeline

During ransomware encryption, $LogFile records MFT modifications for each encrypted file. If the 64 MB buffer encompasses the encryption start, LSN-ordered records reveal the sequence and timing, identifying the first encrypted file and encryption rate.

5. File Rename Tracking

When an attacker renames mimikatz.exe to svchost.exe, $LogFile records the directory index deletion for the original name and addition of the new name within the same transaction. The undo data preserves the original file name.

Acquisition Methods

Time-Critical Collection

$LogFile has the shortest effective retention of any major NTFS artifact. On an active system, the 64 MB buffer may contain only hours of history. Collect $LogFile as early as possible after an incident. Prioritize it above most other artifacts.

CMD / ADMIN
:: Using KAPE (recommended for live systems)
kape.exe --tsource C: --tdest C:\Evidence --target NTFSFilesAndUSNJrnl

:: Using RawCopy (bypasses NTFS locks)
RawCopy.exe /FileNamePath:C:\$LogFile /OutputPath:C:\Evidence\

:: Using icat from The Sleuth Kit (from forensic image)
icat /dev/sdb1 2 > /analysis/ntfs/LogFile

:: Using FTK Imager (GUI)
:: Navigate to [root] - $LogFile - Right-click - Export

Parsing Tools & Analysis

ToolAuthorLicenseNotes
LogFileParserJoakim SchichtOpen sourcePrimary $LogFile parser; extracts redo/undo records with operation codes and timestamps
NTFS Log TrackerJunghoon OhFreeCombines $LogFile, $UsnJrnl, and $MFT for unified timeline analysis
MFTECmdEric ZimmermanFreeParses $MFT with $LogFile transaction replay support
Triforce ANJPVariousCommercialAdvanced NTFS journal parsing; correlates $LogFile with $MFT and $UsnJrnl
CMD / FORENSICS
:: Parse $LogFile with LogFileParser (Joakim Schicht)
LogFileParser.exe /LogFileFile:C:\Evidence\LogFile /OutputPath:C:\Analysis\ /OutputFormat:csv

:: Combined analysis workflow
:: 1. Parse $MFT for current state
MFTECmd.exe -f C:\Evidence\$MFT --csv C:\Analysis\

:: 2. Parse $UsnJrnl for change journal
MFTECmd.exe -f C:\Evidence\$UsnJrnl:$J --csv C:\Analysis\

:: 3. Parse $LogFile for redo/undo records
LogFileParser.exe /LogFileFile:C:\Evidence\$LogFile /OutputPath:C:\Analysis\
Analysis Workflow

The most effective $LogFile analysis combines it with $MFT and $UsnJrnl. Parse $MFT first for the current filesystem state. Then $UsnJrnl for change journal entries. Finally $LogFile for raw redo/undo records. The three overlap in time coverage but provide different detail levels: $MFT = current state, $UsnJrnl = changes with reasons, $LogFile = raw metadata changes with before/after values.

Retention & Persistence

PropertyTypical ValueNotes
Buffer size64 MB (default)Can range from 2 MB to 256+ MB; set at format time
Effective retentionHours to daysDepends on filesystem activity; quiet systems retain longer
Survives rebootPartiallyLog replayed and partially cleared on clean mount
Overwrite behaviorCircular (FIFO)Oldest records overwritten first
Clean unmountLog checkpointedReduces recoverable historical data

Anti-Forensics Resilience

TechniqueAffects $LogFile?Details
File deletionRecords the deletionDeallocateFileRecordSegment records the deletion itself as evidence
TimestompingRecords the changeUpdateResidentValue captures both old and new timestamps
MFT entry overwriteOriginal in $LogFileInitializeFileRecordSegment from creation may still exist in buffer
$LogFile wipingPossible but detectableZeroing requires raw disk access; wiped state is anomalous
CCleaner/EraserNo effectStandard cleanup tools do not target NTFS metafiles
Circular Buffer as a Strength

An adversary cannot selectively delete specific $LogFile records without destroying the entire log structure. They can either leave it intact (preserving evidence) or zero the entire file (which is suspicious and detectable). This all-or-nothing characteristic makes $LogFile relatively tamper-resistant within its retention window.

MITRE ATT&CK Detection Mapping

TechniqueName$LogFile Evidence
T1070.004 T1070.004Indicator Removal: File DeletionDeallocateFileRecordSegment and DeleteIndexEntryAllocation records
T1070.006 T1070.006Indicator Removal: TimestompingUpdateResidentValue on $SI with mismatched redo/undo timestamps
T1105 T1105Ingress Tool TransferInitializeFileRecordSegment for tools staged in Temp or ProgramData

Related Artifacts & Cross-References

ArtifactRelationshipCross-Correlation
$MFTCurrent filesystem metadata; $LogFile records changes to $MFT$MFT = current state; $LogFile = how it got there
$UsnJrnlChange journal with reason codes; higher-level than $LogFile$UsnJrnl = human-readable changes; $LogFile = raw redo/undo data
$I30 IndexDirectory index entries; $LogFile records index modifications$I30 slack + $LogFile = comprehensive file existence evidence
PrefetchConfirms execution with timestamps and run counts$LogFile shows file creation; Prefetch proves execution
ShimcacheRecords executables evaluated by the compatibility engineShimcache + $LogFile = file existed and was evaluated

References

  1. Joakim Schicht, “LogFileParser” — https://github.com/jschicht/LogFileParser
  2. Junghoon Oh, “NTFS Log Tracker” — https://sites.google.com/site/aborntechhome/
  3. Eric Zimmerman, “MFTECmd” — https://ericzimmerman.github.io/
  4. SANS Institute, “NTFS Forensics: $LogFile and $UsnJrnl Analysis” — https://www.sans.org/blog/
  5. Brian Carrier, “File System Forensic Analysis” — Addison-Wesley Professional
  6. Microsoft, “How NTFS Works: Log File Service” — https://learn.microsoft.com

Mjolnir Security — Digital Forensics & Incident Response

Mjolnir Security provides 24/7 incident response, digital forensics, and expert witness testimony. Our DFIR team specializes in NTFS forensics, $LogFile analysis, timestomping detection, and filesystem-level evidence recovery.

Digital ForensicsIncident ResponseExpert WitnessNTFS ForensicsTimestomping DetectionAnti-Forensics

mjolnirsecurity.com — 24/7: +1 833 403 5875