分析 LNK 文件和 Jump List 痕迹 是做什么的?
概述
Windows LNK(快捷方式)文件和 Jump List(跳转列表)是关键的计算机取证痕迹,能够提供文件访问、程序执行和用户行为的证据。当用户通过 Windows 资源管理器或打开/保存对话框打开文件时,LNK 文件会自动创建,并存储目标文件的元数据,包括其原始路径、时间戳、卷序列号、NetBIOS 名称和主机系统的 MAC 地址。Jump List 自 Windows 7 起引入,通过维护每个应用程序最近和常用访问的文件列表来扩展此功能。这些痕迹即使在目标文件被删除后仍然存在,这使得它们在确定用户在特定时间访问了特定文件方面极具价值。
何时使用
- 在调查涉及分析 lnk 文件和 jump list 痕迹的安全事件时
- 在为此领域构建检测规则或威胁狩猎查询时
- 当 SOC 分析师需要此分析类型的结构化流程时
- 在验证相关攻击技术的安全监控覆盖范围时
先决条件
- LECmd(Eric Zimmerman)用于解析 LNK 文件
- JLECmd(Eric Zimmerman)用于解析 Jump List
- Python 3.8+,带有 pylnk3 或 LnkParse3 库
- 来自 Windows 系统的取证镜像或快速收集数据
- Timeline Explorer 用于 CSV 分析
LNK 文件位置
| 位置 | 描述 |
|---|---|
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Recent\ | 最近访问的文件 |
%USERPROFILE%\Desktop\ | 用户创建的快捷方式 |
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\ | 开始菜单快捷方式 |
%USERPROFILE%\AppData\Roaming\Microsoft\Office\Recent\ | Office 最近使用的文档 |
LNK 文件结构
Shell Link 头部(76 字节)
| 偏移量 | 大小 | 字段 |
|---|---|---|
| 0x00 | 4 | HeaderSize(始终为 0x0000004C) |
| 0x04 | 16 | LinkCLSID(始终为 00021401-0000-0000-C000-000000000046) |
| 0x14 | 4 | LinkFlags |
| 0x18 | 4 | FileAttributes |
| 0x1C | 8 | CreationTime(FILETIME) |
| 0x24 | 8 | AccessTime(FILETIME) |
| 0x2C | 8 | WriteTime(FILETIME) |
| 0x34 | 4 | 目标文件大小 |
| 0x38 | 4 | IconIndex |
| 0x3C | 4 | ShowCommand |
| 0x40 | 2 | HotKey |
LNK 文件中的关键取证字段
- 目标文件时间戳:引用文件的创建、访问和修改时间
- 卷信息:序列号、驱动器类型、卷标
- 网络共享信息:UNC 路径、共享名称
- 机器标识符:NetBIOS 名称、MAC 地址(来自 TrackerDataBlock)
- 分布式链接跟踪:机器 ID 和对象 GUID
使用 EZ Tools 进行分析
LECmd - LNK 文件解析器
# 解析 Recent 文件夹中的所有 LNK 文件
LECmd.exe -d "C:\Evidence\Users\suspect\AppData\Roaming\Microsoft\Windows\Recent" --csv C:\Output --csvf lnk_analysis.csv
# 解析单个 LNK 文件并显示详细信息
LECmd.exe -f "C:\Evidence\Users\suspect\Desktop\Confidential.docx.lnk" --json C:\Output
# 使用额外详细级别解析 LNK 文件
LECmd.exe -d "C:\Evidence\Users\suspect\AppData\Roaming\Microsoft\Windows\Recent" --csv C:\Output --csvf lnk_all.csv --all
JLECmd - Jump List 解析器
# 解析自动跳转列表
JLECmd.exe -d "C:\Evidence\Users\suspect\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations" --csv C:\Output --csvf jumplists_auto.csv
# 解析自定义跳转列表
JLECmd.exe -d "C:\Evidence\Users\suspect\AppData\Roaming\Microsoft\Windows\Recent\CustomDestinations" --csv C:\Output --csvf jumplists_custom.csv
# 解析所有跳转列表并显示详细输出
JLECmd.exe -d "C:\Evidence\Users\suspect\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations" --csv C:\Output --csvf jumplists_auto.csv --ld
Jump List 结构
自动跳转列表(automaticDestinations-ms)
这些是 OLE 复合文件(结构化存储),通过文件名中的 AppID 哈希标识:
| AppID 哈希 | 应用程序 |
|---|---|
| 5f7b5f1e01b83767 | Windows 资源管理器已固定/常用 |
| 1b4dd67f29cb1962 | Windows 资源管理器最近使用 |
| 9b9cdc69c1c24e2b | 记事本 |
| a7bd71699cd38d1c | Notepad++ |
| 12dc1ea8e34b5a6 | Microsoft 画图 |
| 7e4dca80246863e3 | 控制面板 |
| 1cf97c38a5881255 | Microsoft Edge |
| f01b4d95cf55d32a | Windows 资源管理器 |
| 9d1f905ce5044aee | Microsoft Excel |
| a4a5324453625195 | Microsoft Word |
| d00655d2aa12ff6d | Microsoft PowerPoint |
| bc03160ee1a59fc1 | Outlook |
自定义跳转列表(customDestinations-ms)
当用户将项目固定到应用程序跳转列表时创建。这些文件包含连续的 LNK 条目。
Python 分析脚本
import struct
import os
from datetime import datetime, timedelta
FILETIME_EPOCH = datetime(1601, 1, 1)
def filetime_to_datetime(filetime_bytes: bytes) -> datetime:
"""将 Windows FILETIME(自 1601 年以来的 100 纳秒间隔)转换为日期时间。"""
ft = struct.unpack("<Q", filetime_bytes)[0]
if ft == 0:
return None
return FILETIME_EPOCH + timedelta(microseconds=ft // 10)
def parse_lnk_header(lnk_path: str) -> dict:
"""从 LNK 文件解析 Shell Link 头部。"""
with open(lnk_path, "rb") as f:
header = f.read(76)
header_size = struct.unpack("<I", header[0:4])[0]
if header_size != 0x4C:
return {"error": "无效的 LNK 头部"}
link_flags = struct.unpack("<I", header[0x14:0x18])[0]
file_attrs = struct.unpack("<I", header[0x18:0x1C])[0]
result = {
"header_size": header_size,
"link_flags": hex(link_flags),
"file_attributes": hex(file_attrs),
"creation_time": filetime_to_datetime(header[0x1C:0x24]),
"access_time": filetime_to_datetime(header[0x24:0x2C]),
"write_time": filetime_to_datetime(header[0x2C:0x34]),
"file_size": struct.unpack("<I", header[0x34:0x38])[0],
"has_target_id_list": bool(link_flags & 0x01),
"has_link_info": bool(link_flags & 0x02),
"has_name": bool(link_flags & 0x04),
"has_relative_path": bool(link_flags & 0x08),
"has_working_dir": bool(link_flags & 0x10),
"has_arguments": bool(link_flags & 0x20),
"has_icon_location": bool(link_flags & 0x40),
}
return result
调查用例
文件访问证据
- 解析 Recent 文件夹中的 LNK 文件以识别访问过的文档
- 与 MFT 时间戳和 USN 日志条目交叉引用
- 注意:即使目标文件被删除,LNK 文件仍然存在
可移动介质访问
- 引用驱动器号 E:、F:、G: 的 LNK 文件表示使用了可移动介质
- LNK 中的卷序列号标识特定设备
- TrackerDataBlock 中的 MAC 地址标识源机器
网络共享活动
- 包含 UNC 路径(\server\share)的 LNK 文件表示网络文件访问
- NetBIOS 名称标识远程服务器
- 时间戳确定访问发生的时间
Windows 10 和 Windows 11 之间的差异
最近的研究(IEEE 2025)表明,Windows 11 产生不同的 LNK 和 Jump List 痕迹:
- 为某些文件类型生成的自动 LNK 文件更少
- 修改了现代应用程序的 Jump List 行为
- UWP/MSIX 应用程序可能不会生成传统的 Jump List
- Windows 11 快速访问取代了部分最近使用的功能
参考
- Shell Link 二进制文件格式:https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-shllink/
- Magnet Forensics LNK 分析:https://www.magnetforensics.com/blog/forensic-analysis-of-lnk-files/
- Jump List 取证 2025:https://www.cybertriage.com/blog/jump-list-forensics-2025/
- Eric Zimmerman 的 LECmd/JLECmd:https://ericzimmerman.github.io/
示例输出
$ LECmd.exe -d "C:\Evidence\Users\jsmith\AppData\Roaming\Microsoft\Windows\Recent" --csv /analysis/lnk_output
LECmd v1.11.0 - LNK 文件解析器
================================
正在处理 47 个 LNK 文件...
--- LNK 文件: Q4_Report.xlsx.lnk ---
源文件: C:\Evidence\Users\jsmith\Recent\Q4_Report.xlsx.lnk
目标路径: C:\Users\jsmith\Downloads\Q4_Report.xlsm
目标创建时间: 2024-01-15 14:33:45 UTC
目标修改时间: 2024-01-15 14:33:45 UTC
目标访问时间: 2024-01-15 14:35:12 UTC
文件大小: 251,904 字节
驱动器类型: 本地 (C:)
卷序列号: A4E7-3F21
机器 ID: DESKTOP-J5M1TH
MAC 地址: 48:2A:E3:5C:9B:01
--- LNK 文件: update_client.exe.lnk ---
源文件: C:\Evidence\Users\jsmith\Recent\update_client.exe.lnk
目标路径: C:\ProgramData\Updates\update_client.exe
目标创建时间: 2024-01-15 14:34:02 UTC
目标修改时间: 2024-01-15 14:34:02 UTC
目标访问时间: 2024-01-15 14:36:30 UTC
文件大小: 1,258,496 字节
驱动器类型: 本地 (C:)
卷序列号: A4E7-3F21
机器 ID: DESKTOP-J5M1TH
工作目录: C:\ProgramData\Updates
参数: --silent --no-update-check
运行窗口: 隐藏
======================================================================
$ JLECmd.exe -d "C:\Evidence\Users\jsmith\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations" --csv /analysis/jumplist_output
JLECmd v1.5.0 - Jump List 解析器
==================================
正在处理 23 个 AutomaticDestinations 文件...
--- 应用程序: Microsoft Excel (AppID: 12dc1ea8e34b5a6) ---
条目数: 15
最近使用:
条目 0: C:\Users\jsmith\Downloads\Q4_Report.xlsm (2024-01-15 14:35:12 UTC)
条目 1: \\FILESERV01\Finance\Budget_2024.xlsx (2024-01-14 09:22:30 UTC)
条目 2: C:\Users\jsmith\Documents\Expenses\Dec2023.xlsx (2024-01-10 16:45:00 UTC)
--- 应用程序: Windows 资源管理器 (AppID: f01b4d95cf55d32a) ---
条目数: 28
最近使用:
条目 0: C:\ProgramData\Updates\ (2024-01-15 14:36:25 UTC)
条目 1: E:\Backup\ (2024-01-15 15:30:00 UTC)
条目 2: \\FILESERV01\HR\Employees\ (2024-01-15 16:12:45 UTC)
--- 应用程序: cmd.exe (AppID: 9b9cdc69c1c24e2b) ---
条目数: 5
最近使用:
条目 0: C:\Windows\System32\cmd.exe (2024-01-15 14:36:00 UTC)
总结:
处理的 LNK 文件总数: 47
Jump List 条目总数: 156
可疑痕迹: 3(隐藏窗口执行、USB 驱动器访问、网络共享)
CSV 导出到: /analysis/lnk_output/ 和 /analysis/jumplist_output/