ctf-crypto
БесплатноЗапускает вложенные скриптыНе проверенUse when a challenge involves cryptography: RSA (n, e, c given; p, q, d, dp leaks; Wiener, Hastad, Coppersmith, lattices), ECC/ECDSA, AES/DES modes (ECB…
от jiayaoqijia★ 81 звезда на GitHubОб этом скилле
CTF crypto — triage, attack tables, math tooling
Workspace rules, remote gate, flag logging: see sibling skill ctf. All local analysis
here is offline-safe; nothing in this skill needs the network unless explicitly noted
(factordb.com query, online Sage cell — see guardrails below).
Triage — identify the primitive (first 5 minutes)
- Write down in
notes.mdevery parameter the statement/source gives you (n, e, c, p, q, d, dp, dq, phi, g, h, key, IV, nonce, mode, hash, seed, curve). Missing parameters are the puzzle — note which are absent. - Classify the primitive:
| What you see | Primitive | Read |
|---|---|---|
Letter soup, symbols, ...= padding, dots/dashes |
encoding or classical cipher | references/classical.md |
Big integers n e c (often 0x or 1024+ bits), openssl rsa files |
RSA | references/rsa.md |
Points on a curve, y^2 = x^3 + ax + b, ECDSA/DSA sigs + nonces |
ECC / lattice | references/math-tools.md |
AES/DES/RC4, modes ECB/CBC/CTR/GCM, an oracle service |
symmetric crypto | references/symmetric.md |
| Hash to invert/crack, `sha256(key | msg)`, CRC32, custom hash func | |
random.*, rand(), LCG constants, "guess my number" |
PRNG | references/hash-prng.md |
| Huge knapsack sums, Merkle-Hellman, "biased nonce", "short pad" | lattice problem | references/math-tools.md |
- Run the quick screens:
python3 skills/ctf-crypto/scripts/rsacheck.py <n> # RSA params triage (stdlib)
python3 skills/ctf-crypto/scripts/xorfind.py dist/blob # XOR/encoding triage (stdlib)
file dist/* ; xxd dist/* | head # key files? PEM? raw bytes?
openssl rsa -in key.pem -text -noout # if any PEM/DER key is present
Encodings vs encryption: try decode layers first (base64 → hex → rot13). If the decoded blob is still high-entropy bytes with no structure, it is ciphered or XORed. Use a local CyberChef (see
references/classical.md) — never paste event secrets into random online tools.Nothing recognizable? Read the challenge source. Crypto challenges almost always ship the algorithm; the bug is in a parameter or a mode, not the primitive.
Playbook — expert flow
- Extract every constant into
notes.md(dec + hex + bit length). - Pick the attack table for the primitive (RSA table in
references/rsa.mdis keyed on leaked material: match what you have, not what looks fun). - Prefer the cheapest attack that fits the preconditions; escalate only on failure.
Record each failed attack in
notes.md— RSA trial-and-error otherwise loops. - Verify a recovered secret against the challenge: re-encrypt/re-sign and compare, or
check
d*e ≡ 1 (mod φ), or decrypt to a string matching the flag regex. - Interactive oracles (padding, prefix-suffix, broadcast): script them with pwntools;
remote connections need the user gate from
ctf.
Attack quick-index (details + commands in the reference files):
| Attack family | Precondition | Where |
|---|---|---|
| Classical / XOR / encodings | human-readable ciphertext | references/classical.md |
| RSA: factordb, Fermat, small e root, Hastad, Wiener, common modulus, dp leak, Coppersmith, related messages | any n e c set |
references/rsa.md |
| ECB/CBC/CTR/GCM mode abuse, padding oracle, length extension | block cipher + oracle | references/symmetric.md, references/hash-prng.md |
| MT19937 / LCG / seed brute | any PRNG output | references/hash-prng.md |
| LLL: knapsack, HNP/biased nonces, Wiener fallback | lattice-shaped integers | references/math-tools.md |
References
references/classical.md— encodings vs ciphers decision table, frequency analysis, Vigenere (IC + Kasiski), substitution via quipqiup, transposition, XOR incl. crib-dragging; offline CyberChef setup.references/rsa.md— attack decision table keyed on leaked material; RsaCtfTool and Sage install notes.references/symmetric.md— block cipher modes, bit-flipping, padding oracle, nonce reuse, RC4/DES legacy, MAC length extension.references/hash-prng.md— hash identification and cracking, CRC32 linearity, custom-hash inversion with z3, MT19937/LCG/Java PRNG prediction.references/math-tools.md— gmpy2/sympy idioms, Sage availability matrix, lattice starter (LLL, knapsack, HNP), pure-python Wiener.
Scripts in this skill
| Script | Purpose |
|---|---|
scripts/rsacheck.py |
n triage: bit length, primality, small factors, Fermat close primes, factordb lookup, pairwise gcd |
scripts/xorfind.py |
single/multi-byte XOR solver, crib search, known-prefix keystream recovery |
Toolbox
| Tool | Install | Purpose |
|---|---|---|
gmpy2, sympy, pycryptodome |
already in .venv (scripts/setup.sh) |
big-int math, factoring, AES/DES primitives |
scripts/rsacheck.py, scripts/xorfind.py |
included (this skill) | RSA triage, XOR solving |
| RsaCtfTool | clone https://github.com/RsaCtfTool/RsaCtfTool + `uv pip install -- |
Установить ctf-crypto в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл ctf-crypto?
Use when a challenge involves cryptography: RSA (n, e, c given; p, q, d, dp leaks; Wiener, Hastad, Coppersmith, lattices), ECC/ECDSA, AES/DES modes (ECB penguin, CBC bit-flip, padding oracle, CTR/GCM nonce reuse), hashes (crack, length extension, CRC32), PRNG prediction (MT19937, LCG, seed=time), XOR or classical ciphers (Caesar, Vigenere, substitution, base64/hex encodings), or math tooling (gmpy2, sympy, Sage, z3, RsaCtfTool, CyberChef).
Как установить скилл ctf-crypto?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ctf-crypto запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic