分析 LNK 檔案與跳躍清單成品 是做什麼的?
概述
Windows LNK(捷徑)檔案與跳躍清單(Jump List)是關鍵的取證成品,能提供檔案存取、程式執行與使用者行為的證據。當使用者透過 Windows 檔案總管或開啟/儲存對話框開啟檔案時,系統會自動建立 LNK 檔案,其中儲存目標檔案的原始路徑、時間戳記、磁碟區序號、NetBIOS 名稱與主機 MAC 位址等中繼資料。跳躍清單自 Windows 7 起導入,可維護每個應用程式最近與頻繁存取的檔案清單。這些成品即使目標檔案已被刪除仍會留存,對於證明使用者在特定時間存取過特定檔案極具價值。
使用時機
- 調查需要分析 LNK 檔案與跳躍清單成品的安全事件時
- 建立針對此領域的偵測規則或威脅狩獵查詢時
- SOC 分析師需要此類分析的結構化程序時
- 驗證相關攻擊技術的安全監控覆蓋範圍時
先決條件
- LECmd(Eric Zimmerman)用於 LNK 檔案解析
- JLECmd(Eric Zimmerman)用於跳躍清單解析
- Python 3.8+ 搭配 pylnk3 或 LnkParse3 函式庫
- 來自 Windows 系統的鑑識映像或 triage 收集
- 用於 CSV 分析的 Timeline Explorer
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 - 跳躍清單解析器
# 解析自動跳躍清單(Automatic Jump Lists)
JLECmd.exe -d "C:\Evidence\Users\suspect\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations" --csv C:\Output --csvf jumplists_auto.csv
# 解析自訂跳躍清單(Custom Jump Lists)
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
跳躍清單結構
自動目的地(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 奈秒間隔)轉換為 datetime。"""
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 與跳躍清單成品有所不同:
- 針對某些檔案類型自動產生的 LNK 檔案較少
- 現代應用程式的跳躍清單行為有所修改
- UWP/MSIX 應用程式可能不會產生傳統的跳躍清單
- 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/
- 跳躍清單鑑識 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 - 跳躍清單解析器
==================================
正在處理 23 個自動目的地檔案...
--- 應用程式: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
跳躍清單條目總數: 156
可疑成品數量: 3(隱藏視窗執行、USB 隨身碟存取、網路分享)
CSV 匯出至: /analysis/lnk_output/ 和 /analysis/jumplist_output/