ctf-triage
它能做什么
它提供一套方法,将夺旗挑战分类,并选择合适的工具。适用于合法安全竞赛中的学生和选手。
适用场景
- ✓当有人在夺旗挑战文件上卡住,不知道它属于哪一类时。
- ✓当选手需要二进制或密码学题目在竞赛中的逐步方案时。
- ✓当学习者想在训练题目上练习安全技能时。
技能链接
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/reverser/ctf-triage/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我拿到一个看起来像二进制文件的 CTF 文件。我该怎样判断它是哪一类挑战?”
每周 5 个新技能,1 分钟读完。
工作原理
该技能告诉 AI 先检查文件类型和常见特征,然后转到对应的解题步骤。它保持清晰的顺序,避免选手跳过检查。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
CTF Challenge Triage and Solve Methodology
Authorized-use caveat: This skill is for legal CTF competitions, security education, and authorized research environments only. Never apply these techniques to systems without explicit written authorization.
Phase 0 — Initial Triage (always first)
Identify challenge category before touching any tool.
# Universal file fingerprint
file challenge_file
xxd challenge_file | head -4 # magic bytes
strings -n 8 challenge_file | head -30
binwalk challenge_file # embedded files / compression layers
exiftool challenge_file # metadata (images, PDFs)
| Magic bytes / extension | Category | Next phase |
|---|---|---|
| ELF / PE / Mach-O | Pwn / Rev | Phase 1a / 1b |
| PNG / JPG / BMP / WAV | Steganography / Forensics | Phase 2 |
| PCAP / PCAPNG | Network forensics | Phase 3 |
Memory dump (.raw, .vmem, .dmp) |
Memory forensics | Phase 4 |
| Ciphertext / hex blob / base64 | Crypto | Phase 5 |
| Web URL / source | Web | Use exploit/web/ skills |
| Archive / unknown binary | Misc / forensics | Phase 6 |
Phase 1a — Pwn (Binary Exploitation)
Step 1 — Security property enumeration
checksec --file=./binary
# Key outputs: RELRO, Stack Canary, NX, PIE, RUNPATH
| Property | Absent = exploitable via... |
|---|---|
| Stack canary | Stack overflow → ret2libc / ROP |
| NX (No-Execute) | Shellcode injection to stack/heap |
| PIE | Fixed address assumptions for ROP gadgets |
| Full RELRO | GOT overwrite |
Step 2 — Static analysis
objdump -d ./binary | grep -A 20 "<main>"
strings ./binary | grep -E "(flag|CTF|pass|secret|/bin/sh)"
readelf -s ./binary | grep -E "(sym|FUNC)"
# Heavy analysis
ghidra ./binary # or: r2 -A ./binary
Step 3 — Dynamic analysis + offset finding
# GDB with GEF/PEDA
gdb -q ./binary
# Inside GDB:
# pattern create 200
# run < <(python3 -c "print('A'*200)")
# pattern offset $rsp
# Pwntools skeleton
python3 - <<'EOF'
from pwn import *
context.binary = elf = ELF('./binary')
p = process('./binary')
# or: p = remote('challenge.host', 1337)
offset = cyclic_find(0x61616161) # replace with crashing value
payload = b'A' * offset + p64(elf.sym['win'])
p.sendline(payload)
p.interactive()
EOF
Step 4 — ROP chain (when NX set)
ROPgadget --binary ./binary --rop | grep "pop rdi"
# or: ropper -f ./binary --search "pop rdi"
python3 - <<'EOF'
from pwn import *
elf = ELF('./binary')
libc = ELF('./libc.so.6')
rop = ROP(elf)
rop.call('puts', [elf.got['puts']])
rop.call(elf.sym['main'])
# Leak libc base, then ret2libc
EOF
Step 5 — Libc identification (remote exploits)
# Identify libc from leaked addresses
python3 -m one_gadget libc.so.6
# or: libc-database lookup
Phase 1b — Reverse Engineering
Step 1 — Static disassembly
# Strings for quick wins (flag format, hardcoded keys)
strings ./binary | grep -iE "(flag\{|ctf\{|[A-Z0-9_]{10,}\})"
# Ghidra headless (no GUI)
analyzeHeadless /tmp/ghidra_proj ChalProj \
-import ./binary \
-postScript PrintASM.java \
-scriptPath /opt/ghidra/Ghidra/Features/Decompiler/ghidra_scripts \
2>/dev/null
# radare2 (faster for known binary formats)
r2 -A ./binary
# Inside r2: afl (functions), pdf @ sym.main, VV (visual)
Step 2 — Anti-debug / packer detection
# Detect packers
upx -t ./binary # UPX packed?
die ./binary # Detect-It-Easy
# If packed: upx -d ./binary
# Entropy analysis (high entropy sections = packed/encrypted)
binwalk -E ./binary
If packed, see reverser/packer-unpacking/SKILL.md.
Step 3 — Symbolic execution for constraint solving
# Angr — solve unknown input to reach target state
python3 - <<'EOF'
import angr, claripy
proj = angr.Project('./binary', auto_load_libs=False)
flag_chars = [claripy.BVS(f'flag_{i}', 8) for i in range(32)]
flag = claripy.Concat(*flag_chars)
state = proj.factory.full_init_state(stdin=flag)
for c in flag_chars:
state.add_constraints(c >= 0x20, c <= 0x7e)
sm = proj.factory.simulation_manager(state)
sm.explore(find=lambda s: b'Correct' in s.posix.dumps(1),
avoid=lambda s: b'Wrong' in s.posix.dumps(1))
if sm.found:
print(sm.found[0].solver.eval(flag, cast_to=bytes))
EOF
Phase 2 — Steganography / Image Forensics
Triage order (fast to slow)
# 1. Metadata
exiftool challenge.
常见问题
它涵盖哪些类型的挑战?
它涵盖二进制利用、逆向工程、密码学、取证、网页和杂项题目。
它只适用于竞赛吗?
它面向合法竞赛、教育和获授权的研究。
它会替你解题吗?
它提供方法和工具,解题仍由选手自己完成。
详情
作者的原始描述
CTF challenge triage and solve methodology — category detection, tool selection, and multi-step solve chains across pwn/rev/crypto/forensics/web/misc.
热度
- GitHub 星标
- 6.5k
- 排名
- #14162
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …