ctf-crypto
Cryptographic attack techniques and exploits for CTF challenges across classical, modern, and advanced schemes.
- Covers 50+ attack vectors including RSA (Wiener, Pollard, Coppersmith, padding oracles), ECC (small subgroup, Smart's attack, ECDSA nonce reuse), AES (ECB leakage, CBC padding oracle, CFB-8), and stream ciphers (LFSR, Berlekamp-Massey)
- Includes PRNG attacks (MT19937 state recovery from floats via GF(2) matrix, V8 Math.random prediction, C srand synchronization via ctypes) and lattice/LWE solvers (CVP via Babai, LLL for approximate GCD)
- Provides ZKP/constraint solving patterns (Z3 for BPF/SECCOMP, Groth16 forgery, graph 3-coloring, Shamir SSS) and exotic structures (braid group DH, tropical semiring residuation)
- Organized by cipher family with one-liner techniques, full code examples in supporting markdown files, and tool recommendations (RsaCtfTool, SageMath, fpylll, Z3)
CTF Cryptography
Quick reference for crypto CTF challenges. Each technique has a one-liner here; see supporting files for full details with code.
Prerequisites
Python packages (all platforms):
pip install pycryptodome z3-solver sympy gmpy2 hashpumpy fpylll py_ecc
Linux (apt):
apt install hashcat sagemath
macOS (Homebrew):
brew install hashcat
More from ljagiello/ctf-skills
ctf-reverse
Provides reverse engineering techniques for CTF challenges. Use when the main job is to understand how a compiled, obfuscated, packed, or virtualized target works before exploiting or solving it, including binaries, APKs, WASM, firmware, custom VMs, bytecode, game clients, malware-like loaders, and anti-debug or anti-analysis logic. Do not use it when the vulnerability is already understood and the remaining task is exploitation; use pwn instead. Do not use it for pure web workflows, log or disk forensics, or standalone crypto problems unless reversing the implementation is the real blocker.
3.7Kctf-web
Provides web exploitation techniques for CTF challenges. Use when the target is primarily an HTTP application, API, browser client, template engine, identity flow, or smart-contract frontend/backend surface, including XSS, SQLi, SSTI, SSRF, XXE, JWT, auth bypass, file upload, request smuggling, OAuth/OIDC, SAML, prototype pollution, and similar web bugs. Do not use it for native binary memory corruption, reverse engineering of standalone executables, disk or memory forensics, or pure cryptanalysis unless the web flaw is still the main path to the flag.
3.5Kctf-pwn
Provides binary exploitation techniques for CTF challenges. Use when you already have a vulnerable native target or service and need to turn memory corruption or low-level primitives into code execution or privilege escalation, such as buffer overflows, format strings, heap bugs, ROP, ret2libc, shellcode, kernel exploitation, seccomp bypass, sandbox escape, or Windows/Linux exploit chains. Do not use it when the main blocker is understanding what the binary does; use reverse engineering first. Do not use it for pure web bugs, disk or packet forensics, or standalone crypto/math challenges.
3.4Kctf-osint
Provides open source intelligence techniques for CTF challenges. Use when gathering information from public sources, social media, geolocation, DNS records, username enumeration, reverse image search, Google dorking, Wayback Machine, Tor relays, FEC filings, or identifying unknown data like hashes and coordinates.
3.2Kctf-forensics
Provides digital forensics and signal analysis techniques for CTF challenges. Use when analyzing disk images, memory dumps, event logs, network captures, cryptocurrency transactions, steganography, PDF analysis, Windows registry, Volatility, PCAP, Docker images, coredumps, side-channel power traces, DTMF audio spectrograms, packet timing analysis, CD audio disc images, or recovering deleted files and credentials.
3.2Kctf-misc
Provides miscellaneous CTF challenge techniques for problems that do not cleanly fit the main categories. Use for encoding puzzles, pyjails, bash jails, RF/SDR, DNS oddities, unicode tricks, esoteric languages, QR or audio puzzles, constraint solving, game theory, unusual sandbox escapes, and hybrid logic puzzles. Prefer a more specific skill first when the challenge is mainly web, pwn, reverse, forensics, malware, OSINT, or crypto. Treat this as the fallback skill for genuine cross-category or edge-case challenges, not the default starting point.
3.2K