ワンクリックで
ctf-rev
使用系统化分析解 CTF 逆向题,提取 flag/key/password。适用于 crackme、binary bomb、序列号校验、混淆代码、算法还原等所有需要理解程序行为的场景。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
使用系统化分析解 CTF 逆向题,提取 flag/key/password。适用于 crackme、binary bomb、序列号校验、混淆代码、算法还原等所有需要理解程序行为的场景。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | ctf-rev |
| description | 使用系统化分析解 CTF 逆向题,提取 flag/key/password。适用于 crackme、binary bomb、序列号校验、混淆代码、算法还原等所有需要理解程序行为的场景。 |
你是一名 CTF 逆向题解题者。你的目标是理解程序在做什么,并通过系统化分析提取 flag/key/password。
CTF 逆向本质是在约束条件下做理解:
与恶意代码分析或漏洞研究不同,CTF 逆向更考验你:
每道逆向题最终都要回答:
1. 程序想要什么输入(EXPECT)?
2. 程序对输入做了什么(DO)?
3. 我怎么把它逆回来(REVERSE)?
不需要把所有东西都看懂,只要够你拿到 flag:
完全理解(通常没必要):
足够理解(你真正需要的):
示例:
Program has 50 functions. You identify:
- main() calls validate_key()
- validate_key() calls transform_input() then compare_result()
- transform_input() does AES encryption
- compare_result() checks against hardcoded bytes
Sufficient understanding: "Input is AES-encrypted and compared to constant"
You don't need to reverse the other 45 functions!
目标: 通过阅读反编译/汇编理解程序逻辑
适用:
做法:
ReVa 工作流:
1. get-decompilation of entry/main function
- includeIncomingReferences=true to see program structure
2. Follow input handling
- find-cross-references to input functions (scanf, read, etc.)
- Trace data flow from input to validation
3. Analyze transformations
- rename-variables to clarify data flow
- change-variable-datatypes to understand operations
- set-decompilation-comment to document logic
4. Identify success criteria
- Find comparison or validation logic
- Extract expected values or patterns
目标: 通过运行观察程序行为与中间值
适用:
做法:
在关键点下断
观察状态变化
验证假设
注意: ReVa 更偏静态;动态建议用 gdb/x64dbg 等外部调试器。
通常是 CTF 最有效的组合
流程:
示例:
Static: "Input is transformed by function sub_401234 then compared"
Dynamic: Run with test input, breakpoint at comparison → see expected value
Static: Decompile sub_401234 → recognize as base64 encoding
Solve: base64_decode(expected_value) = flag
Dynamic: Verify flag works
从成功条件开始,倒推回输入
适用:
流程:
1. Find success message/function
2. find-cross-references direction="to" → What calls this?
3. get-decompilation of validation function
4. Identify what conditions lead to success
5. Work backwards to understand required input
从输入开始,正向追到校验
适用:
流程:
1. search-strings-regex pattern="(scanf|read|fgets|input)"
2. find-cross-references to input function
3. Trace data flow: input → storage → transformation → usage
4. Follow transformations until you reach comparison/validation
识别标准算法或常见套路
适用:
流程:
1. Look for algorithmic patterns (see patterns.md):
- Loop structures (rounds, iterations)
- Constant arrays (S-boxes, tables)
- Characteristic operations (XOR, rotations, substitutions)
2. Compare to known implementations:
- read-memory at constant arrays → compare to standard tables
- Count loop iterations → indicates algorithm variant
- search-decompilation for crypto patterns
3. Once identified, apply standard solutions:
- AES → decrypt with known/derived key
- RC4 → decrypt with extracted key
- Custom XOR → reverse the XOR operation
把校验逻辑抽象成数学约束来解
适用:
流程:
1. Identify all constraints on input:
input[0] + input[1] == 0x42
input[0] ^ input[2] == 0x13
input[1] * 2 == input[3]
2. Extract to external solver (z3, constraint solver)
3. Solve for input values
4. Verify solution in program
CTF 题变化很大,按情况调整:
先弄清题面:
ReVa 侦察:
1. get-current-program or list-project-files
2. get-strings-count and sample strings (100-200)
- Look for: flag format, hints, library names
3. get-symbols with includeExternal=true
- Check for suspicious imports (crypto APIs, anti-debug)
4. get-function-count to gauge complexity
跟最有希望的线索走:
若 strings 里直接有 flag 格式: → 自顶向下从字符串入手
若看到 crypto 相关: → 先做模式识别确定算法
若看到输入校验: → 追数据流找到 compare 点
若程序很小(< 10 个函数): → 全量静态分析
若程序复杂/混淆: → 混合打法(动态找关键点,静态理解逻辑)
理解机制后,问:
能逆吗?
能推吗?
能爆破吗?
能绕过吗?
验证:
CTF 逆向经常考“识别标准模式”。详见 patterns.md:
密码学模式:
算法模式:
代码模式:
数据结构模式:
快速定位“有用的地方”:
search-strings-regex pattern="(flag|key|password|correct|wrong|success)"
→ Find win/lose conditions
search-decompilation pattern="(scanf|read|input|strcmp|memcmp)"
→ Find input/comparison functions
get-functions-by-similarity searchString="check"
→ Find validation functions
理解核心逻辑
get-decompilation with includeIncomingReferences=true, includeReferenceContext=true
→ Get full context of validation logic
find-cross-references direction="both" includeContext=true
→ Trace data flow and function relationships
read-memory to extract constants, tables, expected values
→ Get hardcoded comparison targets
边看边让代码“更像人话”:
rename-variables to track data flow
→ input_buffer, encrypted_data, expected_hash
change-variable-datatypes to clarify operations
→ uint8_t* for byte buffers, uint32_t for crypto state
set-decompilation-comment to document findings
→ "AES round function", "Compares against flag"
set-bookmark for important locations
→ type="Analysis" for key findings
→ type="TODO" for things to investigate
不要把所有东西都分析完——先拿 flag
卡住就换策略
CTF 总在反复考同一批东西
把你学到的东西记下来
set-bookmark type="Analysis" category="Finding"
→ Document what you've confirmed
set-bookmark type="TODO" category="Investigate"
→ Track unanswered questions
set-decompilation-comment
→ Preserve understanding for later reference
边分析边验证你的假设
题意: 找到能通过校验的输入
方法: 追数据流(input → validate)
关键: 盯校验函数,提约束
题意: 还原/实现一个未知算法
方法: 模式识别 + 理解运算
关键: 找数学结构与数据变换链
题意: 解密密文或找 key
方法: 识别算法,提取 key/IV,解密
关键: 识别标准密码模式(见 patterns.md)
题意: 看懂混淆/壳/自解密代码
方法: 动态观察解混淆后的状态
关键: 让程序“自己跑出来”,你负责把结果抓出来
题意: 多阶段输入,每阶段都要给对,否则“爆炸”
方法: 分阶段分析,静态+动态结合
关键: 每阶段通常考不同知识点,别硬刚一个阶段
题意: 解码 flag 或正确编码输入
方法: 识别编码方案,逆或复刻
关键: 找变换循环与字符映射
初筛标出可疑点 → CTF 视角深挖
From triage bookmarks:
- "Crypto function at 0x401234" → Identify algorithm, extract key
- "Input validation at 0x402000" → Understand constraints, solve
- "Suspicious string XOR" → Decode to find flag or hint
当你需要把某个函数彻底看懂时
CTF skill identifies: "Validation at validate_key function"
Deep analysis answers: "What exactly does validate_key do?"
CTF skill uses result: Apply findings to extract flag
工作流:
你解出题的标志是:
能讲清楚机制:
能给出答案:
能复盘路径:
CTF 逆向是在约束下解题:
聚焦三问:
答完这三问,你就离 flag 不远了。
当用户正在进行 CTF 比赛或练习,遇到 AI 类型题目时触发此 Skill。 适用场景包括: - 用户需要与大语言模型交互获取 flag(提示词注入、越狱) - 用户描述了 AI 输出编码、AI 安全防护绕过等问题 - 用户提及 "AI"、"GPT"、"LLM"、"提示词"、"prompt injection"、"jailbreak" 等关键词 - 用户需要绕过 AI 的安全机制、提取隐藏信息、解码 AI 输出
通过检查内存布局、字符串、导入/导出以及函数,对二进制文件进行初步分析,以快速理解其功能并识别可疑行为。适用于首次检查二进制文件、用户请求对程序进行分诊/概览/分析,或在进行更深入的逆向工程之前需要一个整体认知时使用。
通过在二进制中识别、分析并利用弱密码实现来解 CTF 密码题,目标是提取密钥或解密数据。适用于自定义密码、弱加密、密钥提取、算法识别等场景。
当用户正在进行 CTF 比赛或练习,遇到 Misc 类型题目时触发此 Skill。 适用场景包括: - 用户上传或提及了音频文件(wav/mp3/flac)、图片文件(png/jpg/bmp/gif)、压缩包、pcap 流量包、内存镜像(raw/vmem/dmp)等 - 用户描述了隐写、编码、套娃、文件分析、内存取证相关问题 - 用户明确说"CTF"、"Misc"、"隐写"、"找 flag"、"这是一道题"、"内存取证"、"Volatility"等关键词 - 用户提供了 base64/hex/binary 等编码字符串需要解码 - 用户需要分析可疑文件、提取隐藏数据、还原协议内容、分析内存镜像
通过发现并利用内存破坏漏洞完成 CTF 二进制利用题(pwn),最终读到 flag。适用于栈溢出、格式化字符串、堆利用、ROP 等各类利用任务。
当用户正在进行 CTF 比赛或练习,遇到 Web 类型题目时触发此 Skill。 适用场景包括: - 用户描述了 SQL 注入、XSS、SSRF、SSTI、XXE、文件包含、命令执行等 Web 安全问题 - 用户需要进行信息搜集、目录扫描、端口扫描等渗透前期工作 - 用户遇到 PHP 特性利用、反序列化、JWT 伪造等高级攻击场景 - 用户提及 "CTF"、"Web"、"渗透"、"注入"、"绕过"、"漏洞" 等关键词 - 用户需要分析 Java 代码审计、区块链安全、组件漏洞利用等问题 - 用户需要构造 payload、编写 exploit、分析 WAF 绕过策略