AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Apache-2.0 Self-run

Analyzing Mft For Deleted File Recovery

skill-killvxk-cybersecurity-skills-zh-analyzing-mft-for-deleted-file-recovery · by killvxk

通过检查 MFT 记录条目、$LogFile、$UsnJrnl 和 MFT 松弛空间,使用 MFTECmd、analyzeMFT 和 X-Ways Forensics 分析 NTFS 主文件表($MFT)以恢复已删除文件的元数据和内容。

No reviews yet
0 installs
6 views
0.0% view→install

Install

$ agentstack add skill-killvxk-cybersecurity-skills-zh-analyzing-mft-for-deleted-file-recovery

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access Used
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-killvxk-cybersecurity-skills-zh-analyzing-mft-for-deleted-file-recovery)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Analyzing Mft For Deleted File Recovery? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

分析 MFT 用于已删除文件恢复

概述

NTFS 主文件表($MFT)是 NTFS 卷上每个文件和目录的中央元数据存储库。每个文件至少由一条 1024 字节的 MFT 记录表示,其中包含 $STANDARDINFORMATION(时间戳、权限)、$FILENAME(名称、父目录、时间戳)和 $DATA(文件内容或簇运行指针)等属性。文件被删除时,其 MFT 记录被标记为非活动状态(InUse 标志清除),但元数据保留到被新文件的条目覆盖为止。这种持久性使 MFT 分析成为恢复已删除文件证据、重建文件系统时间线以及检测反取证活动(如时间戳篡改)的主要技术。

前置条件

  • 取证磁盘镜像(E01、raw/dd、VMDK 或 VHDX 格式)
  • MFTECmd(Eric Zimmerman 工具)或 analyzeMFT(基于 Python)
  • FTK Imager、Arsenal Image Mounter 或类似工具用于挂载镜像
  • Timeline Explorer 或 Excel 用于 CSV 分析
  • Python 3.8+ 用于自定义分析脚本
  • 了解 NTFS 文件系统内部结构

MFT 结构和记录布局

MFT 记录头部

每条 MFT 记录以签名"FILE"(0x46494C45)开头,包含:

| 偏移量 | 大小 | 字段 | |--------|------|------| | 0x00 | 4 字节 | 签名("FILE") | | 0x04 | 2 字节 | 更新序列偏移量 | | 0x06 | 2 字节 | 更新序列大小 | | 0x08 | 8 字节 | $LogFile 序列号 | | 0x10 | 2 字节 | 序列号 | | 0x12 | 2 字节 | 硬链接计数 | | 0x14 | 2 字节 | 第一个属性偏移量 | | 0x16 | 2 字节 | 标志(0x01 = 使用中,0x02 = 目录) | | 0x18 | 4 字节 | MFT 记录已用大小 | | 0x1C | 4 字节 | MFT 记录已分配大小 | | 0x20 | 8 字节 | 基础文件记录引用 | | 0x28 | 2 字节 | 下一个属性 ID |

关键 MFT 属性

| 类型 ID | 名称 | 描述 | |---------|------|------| | 0x10 | $STANDARDINFORMATION | 时间戳、标志、所有者 ID、安全 ID | | 0x30 | $FILENAME | 文件名、父目录 MFT 引用、时间戳 | | 0x40 | $OBJECTID | 文件的唯一 GUID | | 0x50 | $SECURITYDESCRIPTOR | ACL 权限 | | 0x60 | $VOLUMENAME | 卷标(仅卷元数据文件) | | 0x80 | $DATA | 文件内容(小于 700 字节时为驻留型)或簇运行列表 | | 0x90 | $INDEXROOT | 目录的 B 树索引根 | | 0xA0 | $INDEX_ALLOCATION | 大型目录的 B 树索引条目 | | 0xB0 | $BITMAP | 索引或 MFT 的分配位图 |

已删除文件恢复技术

技术 1:使用 MFTECmd 进行 MFT 记录分析

