with one click
CTF 逆向工程解題工具箱 — 聚焦 Windows 應用程式驗證繞過。從開題偵察到 bypass 驗證的完整流程引導,內建實戰踩坑經驗。
npx skills add https://github.com/KerberosClaw/kc_ai_skills --skill ctf-kitCopy and paste this command into Claude Code to install the skill
CTF 逆向工程解題工具箱 — 聚焦 Windows 應用程式驗證繞過。從開題偵察到 bypass 驗證的完整流程引導,內建實戰踩坑經驗。
npx skills add https://github.com/KerberosClaw/kc_ai_skills --skill ctf-kitCopy and paste this command into Claude Code to install the skill
Use when the user wants to build a consistent-identity LoRA for an original character — defining the character, generating a face/body-consistent multi-angle dataset (via the gpt-image-gen skill for codex image generation), captioning it, doing base-specific homework, training on a chosen base (Pony / Z-Image / others) on a local GPU, and producing a usable LoRA. This skill ORCHESTRATES the end-to-end pipeline and gates every expensive/irreversible step; it delegates actual image generation to gpt-image-gen and never improvises training settings from memory.
Use when the user asks to generate an image via GPT/Codex (e.g. 「叫 gpt 生圖」「幫我用 gpt 生圖」「gpt 畫一個 X」). The skill drafts a Chinese + English prompt pair, iterates with the user until they explicitly approve, then dispatches Codex CLI ($imagegen skill, codex built-in image_gen) in the background, monitors progress, converts the result to a jpg in the current working directory, and writes a sidecar prompt log. Does text-to-image AND img2img — drop a reference image (on-disk file) and it runs Codex `-i` to lock a face/character across scenes.
Convert a Markdown report into a presentation-quality .pptx via interactive design decisions + hand-coded build script. Use when user says '/md2ppt', 'markdown to pptx', 'make slides from this md', '簡報', '做投影片', or similar. Optional self-check loop: if LibreOffice available, renders pptx → PNG per slide and checks for overflow / tiny font / emoji / misaligned content before user review. NOT a generic auto-converter — drives a per-slide layout dialogue then emits a reusable build script. Brand-template integration is supported as ad-hoc primitives (helpers exist) but is intentionally not a prescribed workflow — every brand template differs and is best handled by direct LLM-user dialogue.
Use when the user attended one or more sessions of a conference (with audio recordings + slide photos) and needs help building (1) faithful per-session reconstructions in markdown (slide visuals + speaker transcript with Whisper hallucination annotations), and (2) a downstream report deliverable whose scope and format are decided interactively with the user. Pipeline phase (raw → mlx_whisper Chinese SRT → per-slide multimodal reconstruction → official agenda cross-check via Playwright if available) is deterministic. Report phase is interactive — always quiz user on scope (single-session / single-day / multi-day synthesis), format (existing template / free-form fallback), recipient (formal / informal), and any business workstream mapping before drafting.
Use when the user wants to lint a repo following the Karpathy LLM Wiki pattern (raw/ + wiki/ + SCHEMA.md / index.md / log.md). The skill detects path, scans wiki pages + schema layer, reports frontmatter gaps, source traceability breaks, stale claims, orphan pages, missing topics, data gaps, cross-page contradictions, and SCHEMA-vs-reality drift. Read-only — never auto-fixes, never writes to log.md, never touches the network.
Use when the user wants to lint a Claude Code memory directory (~/.claude/memory or custom path) for index inconsistency, stale project state, duplicate / conflicting feedback rules, naming convention violations, frontmatter gaps, and oversized files. The skill detects path, scans root-level *.md, reports findings by severity. Read-only — never auto-fixes, never deletes, never merges.
| name | ctf-kit |
| description | CTF 逆向工程解題工具箱 — 聚焦 Windows 應用程式驗證繞過。從開題偵察到 bypass 驗證的完整流程引導,內建實戰踩坑經驗。 |
| version | 0.3.0 |
| triggers | ["ctf","reverse","bypass","crack","逆向","繞過驗證","破解"] |
| license | MIT |
| compatibility | Requires filesystem-based agent (Claude Code or similar) with bash, Python 3. Windows dynamic analysis environment (physical or VM) recommended. |
| allowed-tools | Bash Read Write Edit Glob Grep Task WebFetch WebSearch Skill |
| metadata | {"user-invocable":"true","argument-hint":"[challenge-file] [phase]"} |
Windows 應用程式驗證繞過的實戰 playbook。 適用於各種保護殼(VMP、Themida、自製殼等)和驗證方式(網路驗證、本地驗證、混合驗證)。
本 skill 適用於:
不適用時的導向:
本 skill 聚焦 Windows 驗證繞過。超出範圍的題目,建議使用 ljagiello/ctf-skills——一套覆蓋更廣的 CTF skill 集合(reverse、web、crypto、pwn、forensics、OSINT 等)。
| 狀況 | 建議 | ctf-skills 中的對應 skill |
|---|---|---|
| Linux ELF / Android APK / WASM | 更廣泛的逆向分析 | ctf-reverse |
| .NET 程式 | dnSpy 反編譯為主 | ctf-reverse |
| 純 flag checker(無網路、無殼) | angr / symbolic execution | ctf-reverse |
| Web 應用 | XSS、SQLi、SSTI 等 | ctf-web |
| 不確定分類 | 先做 triage 再分流 | solve-challenge |
| Crypto / Pwn / Forensics | 本 skill 不覆蓋 | ctf-crypto / ctf-pwn / ctf-forensics |
如果你的環境已安裝 ctf-skills,可以直接用 /ctf-reverse、/solve-challenge 等指令。
未安裝時,請參考該 repo 的 README 安裝:
# 將 ctf-skills 的 skill 加入 Claude Code
# 參考 https://github.com/ljagiello/ctf-skills 的安裝說明
/ctf-kit challenge.exe # 開題:從 Phase 0 開始
/ctf-kit # 繼續上次進度
/ctf-kit recon # 跳到偵察階段
/ctf-kit bypass # 跳到繞過階段
這些準則適用於所有 Windows 驗證繞過場景,不限於特定保護殼。 技術會因目標不同而變,但思維方式不會。
拿到題目後第一件事不是分析 binary,而是搞清楚目標是什麼。
□ 目標是什麼?(找 flag?bypass 認證進主畫面?取得特定資料?)
□ 目標「不是」什麼?(不要搜 flag 如果目標是 bypass;不要提議用真 key 如果目標是繞過驗證)
□ 有時效性限制嗎?(server 在線時間、key 有效期)
每提出一個方案前,問自己:「這個方案達成了目標嗎?」
不要說「可能是」「也許因為」然後就開始動手。
錯誤流程:觀察現象 → 猜測原因 → 嘗試修復 → 失敗 → 猜另一個原因
正確流程:觀察現象 → 設計最小驗證實驗 → 取得資料 → 基於資料決策
每次提出方案前,必須先檢查失敗記錄。
如果專案有 failed_methods 記錄,提方案前必須讀取並對照。如果新方案跟任何已失敗方法有相似邏輯,必須明確指出差異在哪裡,為什麼這次會不同。
參見 docs/failure-patterns.md 了解常見失敗模式。
錯誤流程:靜態看一點 → 跑動態 → 發現不夠 → 回靜態 → 再跑動態(反覆 10 次)
正確流程:靜態分析做到沒東西可挖 → 一次規劃所有動態實驗 → 批量執行
動態測試消耗資源(時間、key、server 額度、使用者操作),靜態分析不消耗。每次動態測試都需要使用者配合,來回一次 10-15 分鐘。
分析函數依賴時,必須遞迴追蹤每個呼叫目標的完整呼叫鏈。一個函數看起來「參數齊全可 stub」,但它內部可能回呼其他受保護的函數。
⚠️ 不在 host 上做的事:
- Raw socket capture(可能 hang 整個系統)
- 認證過程中 attach debugger
- 任何可能觸發反除錯的操作
- 未知行為的程式首次執行
✅ 只在 VM 裡做的事:
- Debugger attach、記憶體注入
- 可能觸發反調試的操作
卡住了?
│
├─ 1. 停下來,不要繼續同方向硬撞(一個方法最多試 3 個變體)
│
├─ 2. 查 failure-patterns.md — 是不是踩了已知的坑?
│
├─ 3. 上網搜尋 — 有沒有類似保護殼/驗證系統的公開破解案例?
│ └─ "[殼名稱] bypass/crack/keygen"
│ └─ 中文論壇:吾爱破解、看雪、52pojie
│ └─ GitHub:殼名稱 + "unpack/devirtualize"
│
├─ 4. 換攻擊層級 — 加密層打不穿就往上走
│ └─ 加密層:封包內容、加密演算法、key material
│ └─ 決策層:認證結果判斷(if/else)、UI 建立
│ └─ 結果層:直接 patch 跳過判斷
│
├─ 5. 換工具 — 工具不是目的,解題才是
│
└─ 6. 15 分鐘沒進展就停 — 回到步驟 2
□ 讀過失敗記錄了嗎?新方案跟已失敗方法有無相似?
□ 方案的先決條件都滿足嗎?(不需要真 key?不需要 server 在線?)
□ 方案達成了目標嗎?
□ 不確定的部分有查過資料嗎?
□ 有具體的驗證步驟嗎?(不是「試試看」)
□ 目標 binary 在哪裡?目標是什麼?
□ 靜態分析和動態測試是同一台機器嗎?
□ 動態環境:Windows?管理員權限?VM 還是 host?
□ 有 Python?有 Frida?
□ 題目有提示嗎?有時效性資源嗎?
□ 有沒有已經做過的分析?
□ 專案目錄有 CLAUDE.md 嗎?(沒有就建立,見下方)
專案初始化:CLAUDE.md
進入專案時,如果專案目錄沒有 CLAUDE.md,必須立即建立,內容至少包含:
## 記憶管理
專案記憶存放在本專案資料夾的 ./memory/ 中,請從該資料夾讀寫記憶,不要使用預設的 ~/.claude/projects/ 路徑。
## 工作目錄
所有操作產出(script、測試、工具、文件等)一律放在 `./workspace/` 資料夾中。包含但不限於:.py, .txt, .bin, .sh, .c, .exe, .md 等。
**例外**:
- `CLAUDE.md` — 放專案根目錄
- `memory/` — 放專案根目錄
同時建立 memory/ 和 workspace/ 資料夾。如果已有 CLAUDE.md,檢查是否包含上述兩條規則,缺少就補上。
目標:不執行程式,盡可能了解一切。
1.1 基本資訊
用 scripts/pe_info.py 解析(不依賴外部套件):
python pe_info.py target.exe # 基本分析
python pe_info.py target.exe --strings # 加字串搜尋(IP、URL、配置檔等)
python pe_info.py target.exe --gbk "任意中文" # 搜尋 GBK 編碼的中文字串
python pe_info.py target.exe --json # JSON 輸出(給其他腳本接力)
輸出包含:Architecture、ImageBase、Entry Point、ASLR/DEP、Manifest、 Section 列表 + entropy + 保護殼判斷、Import 分析 + 攻擊面提示。
--gbk 用來搜尋簡體中文程式裡的任意關鍵字(驗證訊息、錯誤提示、功能名稱等),
幫助定位認證邏輯在 binary 中的位置。
1.2 Section 分析
列出所有 section:名稱、VA、大小、entropy。
| 特徵 | 判斷 |
|---|---|
.vmp .svmp + entropy ~8.0 | VMProtect → 見 docs/vmp-guide.md |
.upx0 .upx1 | UPX → upx -d 脫殼 → 重新分析 |
.themida | Themida/WinLicense |
.text RawSize = 0 | 殼搬移了程式碼 |
| Entry Point 不在 .text | 殼的 loader 先跑 |
| .rdata 裡有 MZ header | 內嵌 payload |
1.3 Import 分析
| Import | 意義 | 攻擊面 |
|---|---|---|
| WS2_32.dll (send/recv/connect) | 網路驗證 | hook connect 找 server |
| lstrcmpA / CompareStringA | 本地字串比對 | hook 看比較內容 |
| GetProcAddress | 動態解析 | 需要 runtime hook |
| CryptDecrypt / BCrypt* | 加密 | hook 看明文 |
| MessageBoxA/W | 錯誤訊息 | hook backtrace 找決策點 |
| CreateWindowExA/W | 建立視窗 | 最重要 — 主視窗建立 = bypass 成功 |
1.4 字串搜尋
搜尋:驗證結果字串、IP/domain/URL、配置檔路徑、Window class/title、保護殼特徵。
中文程式依 locale 可能用 GBK(簡體)或 Big5(繁體)編碼:
python pe_info.py target.exe --gbk "关键字" # 簡體
python pe_info.py target.exe --big5 "關鍵字" # 繁體
不確定編碼時三種都搜(見速查表)。
1.5 識別保護殼和驗證框架 → 立刻上網搜尋
搜尋策略:
1. "[殼名稱] bypass/crack" — 找已知繞過方法
2. "[殼名稱] [版本] unpack" — 找脫殼工具
3. 中文論壇(吾爱破解、看雪、52pojie)— 中文程式的殼通常中文社群有解
4. GitHub "[殼名稱]" — 找自動化工具
5. 商業驗證框架 — 搜尋已知弱點和超級密碼
1.6 路線判斷
保護殼?
├─ UPX → upx -d → 重新分析
├─ VMProtect → 不脫殼,API 邊界攻擊 → 載入 docs/vmp-guide.md
├─ Themida → 搜尋版本對應的脫殼工具,或 API 邊界攻擊
├─ 自製殼 → 分析 loader 邏輯
├─ 無殼 → Ghidra 反編譯
└─ 不確定 → 上網搜尋 section 名稱
驗證類型?
├─ 網路驗證(有 WS2_32)→ 優先攻擊決策層,不攻擊加密層
├─ 本地驗證(有 strcmp 等)→ hook 比較函數
├─ 時間驗證(GetSystemTime / GetLocalTime)→ hook 時間 API
└─ 混合 → 先確認哪個是主驗證
開發框架?
├─ 易語言 (EPL) → MFC 底層,UI 用 Win32 API
├─ .NET → dnSpy,本 skill 不太適用
├─ Delphi → IDR + x32dbg
└─ 標準 C/C++ → Ghidra
產出: 靜態分析報告 + 判斷路線。跨機器時打包交接包。
原則:先輕量觀察,再精準 hook,不要一上來就全面注入。
2.1 輕量觀察(零工具)
直接跑一次:看 UI、netstat -an 看連線、看配置檔、記錄錯誤訊息。
2.2 Frida 被動偵察
frida -l scripts/recon.js -f challenge.exe # spawn
frida -l scripts/recon.js -p <PID> # attach
frida -l scripts/recon.js -f challenge.exe --no-pause # spawn + 自動 resume
scripts/recon.js 預設啟用:Network、CreateWindowEx、MessageBox、Strcmp。 其他模組(Crypto、File、Registry、Time、MemScan)透過腳本開頭的 ENABLE 開關控制。
Hook 目標:
connect → IP:portsend/recv → 封包大小、輪數、RetAddr(不修改內容)CreateWindowExA/W → 視窗建立 + 完整 backtrace(最重要)MessageBoxA/W → 錯誤訊息 + backtracelstrcmpA / CompareStringA → 比較內容(本地驗證時)Differential trace(跑兩次做 diff):
2.3 如果 Frida 被偵測
| 順序 | 方法 | 原理 |
|---|---|---|
| 1 | Frida Gadget mode | DLL sideload,繞過 frida-server 偵測 |
| 2 | TitanHide kernel driver | kernel 層隱藏 debug 資訊 |
| 3 | Hook 偵測函數 | 攔截 strstr("frida")、NtQueryInformationProcess |
| 4 | x32dbg + ScyllaHide | 傳統 debugger |
| 5 | 自製 C debugger | 最低調,hardware breakpoint |
監看數值時優先用 Stalker 而非 INT3 斷點。 Stalker 用 dynamic binary instrumentation(動態改寫 code 到 slab),不插入 0xCC、不設 debug register,比 INT3 更不容易搞掛目標進程。詳見 docs/tools-quickref.md。
遇到特定保護殼的反調試問題,見對應指南(如 docs/vmp-guide.md)。
原則:從決策層開始,不要從加密層開始。
路線選擇:
有 CreateWindowExA 的 backtrace? → 路線 A(最高成功率)
有錯誤訊息的 backtrace? → 路線 B
有字串比較(strcmp)的 hook 結果? → 路線 C-local
都沒有? → 路線 C(搜尋字串交叉引用)
路線 A:從 CreateWindowExA backtrace 找決策點(首選)
74/75/0F 84/0F 85)Memory.patchCode → NOP 或反轉路線 B:從錯誤訊息往回追
路線 C-local:本地驗證 — hook 比較函數
路線 C:搜尋字串交叉引用
路線 D:網路驗證的協議層攻擊
⚠️ 只有在加密可破時才值得嘗試。Session-bound 加密直接放棄這條路。
路線 E:Binary patch(runtime patch 驗證成功後)
| 原始 | Patch 後 | 效果 |
|---|---|---|
75 XX (JNE short) | 74 XX / EB XX / 90 90 | 反轉 / 無條件跳 / 移除 |
74 XX (JE short) | 75 XX / EB XX / 90 90 | 反轉 / 無條件跳 / 移除 |
0F 85 XX XX XX XX (JNE near) | 0F 84 / E9 XX XX XX XX 90 / 90x6 | 反轉 / 無條件跳 / 移除 |
0F 84 XX XX XX XX (JE near) | 0F 85 / E9 XX XX XX XX 90 / 90x6 | 反轉 / 無條件跳 / 移除 |
| 目的 | Patch |
|---|---|
| 永遠返回 0 | 33 C0 C3 (xor eax,eax; ret) |
| 永遠返回 1 | 33 C0 40 C3 (xor eax,eax; inc eax; ret) |
| 跳過函數 | C3 (ret) |
file_offset = RVA - section_VA + section_file_offset
RVA = runtime_VA - ImageBase
中文程式在 binary 裡的字串編碼取決於開發環境的 locale:
用 pe_info.py --gbk 或 --big5 搜尋,或手動轉換:
# Python one-liner:任意中文轉指定編碼的 hex
python3 -c "print(' '.join(f'{b:02X}' for b in '你要搜的字'.encode('gbk')))"
python3 -c "print(' '.join(f'{b:02X}' for b in '你要搜的字'.encode('big5')))"
python3 -c "print(' '.join(f'{b:02X}' for b in '你要搜的字'.encode('utf-8')))"
如何判斷目標用哪種編碼:
| 工具 | 用途 | 安裝 |
|---|---|---|
| Frida | 動態 hook、API 攔截、記憶體 patch | pip install frida-tools |
| Python 3 | 腳本、PE 分析、binary patch | 內建或下載 |
| 工具 | 用途 | 何時需要 |
|---|---|---|
| Ghidra | 靜態反編譯 | 無殼或脫殼後的深度分析 |
| x32dbg/x64dbg | 傳統 debugger | Frida 被擋時 |
| LIEF | PE 結構修改 | 需要改 PE 結構時 |
| ScyllaHide | x64dbg 反反調試 | 保護殼偵測 debugger 時 |
| TitanHide | Kernel 層反反調試 | 保護殼用 direct syscall 時 |
| dnSpy | .NET 反編譯 | .NET 程式 |
| tshark | 命令行抓包 | 網路驗證協議分析 |
$ARGUMENTS