crypto-analysis
Crypto Analysis Skill
Quick Workflow
Progress:
- [ ] Try Ciphey auto-decrypt first
- [ ] Identify crypto type (RSA/AES/XOR/classical)
- [ ] Check for known weaknesses
- [ ] Implement attack
- [ ] Decrypt flag
Step 1: Auto-Decrypt (Try First!)
ciphey -t "ENCODED_TEXT" # Auto-detects and decrypts
ciphey -f encrypted.txt # From file
Step 2: Identify Crypto Type
| Pattern | Crypto Type | Reference |
|---|---|---|
n, e, c variables |
RSA | reference/rsa-attacks.md |
| 16/32 byte key, IV | AES | reference/aes-attacks.md |
| XOR operations | XOR/Stream | reference/classical.md |
| Polynomial mod | Lattice | reference/lattice.md |
RSA Attack Decision Tree
├── e small (≤5)? → Direct eth root
├── e very large? → Wiener's Attack
├── Multiple n,e,c? → Hastad's Broadcast
├── Same n, diff e? → Common Modulus
├── GCD(n1,n2) > 1? → Common Factor
├── p ≈ q? → Fermat Factorization
├── dp/dq leaked? → Partial Key Recovery
└── Default → FactorDB / yafu
Full implementations: reference/rsa-attacks.md
Quick Commands
# Auto-decrypt
ciphey -t "text"
# XOR analysis
xortool encrypted.bin
xortool -c 20 encrypted.bin # Expect spaces
# Factor large n
yafu "factor(<n>)"
# RSA tool
python3 RsaCtfTool.py -n <n> -e <e> --uncipher <c>
# Lattice (SageMath)
sage solve.sage
Reference Files
- RSA Attacks: Small e, Wiener, Hastad, Common Modulus, Fermat, FactorDB
- AES Attacks: ECB detection, CBC flip, Padding Oracle
- Classical/XOR: Ciphey, xortool, frequency analysis, Vigenère
- Lattice: Coppersmith, LLL, HNP
More from kiwamizamurai/cctf
web-security
Exploits web application vulnerabilities. Use when working with SQL injection, XSS, SSRF, SSTI, command injection, path traversal, authentication bypass, deserialization, or any web-based CTF challenge.
30mobile-security
Reverses and exploits mobile applications. Use when working with Android APK files, iOS IPA files, mobile app reversing, Frida hooking, or app security analysis challenges.
28osint
Gathers intelligence from public sources. Use when searching for usernames, geolocating images, investigating social media, analyzing domains, or solving information gathering challenges.
19pyjail
Escapes Python sandbox restrictions. Use when working with restricted Python eval/exec environments, sandbox escapes, filtered input challenges, or Python jail challenges.
9networking
Analyzes network traffic and exploits protocols. Use when working with PCAP files, Wireshark captures, packet analysis, protocol exploitation, traffic forensics, or data exfiltration detection.
7binary-analysis
Analyzes binary files for vulnerabilities and develops exploits. Use when working with ELF/PE executables, pwn challenges, buffer overflow, heap exploitation, ROP chains, format string bugs, or shellcode development.
7