# 使用 KAPE 或 FTK Imager 从取证镜像提取 $MFT
# 使用 MFTECmd 解析 $MFT
MFTECmd.exe -f "C:\Evidence\$MFT" --csv C:\Output --csvf mft_full.csv

# 在 Timeline Explorer 中过滤已删除文件(InUse = FALSE)
# 查找 InUse 列为 False 的条目

在 CSV 输出中识别已删除文件:

  • InUse = False 表示已删除或已重新分配的记录
  • ParentPath 显示删除前的原始文件位置
  • FileSize 显示原始大小(可能仍可恢复)
  • $STANDARD_INFORMATION$FILE_NAME 属性中的时间戳持续存在

技术 2:USN 日志($UsnJrnl:$J)分析

USN 日志记录 NTFS 卷上文件的所有更改,包括创建、删除、重命名和数据修改事件。

# 使用 MFTECmd 解析 USN 日志
MFTECmd.exe -f "C:\Evidence\$J" --csv C:\Output --csvf usn_journal.csv

# 删除证据的关键 USN 原因代码:
# USN_REASON_FILE_DELETE     = 0x00000200
# USN_REASON_CLOSE           = 0x80000000
# USN_REASON_RENAME_OLD_NAME = 0x00001000
# USN_REASON_RENAME_NEW_NAME = 0x00002000

技术 3:$LogFile 事务分析

$LogFile 存储 NTFS 事务记录,即使 USN 日志已循环,也能揭示文件操作。

# 使用 LogFileParser 解析 $LogFile
LogFileParser.exe -l "C:\Evidence\$LogFile" -o C:\Output

# 查找表示文件删除的 REDO 和 UNDO 操作:
# - DeallocateFileRecordSegment(释放文件记录段)
# - DeleteAttribute(删除属性)
# - UpdateResidentValue(清除 InUse 标志)

技术 4:MFT 松弛空间分析

MFT 松弛空间存在于 MFT 记录已用部分末尾和已分配 1024 字节末尾之间。该区域可能包含之前文件记录的残留数据。

import struct

def parse_mft_slack(mft_path: str, output_path: str):
    """提取并分析 MFT 松弛空间中已删除文件的残留数据。"""
    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)  0x20 and c < 0x7F for c in slack[:50]):
                    slack_findings.append({
                        "record": record_num,
                        "used_size": used_size,
                        "slack_size": record_size - used_size,
                        "slack_preview": slack[:100].hex()
                    })

            record_num += 1

    return slack_findings

与支持性痕迹的关联

与 $Recycle.Bin 交叉引用

# 使用 RBCmd 解析回收站
RBCmd.exe -d "C:\Evidence\$Recycle.Bin" --csv C:\Output --csvf recycle_bin.csv

# 关联: $I 文件包含原始路径和删除时间戳
# 将 $R 文件中的 MFT 条目号匹配回原始 MFT 记录

与卷影副本交叉引用

# 列出卷影副本
vssadmin list shadows

# 挂载卷影副本并从每个副本提取 $MFT
# 比较不同卷影副本中的 MFT 记录以追踪文件随时间的变化

取证价值

  • 已删除文件元数据恢复:原始文件名、路径、大小和时间戳
  • 时间线重建:文件创建、修改、访问和删除事件
  • 时间戳篡改检测:比较 $SI 和 $FN 时间戳
  • 数据雕刻引导:MFT 簇运行指向磁盘上的文件内容
  • 反取证检测:识别被擦除或被篡改的 MFT 记录

参考资料

  • NTFS MFT 高级取证分析: https://www.deaddisk.com/posts/ntfs-mft-advanced-forensic-analysis-guide/
  • MFT 松弛空间的取证价值: https://www.sygnia.co/blog/the-forensic-value-of-mft-slack-space/
  • MFTECmd 文档: https://ericzimmerman.github.io/
  • SANS FOR500: Windows 取证分析

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.