/analyzing-mft-for-deleted-file-recovery
Analyze the NTFS Master File Table ($MFT) with MFTECmd, analyzeMFT,
$ npx -y skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-mft-for-deleted-file-recovery --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/analyzing-mft-for-deleted-file-recovery
Context preview
The summary Claude sees to decide when to auto-load this skill.
Analyze the NTFS Master File Table ($MFT) with MFTECmd, analyzeMFT,
SKILL.md
analyzing-mft-for-deleted-file-recovery.SKILL.mdname: analyzing-mft-for-deleted-file-recovery
description: Analyze the NTFS Master File Table ($MFT) with MFTECmd, analyzeMFT,
and X-Ways Forensics to recover metadata and content of deleted files by examining
MFT record entries, $LogFile, $UsnJrnl, and MFT slack space. Use when recovering
evidence of deleted files, reconstructing NTFS file-system timelines, or detecting
anti-forensic timestomping during a Windows forensic examination.
domain: cybersecurity
subdomain: digital-forensics
tags:
- mft
- ntfs
- deleted-files
- file-recovery
- mftecmd
- usn-journal
- logfile
- mft-slack-space
- file-system-forensics
- dfir
version: '1.0'
author: mahipal
license: Apache-2.0
nist_csf:
- RS.AN-03
- DE.AE-02
- RS.MA-01
mitre_attack:
- T1070.004
- T1070.006
- T1005
Analyzing MFT for Deleted File Recovery
Overview
The NTFS Master File Table ($MFT) is the central metadata repository for every file and directory on an NTFS volume. Each file is represented by at least one 1024-byte MFT record containing attributes such as $STANDARD_INFORMATION (timestamps, permissions), $FILE_NAME (name, parent directory, timestamps), and $DATA (file content or cluster run pointers). When a file is deleted, its MFT record is marked as inactive (InUse flag cleared) but the metadata remains until the entry is reallocated by a new file. This persistence makes MFT analysis a primary technique for recovering deleted file evidence, reconstructing file system timelines, and detecting anti-forensic activity such as timestomping.
When to Use
- When investigating security incidents that require analyzing mft for deleted file recovery
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Forensic disk image (E01, raw/dd, VMDK, or VHDX format)
- MFTECmd (Eric Zimmerman) or analyzeMFT (Python-based)
- FTK Imager, Arsenal Image Mounter, or similar for image mounting
- Timeline Explorer or Excel for CSV analysis
- Python 3.8+ for custom analysis scripts
- Understanding of NTFS file system internals
MFT Structure and Record Layout
MFT Record Header
Each MFT record begins with the signature "FILE" (0x46494C45) and contains:
| Offset | Size | Field | |--------|------|-------| | 0x00 | 4 bytes | Signature ("FILE") | | 0x04 | 2 bytes | Offset to update sequence | | 0x06 | 2 bytes | Size of update sequence | | 0x08 | 8 bytes | $LogFile sequence number | | 0x10 | 2 bytes | Sequence number | | 0x12 | 2 bytes | Hard link count | | 0x14 | 2 bytes | Offset to first attribute | | 0x16 | 2 bytes | Flags (0x01 = InUse, 0x02 = Directory) | | 0x18 | 4 bytes | Used size of MFT record | | 0x1C | 4 bytes | Allocated size of MFT record | | 0x20 | 8 bytes | Base file record reference | | 0x28 | 2 bytes | Next attribute ID |
Key MFT Attributes
| Type ID | Name | Description | |---------|------|-------------| | 0x10 | $STANDARD_INFORMATION | Timestamps, flags, owner ID, security ID | | 0x30 | $FILE_NAME | Filename, parent MFT reference, timestamps | | 0x40 | $OBJECT_ID | Unique GUID for the file | | 0x50 | $SECURITY_DESCRIPTOR | ACL permissions | | 0x60 | $VOLUME_NAME | Volume label (volume metadata files only) | | 0x80 | $DATA | File content (resident if <700 bytes) or cluster run list | | 0x90 | $INDEX_ROOT | B-tree index root for directories | | 0xA0 | $INDEX_ALLOCATION | B-tree index entries for large directories | | 0xB0 | $BITMAP | Allocation bitmap for index or MFT |
Deleted File Recovery Techniques
Technique 1: MFT Record Analysis with MFTECmd
# Extract $MFT from forensic image using KAPE or FTK Imager
# Parse the $MFT with MFTECmd
MFTECmd.exe -f "C:\Evidence\$MFT" --csv C:\Output --csvf mft_full.csv
# Filter for deleted files (InUse = FALSE) in Timeline Explorer
# Look for entries where InUse column is False
**Identifying Deleted Files in CSV Output:**
- `InUse` = False indicates a deleted or reallocated record
- `ParentPath` shows original file location before deletion
- `FileSize` shows the original size (may still be recoverable)
- Timestamps in `$STANDARD_INFORMATION` and `$FILE_NAME` attributes persist
Technique 2: USN Journal ($UsnJrnl:$J) Analysis
The USN Journal records all changes to files on an NTFS volume, including creation, deletion, rename, and data modification events.
# Parse USN Journal with MFTECmd
MFTECmd.exe -f "C:\Evidence\$J" --csv C:\Output --csvf usn_journal.csv
# Key USN reason codes for deletion evidence:
# USN_REASON_FILE_DELETE = 0x00000200
# USN_REASON_CLOSE = 0x80000000
# USN_REASON_RENAME_OLD_NAME = 0x00001000
# USN_REASON_RENAME_NEW_NAME = 0x00002000
Technique 3: $LogFile Transaction Analysis
The $LogFile stores NTFS transaction records that can reveal file operations even after the USN Journal has been cycled.
# Parse $LogFile with LogFileParser
LogFileParser.exe -l "C:\Evidence\$LogFile" -o C:\Output
# Look for REDO and UNDO operations indicating file deletion:
# - DeallocateFileRecordSegment
# - DeleteAttribute
# - UpdateResidentValue (clearing InUse flag)
Technique 4: MFT Slack Space Analysis
MFT slack space exists between the end of the used portion of an MFT record and the end of the allocated 1024 bytes. This area may contain remnants of previous file records.
import struct
def parse_mft_slack(mft_path: str, output_path: str):
"""Extract and analyze MFT slack space for deleted file remnants."""
with open(mft_path, "rb") as f:
record_size = 1024
record_num = 0
slack_findings = []
while True:
record = f.read(record_size)
if len(record) < record_size:
break
# Verify FILE signature
if record[:4] != b"FILE":
record_num += 1
continueRead more
name: analyzing-mft-for-deleted-file-recovery description: Analyze the NTFS Master File Table ($MFT) with MFTECmd, analyzeMFT, and X-Ways Forensics to recover metadata and content of deleted files by examining MFT record entries, $LogFile, $UsnJrnl, and MFT slack space. Use when recovering evidence of deleted files, reconstructing NTFS file-system timelines, or detecting anti-forensic timestomping during a Windows forensic examination. domain: cybersecurity subdomain: digital-forensics tags: - mft - ntfs - deleted-files - file-recovery - mftecmd - usn-journal - logfile - mft-slack-space - file-system-forensics - dfir version: '1.0' author: mahipal license: Apache-2.0 nist_csf: - RS.AN-03 - DE.AE-02 - RS.MA-01 mitre_attack: - T1070.004 - T1070.006 - T1005
Analyzing MFT for Deleted File Recovery
Overview
The NTFS Master File Table ($MFT) is the central metadata repository for every file and directory on an NTFS volume. Each file is represented by at least one 1024-byte MFT record containing attributes such as $STANDARD_INFORMATION (timestamps, permissions), $FILE_NAME (name, parent directory, timestamps), and $DATA (file content or cluster run pointers). When a file is deleted, its MFT record is marked as inactive (InUse flag cleared) but the metadata remains until the entry is reallocated by a new file. This persistence makes MFT analysis a primary technique for recovering deleted file evidence, reconstructing file system timelines, and detecting anti-forensic activity such as timestomping.
When to Use
- When investigating security incidents that require analyzing mft for deleted file recovery
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Forensic disk image (E01, raw/dd, VMDK, or VHDX format)
- MFTECmd (Eric Zimmerman) or analyzeMFT (Python-based)
- FTK Imager, Arsenal Image Mounter, or similar for image mounting
- Timeline Explorer or Excel for CSV analysis
- Python 3.8+ for custom analysis scripts
- Understanding of NTFS file system internals
MFT Structure and Record Layout
MFT Record Header
Each MFT record begins with the signature "FILE" (0x46494C45) and contains:
| Offset | Size | Field | |--------|------|-------| | 0x00 | 4 bytes | Signature ("FILE") | | 0x04 | 2 bytes | Offset to update sequence | | 0x06 | 2 bytes | Size of update sequence | | 0x08 | 8 bytes | $LogFile sequence number | | 0x10 | 2 bytes | Sequence number | | 0x12 | 2 bytes | Hard link count | | 0x14 | 2 bytes | Offset to first attribute | | 0x16 | 2 bytes | Flags (0x01 = InUse, 0x02 = Directory) | | 0x18 | 4 bytes | Used size of MFT record | | 0x1C | 4 bytes | Allocated size of MFT record | | 0x20 | 8 bytes | Base file record reference | | 0x28 | 2 bytes | Next attribute ID |
Key MFT Attributes
| Type ID | Name | Description | |---------|------|-------------| | 0x10 | $STANDARD_INFORMATION | Timestamps, flags, owner ID, security ID | | 0x30 | $FILE_NAME | Filename, parent MFT reference, timestamps | | 0x40 | $OBJECT_ID | Unique GUID for the file | | 0x50 | $SECURITY_DESCRIPTOR | ACL permissions | | 0x60 | $VOLUME_NAME | Volume label (volume metadata files only) | | 0x80 | $DATA | File content (resident if <700 bytes) or cluster run list | | 0x90 | $INDEX_ROOT | B-tree index root for directories | | 0xA0 | $INDEX_ALLOCATION | B-tree index entries for large directories | | 0xB0 | $BITMAP | Allocation bitmap for index or MFT |
Deleted File Recovery Techniques
Technique 1: MFT Record Analysis with MFTECmd
# Extract $MFT from forensic image using KAPE or FTK Imager # Parse the $MFT with MFTECmd MFTECmd.exe -f "C:\Evidence\$MFT" --csv C:\Output --csvf mft_full.csv # Filter for deleted files (InUse = FALSE) in Timeline Explorer # Look for entries where InUse column is False
**Identifying Deleted Files in CSV Output:**
- `InUse` = False indicates a deleted or reallocated record
- `ParentPath` shows original file location before deletion
- `FileSize` shows the original size (may still be recoverable)
- Timestamps in `$STANDARD_INFORMATION` and `$FILE_NAME` attributes persist
Technique 2: USN Journal ($UsnJrnl:$J) Analysis
The USN Journal records all changes to files on an NTFS volume, including creation, deletion, rename, and data modification events.
# Parse USN Journal with MFTECmd MFTECmd.exe -f "C:\Evidence\$J" --csv C:\Output --csvf usn_journal.csv # Key USN reason codes for deletion evidence: # USN_REASON_FILE_DELETE = 0x00000200 # USN_REASON_CLOSE = 0x80000000 # USN_REASON_RENAME_OLD_NAME = 0x00001000 # USN_REASON_RENAME_NEW_NAME = 0x00002000
Technique 3: $LogFile Transaction Analysis
The $LogFile stores NTFS transaction records that can reveal file operations even after the USN Journal has been cycled.
# Parse $LogFile with LogFileParser LogFileParser.exe -l "C:\Evidence\$LogFile" -o C:\Output # Look for REDO and UNDO operations indicating file deletion: # - DeallocateFileRecordSegment # - DeleteAttribute # - UpdateResidentValue (clearing InUse flag)
Technique 4: MFT Slack Space Analysis
MFT slack space exists between the end of the used portion of an MFT record and the end of the allocated 1024 bytes. This area may contain remnants of previous file records.
import struct
def parse_mft_slack(mft_path: str, output_path: str):
"""Extract and analyze MFT slack space for deleted file remnants."""
with open(mft_path, "rb") as f:
record_size = 1024
record_num = 0
slack_findings = []
while True:
record = f.read(record_size)
if len(record) < record_size:
break
# Verify FILE signature
if record[:4] != b"FILE":
record_num += 1
continue817 structured cybersecurity skills for AI agents · Mapped to 6 frameworks: MITRE ATT&CK, NIST CSF 2.0, MITRE ATLAS, D3FEND, NIST AI RMF & MITRE F3 (Fight Fraud) · agentskills.io standard · Works with Claude Code, GitHub Copilot, Codex CLI, Cursor, Gemini CLI & 20+ platforms · 29 security domains · Apache 2.0
Repo: mukul975/Anthropic-Cybersecurity-Skills
Other skills on cybersecurity-skills.
- /abusing-dpapi-for-credential-access
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket's dpapi.py, including domain-wide decryption via the DPAPI backup key. Use
Open skill - /abusing-shadow-credentials-for-privesc
Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target's NT hash without a password reset. Use when BloodHound shows
Open skill - /achieving-cmmc-level-2-compliance
Prepare a defense-contractor environment for CMMC Level 2 certification: scope CUI and FCI, implement the 110 NIST SP 800-171 Rev 2 security requirements across 14 families, compute the SPRS score with the DoD Assessment Methodology, manage a compliant POA&M, and ready the
Open skill - /acquiring-disk-image-with-dd-and-dcfldd
Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving
Open skill - /analyzing-active-directory-acl-abuse
Detect dangerous ACL misconfigurations in Active Directory using ldap3
Open skill - /analyzing-android-malware-with-apktool
Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and
Open skill

