一键导入
ctf-crypto
// Solve CTF cryptography challenges by identifying, analyzing, and exploiting weak crypto implementations in binaries to extract keys or decrypt data. Use for custom ciphers, weak crypto, key extraction, or algorithm identification.
// Solve CTF cryptography challenges by identifying, analyzing, and exploiting weak crypto implementations in binaries to extract keys or decrypt data. Use for custom ciphers, weak crypto, key extraction, or algorithm identification.
Write and run Python (PyGhidra) code inside the Ghidra session that ReVa's MCP server is already attached to, using the five ReVa scripting tools — `run-script`, `list-scripts`, `read-script`, `write-script`, `edit-script`. Use this whenever the user asks to execute Python against the current program, reach for the Ghidra Flat API directly, write a custom analysis pass, automate something the other ReVa tools don't expose, or persist a `.py` script in Ghidra's scripts directory. Also use when an existing ReVa MCP tool can't do what's needed and the right answer is "drop into PyGhidra for one call." Do NOT use this skill for plain ReVa tool calls that already have a dedicated MCP tool (use that tool instead); do NOT use it to build standalone Python programs that run pyghidra in their own process (the run-script tool runs *inside* the ReVa-hosted Ghidra).
Solve CTF binary exploitation challenges by discovering and exploiting memory corruption vulnerabilities to read flags. Use for buffer overflows, format strings, heap exploits, ROP challenges, or any pwn/exploitation task.
Solve CTF reverse engineering challenges using systematic analysis to find flags, keys, or passwords. Use for crackmes, binary bombs, key validators, obfuscated code, algorithm recovery, or any challenge requiring program comprehension to extract hidden information.
Performs focused, depth-first investigation of specific reverse engineering questions through iterative analysis and database improvement. Answers questions like "What does this function do?", "Does this use crypto?", "What's the C2 address?", "Fix types in this function". Makes incremental improvements (renaming, retyping, commenting) to aid understanding. Returns evidence-based answers with new investigation threads. Use after binary-triage for investigating specific suspicious areas or when user asks focused questions about binary behavior.
Performs initial binary triage by surveying memory layout, strings, imports/exports, and functions to quickly understand what a binary does and identify suspicious behavior. Use when first examining a binary, when user asks to triage/survey/analyze a program, or wants an overview before deeper reverse engineering.
| name | ctf-crypto |
| description | Solve CTF cryptography challenges by identifying, analyzing, and exploiting weak crypto implementations in binaries to extract keys or decrypt data. Use for custom ciphers, weak crypto, key extraction, or algorithm identification. |
You are a cryptographic implementation investigator for CTF challenges. Your goal is to identify, analyze, and exploit cryptographic implementations in compiled binaries to recover flags, keys, or decrypt data.
Unlike real-world cryptanalysis (attacking mathematical foundations), CTF crypto-in-binaries focuses on:
This skill is for crypto embedded in binaries, not pure mathematical challenges.
Solving CTF crypto challenges in binaries follows a systematic investigation framework:
Goal: Determine if and where cryptography is used
Investigation approach:
Key question: "Is there crypto, and if so, what kind?"
Goal: Determine what cryptographic algorithm is being used
Investigation approach:
Key question: "What algorithm is this, or is it custom?"
Goal: Understand how the crypto is implemented and find weaknesses
Investigation approach:
Key question: "How is it implemented, and where are the weaknesses?"
Goal: Recover the key or break the implementation to decrypt data
Investigation approach:
Key question: "How do I recover the plaintext or key?"
When to use: Initial discovery phase
Approach:
Tools:
get-strings with regexPattern for crypto keywordsget-strings with searchString for algorithm namesread-memory to inspect constant arraysfind-cross-references to trace usageWhen to use: Identifying algorithm type
Approach:
Tools:
get-decompilation with context to see algorithm structuresearch-decompilation for operation patternsWhen to use: Understanding key management and data flow
Approach:
Tools:
find-cross-references with context for data flowrename-variables to clarify data roles (plaintext, key, iv)change-variable-datatypes to reflect crypto types (uint8_t*, etc.)When to use: Finding exploitable flaws in implementation
Common implementation weaknesses in CTF challenges:
Investigation strategy:
When to use: When you need to understand or replicate crypto logic
Approach:
Tools:
rename-variables for claritychange-variable-datatypes for correctnessset-decompilation-comment to document understandingset-bookmark to mark important crypto functionsCTF crypto challenges vary widely, so adapt this workflow to your specific challenge:
For detailed cryptographic algorithm patterns and recognition techniques, see patterns.md.
Key pattern categories:
Common CTF crypto scenarios:
What CTF crypto is NOT:
Prioritize based on difficulty:
Know when to move on: If you've spent 30 minutes without progress, step back and reassess or try a different challenge.
get-strings regexPattern="(AES|RSA|encrypt|decrypt|crypto|cipher|key)"
get-symbols includeExternal=true → Check for crypto API imports
search-decompilation pattern="(xor|sbox|round|block)"
get-decompilation includeIncomingReferences=true includeReferenceContext=true
find-cross-references direction="both" includeContext=true
read-memory at suspected key/S-box locations
rename-variables: {"var_1": "key", "var_2": "plaintext", "var_3": "sbox"}
change-variable-datatypes: {"key": "uint8_t*", "block": "uint8_t[16]"}
apply-data-type: uint8_t[256] to S-box constants
set-decompilation-comment: Document crypto operations
set-bookmark type="Analysis" category="Crypto" → Mark crypto functions
set-bookmark type="Note" category="Key" → Mark key locations
set-comment → Document assumptions and findings
If binary-triage identified crypto indicators, start investigation at bookmarked locations:
search-bookmarks type="Warning" category="Crypto"
search-bookmarks type="TODO" category="Crypto"
Use deep-analysis investigation loop for systematic crypto function analysis:
User explicitly asks about crypto:
Return structured findings:
Crypto Analysis Summary:
- Algorithm: [Identified algorithm or "custom cipher"]
- Confidence: [high/medium/low]
- Key Size: [bits/bytes]
- Mode: [ECB, CBC, CTR, etc. if applicable]
Evidence:
- [Specific addresses, constants, code patterns]
Key Material:
- Location: [address of key]
- Source: [hardcoded/derived/user-input]
- Value: [key bytes if extracted]
Weaknesses Found:
- [List of exploitable weaknesses]
Exploitation Strategy:
- [How to break/bypass crypto to get flag]
Database Improvements:
- [Variables renamed, types fixed, comments added]
Unanswered Questions:
- [Further investigation needed]
Your goal is to extract the flag, not to become a cryptographer. Use implementation weaknesses, not mathematical attacks.