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.
Install
mkdir -p .claude/skills/ctf-crypto && curl -L -o skill.zip "https://mcp.directory/api/skills/download/3589" && unzip -o skill.zip -d .claude/skills/ctf-crypto && rm skill.zipInstalls to .claude/skills/ctf-crypto
About this skill
CTF Cryptography
Purpose
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:
- Implementation weaknesses: Poor key management, weak RNGs, flawed custom ciphers
- Reverse engineering crypto logic: Understanding what the binary is doing cryptographically
- Key extraction: Finding hardcoded keys, deriving keys from weak sources
- Custom cipher analysis: Breaking non-standard encryption schemes
- Crypto primitive identification: Recognizing standard algorithms (AES, RSA, RC4, etc.)
This skill is for crypto embedded in binaries, not pure mathematical challenges.
Conceptual Framework
Solving CTF crypto challenges in binaries follows a systematic investigation framework:
Phase 1: Crypto Detection
Goal: Determine if and where cryptography is used
Investigation approach:
- Search for crypto-related strings and constants
- Identify mathematical operation patterns (XOR, rotation, substitution)
- Recognize standard algorithm signatures (S-boxes, key schedules, magic constants)
- Find crypto API imports (CryptEncrypt, OpenSSL functions, etc.)
Key question: "Is there crypto, and if so, what kind?"
Phase 2: Algorithm Identification
Goal: Determine what cryptographic algorithm is being used
Investigation approach:
- Compare constants to known crypto constants (initialization vectors, S-boxes)
- Analyze operation patterns (rounds, block sizes, data flow)
- Match code structure to known algorithm patterns
- Check for library usage vs. custom implementation
Key question: "What algorithm is this, or is it custom?"
Phase 3: Implementation Analysis
Goal: Understand how the crypto is implemented and find weaknesses
Investigation approach:
- Trace key material sources (hardcoded, derived, user input)
- Analyze key generation/derivation logic
- Identify mode of operation (ECB, CBC, CTR, etc.)
- Look for implementation mistakes (IV reuse, weak RNG, etc.)
- Check for custom modifications to standard algorithms
Key question: "How is it implemented, and where are the weaknesses?"
Phase 4: Key Extraction or Breaking
Goal: Recover the key or break the implementation to decrypt data
Investigation approach:
- Extract hardcoded keys from binary data
- Exploit weak key derivation (predictable RNG, poor entropy)
- Break custom ciphers (frequency analysis, known-plaintext, etc.)
- Leverage implementation flaws (timing, side channels, logic errors)
- Reverse engineer decryption routines to understand transformation
Key question: "How do I recover the plaintext or key?"
Core Methodologies
Methodology 1: String and Constant Analysis
When to use: Initial discovery phase
Approach:
- Search for crypto keywords in strings
- Search for URLs, API endpoints that might receive encrypted data
- Locate large constant arrays (potential S-boxes, lookup tables)
- Compare constants to known crypto constants databases
- Follow cross-references from strings/constants to crypto functions
Tools:
get-stringswithregexPatternfor crypto keywordsget-stringswithsearchStringfor algorithm namesread-memoryto inspect constant arraysfind-cross-referencesto trace usage
Methodology 2: Pattern Recognition
When to use: Identifying algorithm type
Approach:
- Look for characteristic loop structures (round counts)
- Identify substitution operations (table lookups)
- Recognize permutation patterns (bit shuffling)
- Spot modular arithmetic (public-key crypto)
- Match to known algorithm patterns (see patterns.md)
Tools:
get-decompilationwith context to see algorithm structuresearch-decompilationfor operation patterns- Pattern reference (patterns.md) for recognition
Methodology 3: Data Flow Analysis
When to use: Understanding key management and data flow
Approach:
- Trace where plaintext/ciphertext enters the system
- Follow key material from source to usage
- Identify transformation steps (encrypt, decrypt, derive)
- Map data dependencies between functions
- Find where decrypted output is used or stored
Tools:
find-cross-referenceswith context for data flowrename-variablesto clarify data roles (plaintext, key, iv)change-variable-datatypesto reflect crypto types (uint8_t*, etc.)
Methodology 4: Weakness Discovery
When to use: Finding exploitable flaws in implementation
Common implementation weaknesses in CTF challenges:
- Hardcoded keys in binary (directly extractable)
- Weak key derivation (time-based seeds, simple XOR)
- Poor random number generation (predictable, seeded with constant)
- ECB mode (enables block analysis and manipulation)
- IV reuse or predictable IVs
- Custom ciphers with mathematical weaknesses
- Incomplete key schedules or reduced rounds
- Debug/test modes that bypass crypto
Investigation strategy:
- Check if key is hardcoded (read memory at key pointer)
- Analyze RNG initialization (is seed predictable?)
- Check for mode of operation weaknesses (ECB patterns)
- Look for test/debug backdoors
- Identify custom modifications to standard algorithms
Methodology 5: Reverse Engineering Decryption
When to use: When you need to understand or replicate crypto logic
Approach:
- Find decryption routine (may be encryption run backwards)
- Rename variables systematically (key, plaintext, ciphertext, state)
- Apply correct data types (byte arrays, word arrays)
- Document each transformation step with comments
- Replicate logic in Python script to test understanding
- Use binary's own decryption routine if possible
Tools:
rename-variablesfor claritychange-variable-datatypesfor correctnessset-decompilation-commentto document understandingset-bookmarkto mark important crypto functions
Flexible Workflow
CTF crypto challenges vary widely, so adapt this workflow to your specific challenge:
Quick Triage (5 minutes)
- Detect: Search for crypto strings, imports, constants
- Identify: Quick pattern match to known algorithms
- Assess: Is it standard crypto or custom? Strong or weak?
Deep Investigation (15-30 minutes)
- Understand: Decompile crypto functions, trace data flow
- Improve: Rename variables, fix types, document behavior
- Analyze: Find key sources, check for weaknesses
- Exploit: Extract keys, break weak implementations, or replicate logic
Exploitation (varies)
- Extract: Pull hardcoded keys from binary data
- Break: Exploit weak RNG, custom cipher flaws, or poor key derivation
- Decrypt: Use recovered keys or replicated logic to get flag
Verification
- Test: Verify decryption produces readable flag
- Document: Save findings in bookmarks and comments
Pattern Recognition
For detailed cryptographic algorithm patterns and recognition techniques, see patterns.md.
Key pattern categories:
- Block ciphers: AES, DES, Blowfish (S-boxes, rounds, key schedules)
- Stream ciphers: RC4, ChaCha (state evolution, keystream generation)
- Public key: RSA, ECC (modular arithmetic, large integers)
- Hash functions: MD5, SHA family (compression, magic constants)
- Simple schemes: XOR, substitution, custom ciphers
CTF-Specific Considerations
CTF Challenge Design Patterns
Common CTF crypto scenarios:
- Weak custom cipher: Break via cryptanalysis (frequency, known-plaintext)
- Hardcoded key: Extract from .data section
- Weak RNG: Predict key from time-based or constant seed
- Standard crypto, weak key: Brute-force small keyspace
- Implementation bug: Exploit logic error to bypass crypto
- Obfuscated standard: Recognize despite code obfuscation
What CTF crypto is NOT:
- Pure mathematical cryptanalysis (breaking AES-256 mathematically)
- Side-channel attacks on hardware (timing, power analysis)
- Network protocol attacks (though may combine with binary crypto)
- Breaking modern TLS/SSL implementations
Time Management
Prioritize based on difficulty:
- Hardcoded keys (minutes): Search .data, extract bytes
- Weak RNG (10-15 min): Analyze seed, predict sequence
- Simple custom cipher (20-30 min): Frequency analysis, known-plaintext
- Implementation bugs (15-30 min): Find logic errors, test edge cases
- Complex custom cipher (30-60 min): Full reverse engineering and breaking
Know when to move on: If you've spent 30 minutes without progress, step back and reassess or try a different challenge.
Tool Usage Patterns
Discovery Phase
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)"
Analysis Phase
get-decompilation includeIncomingReferences=true includeReferenceContext=true
find-cross-references direction="both" includeContext=true
read-memory at suspected key/S-box locations
Improvement Phase
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
Documentation Phase
set-bookmark type="Analysis" category="Crypto" → Mark crypto functions
set-bookmark type="Note" category="Key" → Mark key locations
set-comment → Document assumptions and findings
Integration with Other Skills
After Binary Triage
If binary-triage identified crypto indicators, start investigation at bookmarked locations:
search-bookmarks type="Warning" category="Crypto"
search-bookmarks type="TO
---
*Content truncated.*
More by cyberkaida
View all skills by cyberkaida →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversBreak down complex problems with Sequential Thinking, a structured tool and step by step math solver for dynamic, reflec
By Sentry. MCP server and CLI that provides tools for AI agents working on iOS and macOS Xcode projects. Build, test, li
Peekaboo empowers mac how to screen capture, mac screenshot, and window management with tools for screen snip on mac and
Boost Postgres performance with Postgres MCP Pro—AI-driven index tuning, health checks, and safe, intelligent SQL optimi
Integrate with Gemini CLI for large-scale file analysis, secure code execution, and advanced context control using Googl
Reddit Buddy offers powerful Reddit API tools for browsing, searching, and data annotation with secure access, rate limi
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.