singtreb/sword-riding/analyzing-mft-for-deleted-file-recovery
Claude Code and agent skill by singtreb/sword-riding
- community
Checking that the SKILL.md file is still in the repository.
Analyze the NTFS Master File Table ($MFT) to recover metadata and content of deleted files by examining MFT record
Install
npx vskill@latest install singtreb/sword-riding/analyzing-mft-for-deleted-file-recoverySKILL.md
The same SKILL.md was published earlier as singtreb/sword-riding/analyzing-mft-for-deleted-file-recovery.
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
Detection Gaps & Validation
- Most-missed artifacts: a single
$MFTparse misses where evidence actually survives - check MFT record slack (remnants of a prior file in the 1024-byte entry), resident$DATAof small deleted files (fully recoverable from the record itself), non-base records reachable via$ATTRIBUTE_LIST, and$MFTMirr. Always also pull$LogFileand$UsnJrnl:$J, which record deletes the MFT alone no longer reflects. - USN journal wrap:
$UsnJrnl:$Jis a sparse, size-capped circular log - older deletions are silently dropped when it wraps, so "not in the USN journal" is not "did not happen." Corroborate with$LogFiletransactions (DeallocateFileRecordSegment) and Volume Shadow Copies of$MFTfor the pre-deletion state. - Timestomping detection ($SI vs $FN):
$STANDARD_INFORMATIONtimes are settable from user mode (SetFileTime), but$FILE_NAMEtimes are kernel-only. An $SI earlier than the $FN, zeroed sub-second (.000000000) precision, or $SI inconsistent with the MFT entry-number ordering implies timestomping - confirm against$LogFile/USN and the record's sequence number. - Validate recoverability before claiming it: a non-InUse record with intact cluster runs is recoverable only if those clusters were not reallocated - verify against
$Bitmapand carve the runs withicat, rather than trusting the recordedFileSizeas proof of content. - Interpretation pitfalls (false positives): archived/copied files and installers legitimately carry old $SI dates; NTFS file tunneling re-applies prior timestamps on recreate; reformat/defrag reorders MFT entries. Confirm volume timezone and clock skew, and cross-check a second artifact (Prefetch, Recycle Bin
$I, Event Logs) before attributing a deletion to a user.
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
Identifying Deleted Files in CSV Output:
InUse= False indicates a deleted or reallocated recordParentPathshows original file location before deletionFileSizeshows the original size (may still be recoverable)- Timestamps in
$STANDARD_INFORMATIONand$FILE_NAMEattributes 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.
Technique 3: $LogFile Transaction Analysis
The $LogFile stores NTFS transaction records that can reveal file operations even after the USN Journal has been cycled.
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.
Correlation with Supporting Artifacts
Cross-Reference MFT with $Recycle.Bin
Cross-Reference MFT with Volume Shadow Copies
Forensic Value
- Deleted file metadata recovery: Original filename, path, size, and timestamps
- Timeline reconstruction: File creation, modification, access, and deletion events
- Timestomping detection: Comparing $SI vs $FN timestamps
- Data carving guidance: MFT cluster runs point to file content on disk
- Anti-forensic detection: Identifying wiped or manipulated MFT records
References
- NTFS MFT Advanced Forensic Analysis: https://www.deaddisk.com/posts/ntfs-mft-advanced-forensic-analysis-guide/
- MFT Slack Space Forensic Value: https://www.sygnia.co/blog/the-forensic-value-of-mft-slack-space/
- MFTECmd Documentation: https://ericzimmerman.github.io/
- SANS FOR500: Windows Forensic Analysis
Example Output
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinginternal/tools/skills/data/digital-forensics/analyzing-mft-for-deleted-file-recovery/SKILL.md
Popularity
- Repository stars
- 3
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/singtreb/sword-riding/analyzing-mft-for-deleted-file-recovery)