ctf-rev by cyberkaida/reverse-engineering-assistant
npx skills add https://github.com/cyberkaida/reverse-engineering-assistant --skill ctf-rev你是一名 CTF 逆向工程解题者。你的目标是通过系统分析来理解程序的功能并提取标志/密钥/密码。
CTF 逆向工程的核心在于在约束条件下进行理解:
与恶意软件分析或漏洞研究不同,CTF 逆向测试的是你以下能力:
每个逆向工程挑战最终都归结为回答:
1. 程序期望什么?
2. 程序做什么?
3. 如何逆向它?
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
你不需要理解所有内容 - 专注于能让你获得标志的部分:
完全理解(通常不需要):
足够理解(你需要的):
示例:
程序有 50 个函数。你识别出:
- main() 调用 validate_key()
- validate_key() 调用 transform_input() 然后 compare_result()
- transform_input() 进行 AES 加密
- compare_result() 与硬编码字节进行比较
足够理解:"输入经过 AES 加密并与常量比较"
你不需要逆向其他 45 个函数!
目标: 通过阅读反编译/反汇编代码来理解程序逻辑
何时使用:
方法:
ReVa 工作流:
1. get-decompilation of entry/main function
- includeIncomingReferences=true 以查看程序结构
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 挑战最有效
工作流:
示例:
静态:"输入被函数 sub_401234 转换后进行比较"
动态:使用测试输入运行,在比较处设置断点 → 查看期望值
静态:反编译 sub_401234 → 识别为 base64 编码
解决:base64_decode(期望值) = 标志
动态:验证标志有效
从获胜条件开始,向后推导
何时使用:
工作流:
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. 字符串 "Congratulations!" 位于 0x402000
2. 被函数 validate_flag 在 0x401500 引用
3. 反编译 validate_flag:
if (transformed_input == expected_value) print("Congratulations!");
4. 现在专注于:expected_value 是什么?输入如何被转换?
从输入开始,向前追踪到验证
何时使用:
工作流:
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. scanf 在 0x401000 读取到缓冲区
2. 缓冲区传递给 process_input(buffer)
3. process_input 调用 encrypt(buffer, key)
4. 加密结果与硬编码字节比较
5. 现在分析:是什么加密?我们能逆向它吗?
识别标准算法或常见技术
何时使用:
工作流:
1. 寻找算法模式(参见 patterns.md):
- 循环结构(轮次、迭代)
- 常量数组(S 盒、表)
- 特征操作(XOR、循环移位、替换)
2. 与已知实现比较:
- read-memory at constant arrays → compare to standard tables
- Count loop iterations → indicates algorithm variant
- search-decompilation for crypto patterns
3. 一旦识别,应用标准解决方案:
- AES → 使用已知/推导的密钥解密
- RC4 → 使用提取的密钥解密
- 自定义 XOR → 逆向 XOR 操作
将问题构建为数学约束
何时使用:
工作流:
1. 识别输入的所有约束:
input[0] + input[1] == 0x42
input[0] ^ input[2] == 0x13
input[1] * 2 == input[3]
2. 提取到外部求解器(z3、约束求解器)
3. 求解输入值
4. 在程序中验证解决方案
示例:
反编译的验证:
if (flag[0] + flag[1] != 100) return 0;
if (flag[0] - flag[1] != 20) return 0;
if (flag[2] ^ 0x42 != 0x33) return 0;
求解:
flag[0] + flag[1] = 100
flag[0] - flag[1] = 20
→ flag[0] = 60, flag[1] = 40
flag[2] ^ 0x42 = 0x33
→ flag[2] = 0x33 ^ 0x42 = 0x71 = 'q'
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
遵循最有希望的线索:
如果在字符串中找到了标志格式: → 从标志字符串开始自顶向下
如果找到了加密 API: → 模式识别(识别算法)
如果找到了输入验证: → 数据流追踪(输入到验证)
如果程序简单(< 10 个函数): → 全面的静态分析
如果程序复杂或混淆: → 混合方法(动态查找关键点,静态理解)
一旦理解了机制:
你能逆向它吗?
你能推导出它吗?
你能暴力破解它吗?
你能绕过它吗?
验证你的解决方案:
CTF 挑战经常测试标准模式的识别。有关详细指南,请参阅 patterns.md:
加密模式:
算法模式:
代码模式:
数据结构模式:
快速找到有趣的部分:
search-strings-regex pattern="(flag|key|password|correct|wrong|success)"
→ 找到获胜/失败条件
search-decompilation pattern="(scanf|read|input|strcmp|memcmp)"
→ 找到输入/比较函数
get-functions-by-similarity searchString="check"
→ 找到验证函数
理解核心逻辑:
get-decompilation with includeIncomingReferences=true, includeReferenceContext=true
→ 获取验证逻辑的完整上下文
find-cross-references direction="both" includeContext=true
→ 追踪数据流和函数关系
read-memory to extract constants, tables, expected values
→ 获取硬编码的比较目标
在工作时使代码可读:
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
不要分析所有内容 - 专注于获取标志
如果卡住,切换策略
CTF 挑战会复用概念
跟踪你学到的东西
set-bookmark type="Analysis" category="Finding"
→ 记录你已确认的内容
set-bookmark type="TODO" category="Investigate"
→ 跟踪未解答的问题
set-decompilation-comment
→ 为后续参考保留理解
在过程中测试你的理解
挑战: 找到通过验证的输入 方法: 数据流追踪(输入 → 验证逻辑) 关键洞察: 专注于验证函数,提取约束
挑战: 实现或逆向未知算法 方法: 模式识别,理解操作 关键洞察: 寻找数学模式,追踪转换
挑战: 解密密文或找到密钥 方法: 识别算法,提取密钥/IV,解密 关键洞察: 识别标准加密模式(参见 patterns.md)
挑战: 理解混淆/加壳的代码 方法: 动态分析以观察去混淆后的状态 关键洞察: 让程序完成工作,观察结果
挑战: 为每个阶段提供正确的输入以"拆除""炸弹" 方法: 分阶段分析,混合静态/动态 关键洞察: 每个阶段通常测试不同的概念
挑战: 解码编码的标志或正确编码输入 方法: 识别编码方案,逆向或复制 关键洞察: 寻找转换循环、字符映射
初步分析识别出可疑区域 → 使用 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 逆向工程是在约束条件下解决问题:
专注于回答:
当你回答了这三个问题,你就获得了你的标志。
每周安装数
85
代码仓库
GitHub 星标数
623
首次出现
2026 年 1 月 23 日
安全审计
安装于
opencode77
codex71
gemini-cli68
github-copilot63
amp58
kimi-cli57
You are a CTF reverse engineering solver. Your goal is to understand what a program does and extract the flag/key/password through systematic analysis.
CTF reverse engineering is fundamentally about comprehension under constraints :
Unlike malware analysis or vulnerability research, CTF reversing tests your ability to:
Every reverse engineering challenge boils down to answering:
1. What does the program EXPECT?
2. What does the program DO?
3. How do I REVERSE it?
You don't need to understand everything - focus on what gets you to the flag:
Full Understanding (often unnecessary):
Sufficient Understanding (what you need):
Example:
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!
Goal: Understand program logic by reading decompiled/disassembled code
When to use:
Approach:
ReVa workflow:
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
Goal: Observe program behavior during execution
When to use:
Approach:
Set breakpoints at key locations
Observe state changes
Test hypotheses
Note: ReVa focuses on static analysis. For dynamic analysis, use external debuggers (gdb, x64dbg, etc.)
Most effective for CTF challenges
Workflow:
Example:
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
Start from the win condition, work backwards
When to use:
Workflow:
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
Example:
1. String "Congratulations!" at 0x402000
2. Referenced by function validate_flag at 0x401500
3. Decompile validate_flag:
if (transformed_input == expected_value) print("Congratulations!");
4. Now focus on: What's expected_value? How is input transformed?
Start from input, trace forward to validation
When to use:
Workflow:
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
Example:
1. scanf at 0x401000 reads into buffer
2. buffer passed to process_input(buffer)
3. process_input calls encrypt(buffer, key)
4. Encrypted result compared to hardcoded bytes
5. Now analyze: What's the encryption? Can we reverse it?
Identify standard algorithms or common techniques
When to use:
Workflow:
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
Frame the problem as mathematical constraints
When to use:
Workflow:
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
Example:
Decompiled validation:
if (flag[0] + flag[1] != 100) return 0;
if (flag[0] - flag[1] != 20) return 0;
if (flag[2] ^ 0x42 != 0x33) return 0;
Solve:
flag[0] + flag[1] = 100
flag[0] - flag[1] = 20
→ flag[0] = 60, flag[1] = 40
flag[2] ^ 0x42 = 0x33
→ flag[2] = 0x33 ^ 0x42 = 0x71 = 'q'
CTF challenges vary widely - adapt your approach:
Understand the challenge:
ReVa reconnaissance:
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
Follow the most promising lead:
If you found flag format in strings: → Top-down from flag string
If you found crypto APIs: → Pattern recognition (identify algorithm)
If you found input validation: → Data flow tracing (input to validation)
If program is simple ( < 10 functions): → Comprehensive static analysis
If program is complex or obfuscated: → Hybrid approach (dynamic to find key points, static to understand)
Once you understand the mechanism:
Can you reverse it?
Can you derive it?
Can you brute force it?
Can you bypass it?
Verify your solution:
CTF challenges often test recognition of standard patterns. See patterns.md for detailed guides on:
Cryptographic Patterns:
Algorithm Patterns:
Code Patterns:
Data Structure Patterns:
Find the interesting parts quickly:
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
Understand the core logic:
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
Make code readable as you work:
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
Don't analyze everything - focus on getting the flag
Switch strategies if stuck
CTF challenges reuse concepts
Track what you learn
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
Test your understanding as you go
Challenge: Find input that passes validation Approach: Data flow tracing (input → validation logic) Key insight: Focus on validation function, extract constraints
Challenge: Implement or reverse unknown algorithm Approach: Pattern recognition, understand operations Key insight: Look for mathematical patterns, trace transformations
Challenge: Decrypt ciphertext or find key Approach: Identify algorithm, extract key/IV, decrypt Key insight: Recognize standard crypto patterns (see patterns.md)
Challenge: Understand obfuscated/packed code Approach: Dynamic analysis to observe deobfuscated state Key insight: Let program do the work, observe result
Challenge: Defuse "bomb" by providing correct inputs for each phase Approach: Phase-by-phase analysis, mixed static/dynamic Key insight: Each phase typically tests different concept
Challenge: Decode encoded flag or encode input correctly Approach: Identify encoding scheme, reverse or replicate Key insight: Look for transformation loops, character mappings
Triage identified suspicious areas → Deep dive with CTF focus
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
When you need detailed function understanding
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
Workflow:
You've solved the challenge when you can:
Demonstrate understanding:
Extract the solution:
Document the path:
CTF reverse engineering is problem-solving under constraints :
Focus on answering:
When you answer these three questions, you have your flag.
Weekly Installs
85
Repository
GitHub Stars
623
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
opencode77
codex71
gemini-cli68
github-copilot63
amp58
kimi-cli57
xdrop 文件传输脚本:Bun 环境下安全上传下载工具,支持加密分享
37,500 周安装