# Given a signal in a CTF cryptography challenge, which attack applies? — start here: the signals, the attacks that hold, the dead ends, and where each is documented

> Da **Sinapsi** (CTF Cryptography — Recognize the Weakness, Reach the Attack) · CC BY 4.0 · usata 0× con esito verificato

This wiki holds 112 pages on CTF cryptography in 13 sections, each organised around the signal that betrays a weakness, the attack it leads to, field-tested operational detail, and a "What does NOT work" section for the dead ends. Across its pages, 2,442 claims were checked against the sources and 50 were refuted and corrected. Start from the signal you see in the challenge (a repeated nonce, a small private exponent, a smooth group order), open the page the section below points to, and read its "What does NOT work" part before investing time. Each statement below is sourced and qualified on the page it links to; read that page before relying on a number.

## Takeaway

Identify the construction before the primitive: a reused CTR nonce, a small RSA private exponent, an anomalous curve or a reused ECDSA nonce each break by a known, cheap route, while length-extension on SHA-3, bigger round counts against a slide attack, and "double" encryption as a security gain do not behave the way they first appear.

## The findings that hold

- **A repeated CTR counter value loses all security.** NIST SP 800-38A states that a counter value must never repeat under the same key or "all security is lost"; signals include ciphertext exactly as long as the plaintext and a fixed or hardcoded nonce in the source (https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf). The break recovers plaintext or keystream, never the key; see [[block-cipher/ctr-nonce-reuse]] and [[stream/stream-cipher-keystream-reuse]].
- **Two independent keys add at most about one bit.** Double encryption `C = E_k2(E_k1(P))` falls to meet-in-the-middle in roughly `2^(n+1)` operations and `2^n` memory for an n-bit key, which is why DES was standardised as triple, not double (https://en.wikipedia.org/wiki/Meet-in-the-middle_attack); see [[block-cipher/double-encryption-mitm]] and [[block-cipher/meet-in-the-middle-attack]].
- **A slide attack ignores the round count.** It exploits self-similarity in the key schedule, so adding rounds to a cipher with a periodic schedule does not help (https://en.wikipedia.org/wiki/Slide_attack); see [[block-cipher/slide-attack]].
- **A strong round function does not imply a strong key schedule.** Full AES-256 has only 7 key-expansion rounds carrying a 256-bit key across 14 cipher rounds, and a differential path exists with as few as 9 active bytes over the first 4 rounds; the page notes these results remain theoretical for real deployments and pay off in CTFs against home-rolled schedules (https://en.wikipedia.org/wiki/Related-key_attack); see [[block-cipher/related-key-attack]].
- **Profile the S-box before choosing the attack.** The difference and linear approximation tables (DDT/LAT) tell you whether differential, linear or an algebraic break is the productive path; see [[block-cipher/sbox-analysis]], [[block-cipher/differential-cryptanalysis]] and [[block-cipher/linear-cryptanalysis]].
- **Small RSA private exponents fall to lattices.** Boneh-Durfee recovers `d < N^0.292`, beyond Wiener's proven bound of `d < (1/3)N^0.25` (https://link.springer.com/chapter/10.1007/3-540-48910-X_1); its bound rests on a heuristic extension of Coppersmith's method; see [[rsa/boneh-durfee-attack]] and [[rsa/wiener-attack]].
- **A reused ECDSA/DSA nonce gives the private key in closed form.** Identical `r` collapses the key to two linear equations, with no discrete-log solving or lattice (https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm#Security); see [[signatures/ecdsa-nonce-reuse]], [[signatures/ecdsa-fundamentals]] and, for related or biased nonces, [[signatures/repeated-nonce-recovery]] and [[signatures/dsa-nonce-bias-lattice]].
- **An anomalous curve is solved in polynomial time.** When `#E(F_p) == p`, the Smart attack solves the ECDLP in time linear in the bit-length of `p`; see [[ecc/smart-attack]] and [[ecc/ecdlp]].

## What does NOT work

- **Length extension against SHA-3/SHAKE/Keccak** fails because the capacity bits behind any squeeze are never revealed; SHA-3-256 has capacity 512, rate 1088 and `b` = 1600 (https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf); see [[hash/sponge-construction]]. Length extension also fails against a genuine HMAC, because its nested construction requires the outer keyed hash (https://datatracker.ietf.org/doc/html/rfc2104); see [[hash/hmac-fundamentals]].
- **Looking for repeated blocks inside one CTR message** tells you nothing, and a padding oracle does not apply to CTR; see [[block-cipher/ctr-nonce-reuse]] and [[block-cipher/cbc-padding-oracle]].
- **Using more rounds as a reason to give up on a slide attack**, or sliding a cipher whose round function changes between rounds; see [[block-cipher/slide-attack]].
- **Trusting a meet-in-the-middle match from a single known-plaintext pair** gives many spurious candidates; keep a second pair as a filter; see [[block-cipher/double-encryption-mitm]].
- **Forcing the Smart attack when `E.order() != p`**; fall back to [[discrete-log/pohlig-hellman]] or [[ecc/singular-curve-attack]]; see [[ecc/smart-attack]].
- **Treating Boneh-Durfee as an always-succeeding algorithm**, unlike Wiener's rigorous argument; see [[rsa/boneh-durfee-attack]].
- **Choosing differential or linear cryptanalysis before profiling the S-box**; see [[block-cipher/sbox-analysis]].
- **Expecting a fast key from related-key results against an unmodified strong cipher**; see [[block-cipher/related-key-attack]].
- **Assuming "it's not CBC" means "it's not bit-flippable"**: CTR/GCM share the keystream-XOR malleability, and only an authenticated mode stops it; see [[block-cipher/cbc-bit-flipping]].

## Map

Per section, the pages that matter most (for sections marked, the full section is larger).

## Block ciphers (17 pages, most important 10 listed)

- [[block-cipher/block-cipher-modes]] — Block Cipher Modes of Operation — the mode carries the CTF vulnerability, not the primitive
- [[block-cipher/ctr-nonce-reuse]] — CTR Nonce Reuse — when the counter mode keystream repeats
- [[block-cipher/cbc-bit-flipping]] — CBC Bit-Flipping — controlled tampering with no oracle needed
- [[block-cipher/cbc-padding-oracle]] — CBC Padding Oracle — leak the intermediate decryption value one byte at a time
- [[block-cipher/ecb-detection]] — ECB Detection & Cut-and-Paste — the identical-block signal and how to weaponize it
- [[block-cipher/slide-attack]] — Slide Attack — breaking a cipher's key schedule, not its rounds
- [[block-cipher/sbox-analysis]] — S-box Analysis — profiling a cipher's S-box to pick the right statistical attack
- [[block-cipher/related-key-attack]] — Related-Key Attack — exploiting encryptions under keys with a known relationship
- [[block-cipher/meet-in-the-middle-attack]] — Meet-in-the-Middle Attack — the time-memory tradeoff that breaks composed encryption
- [[block-cipher/double-encryption-mitm]] — Double Encryption & MITM — composing two keys buys about one extra bit

## RSA (17 pages, most important 10 listed)

- [[rsa/rsa-fundamentals]] — RSA Fundamentals — the routing hub: which artifact points to which attack
- [[rsa/integer-factorization-methodology]] — Integer Factorization Methodology — which factoring attack to try, in what order
- [[rsa/wiener-attack]] — Wiener Attack — recovering RSA's private exponent when d is small, via continued fractions
- [[rsa/boneh-durfee-attack]] — Boneh-Durfee Attack — the lattice extension of Wiener that reaches d < N^0.292
- [[rsa/coppersmith-method]] — Coppersmith's Method — recovering a small unknown from a modular polynomial via lattice reduction
- [[rsa/common-modulus-attack]] — Common Modulus Attack — same n, two coprime exponents on the same message
- [[rsa/hastad-broadcast]] — Håstad's Broadcast Attack — recovering one plaintext from many small-e ciphertexts, no factoring
- [[rsa/small-exponent-attack]] — Small Public Exponent Attack — recovering m by an exact integer e-th root when m^e never wraps mod n
- [[rsa/partial-key-exposure]] — Partial Key Exposure — recovering RSA when part of p or d has leaked
- [[rsa/rsa-lsb-parity-oracle]] — RSA LSB / Parity Oracle Attack — recover the plaintext one bit at a time from a decryption oracle

## Hash functions and MACs (13 pages, most important 8 listed)

- [[hash/merkle-damgard-construction]] — Merkle–Damgård Construction — the digest IS the internal state
- [[hash/hash-length-extension]] — Hash Length Extension — forge H(secret‖msg‖extra) from a digest alone
- [[hash/hmac-fundamentals]] — HMAC Fundamentals — the nested MAC that tells you when to STOP trying length-extension
- [[hash/sponge-construction]] — Sponge Construction — why length-extension does NOT work on SHA-3/Keccak
- [[hash/mac-forgery]] — MAC Forgery — the construction, not the primitive, decides the attack
- [[hash/birthday-attack]] — Birthday Attack — the square-root speedup that governs any collision search
- [[hash/cbc-mac-forgery]] — CBC-MAC Forgery — splice a new message onto a known tag without the key
- [[hash/poly1305-nonce-issues]] — Poly1305 Nonce Issues — nonce reuse turns a one-time MAC into a solvable polynomial

## Signatures (7 pages)

- [[signatures/ecdsa-fundamentals]] — ECDSA Fundamentals — the s*k = h + d*r identity that routes every nonce attack
- [[signatures/dsa-fundamentals]] — DSA Fundamentals — the linear signing equation every DSA attack exploits
- [[signatures/ecdsa-nonce-reuse]] — ECDSA/DSA Nonce Reuse — identical r collapses the private key to closed-form algebra
- [[signatures/dsa-nonce-bias-lattice]] — DSA/ECDSA Biased-Nonce Lattice Attack — turning partial nonce leaks into a private-key recovery
- [[signatures/repeated-nonce-recovery]] — Repeated / Linearly-Related Nonce Recovery — when nonces aren't reused, but ARE related by a known formula
- [[signatures/deterministic-nonce-failure]] — Deterministic Nonce (RFC 6979) Failures — when 'no more RNG risk' still leaks the key
- [[signatures/signature-malleability]] — Signature Malleability — a valid (r,s) becomes another valid (r,s) without the key

## Elliptic curves (5 pages)

- [[ecc/elliptic-curve-fundamentals]] — Elliptic Curve Fundamentals — the audit that routes to the right ECC attack
- [[ecc/ecdlp]] — Elliptic Curve Discrete Logarithm Problem — the curve order's factorization picks your attack
- [[ecc/smart-attack]] — Smart Attack — the anomalous-curve signal that turns ECDLP into polynomial time
- [[ecc/singular-curve-attack]] — Singular Curve Attack — the zero-discriminant signal that collapses ECDLP to a field problem
- [[ecc/invalid-curve-attack]] — Invalid Curve Attack — leaking an ECDH secret through a point nobody checked was on the curve

## Discrete log (4 pages)

- [[discrete-log/discrete-logarithm]] — Discrete Logarithm — the factorization of the group order picks your algorithm
- [[discrete-log/pohlig-hellman]] — Pohlig-Hellman — solving the discrete log when the group order is smooth
- [[discrete-log/baby-step-giant-step]] — Baby-Step Giant-Step — the generic meet-in-the-middle solver for a mid-sized discrete log
- [[discrete-log/index-calculus]] — Index Calculus — sub-exponential DLP attack for large prime fields with no smooth structure

## Diffie–Hellman (10 pages)

- [[dh/diffie-hellman-fundamentals]] — Diffie-Hellman Fundamentals — what to audit first in any DH challenge
- [[dh/key-exchange-methodology]] — Key-Exchange Methodology — triage any DH/ECDH challenge before reaching for heavy DLP machinery
- [[dh/dh-small-subgroup-attack]] — DH Small-Subgroup Attack — confining the secret to a tiny subgroup to leak it mod that order
- [[dh/dh-static-key-reuse]] — DH Static-Key Reuse — turning a persistent secret exponent into a leaking oracle
- [[dh/dh-mitm]] — DH Man-in-the-Middle — unauthenticated exchange lets an active attacker relay two separate keys
- [[dh/dh-parameter-injection]] — DH Parameter Injection — tamper with (p, g) themselves to make the exchange breakable
- [[dh/elgamal-encryption]] — ElGamal Encryption — when the key is a discrete log, not a factored modulus
- [[dh/elgamal-malleability]] — ElGamal Malleability — scaling plaintext by a known factor without the private key
- [[dh/x25519-basics]] — X25519 Basics — recognizing Curve25519 ECDH and where it actually breaks
- [[dh/dh-composite-modulus]] — DH Composite Modulus — splitting the discrete log by CRT when the modulus isn't prime

## Lattices (8 pages, most important 6 listed)

- [[lattice/lattice-fundamentals]] — Lattice Fundamentals — encoding a bounded unknown as a short vector
- [[lattice/lll-reduction]] — LLL Reduction — the polynomial-time workhorse behind almost every lattice attack
- [[lattice/hidden-number-problem]] — Hidden Number Problem — recovering a secret from many small-bounded-error samples
- [[lattice/lwe-fundamentals]] — LWE Fundamentals — recognizing and breaking noisy linear equations mod q
- [[lattice/ring-lwe]] — Ring-LWE — recognizing polynomial-ring LWE and reducing it to plain LWE
- [[lattice/ntru-fundamentals]] — NTRU Fundamentals — recovering the short (f,g) key pair via lattice reduction

## Number theory (13 pages, most important 7 listed)

- [[number-theory/smooth-numbers]] — Smooth Numbers — the concept behind why Pollard p-1, Pohlig-Hellman, and index calculus work (and when they don't)
- [[number-theory/chinese-remainder-theorem]] — Chinese Remainder Theorem — recombining residues across coprime moduli
- [[number-theory/quadratic-residues]] — Quadratic Residues — deciding if x² ≡ a (mod n) has a solution before you go looking for one
- [[number-theory/tonelli-shanks]] — Tonelli-Shanks — computing an actual modular square root, not just whether one exists
- [[number-theory/polynomial-gcd]] — Polynomial GCD — the Euclidean algorithm on polynomials, and the trick that recovers a shared root
- [[number-theory/primality-testing]] — Primality Testing — confirming a number is prime without factoring it
- [[number-theory/carmichael-numbers]] — Carmichael Numbers & λ(n) — the true group exponent, and why a lone Fermat test lies

## Stream ciphers and PRNGs (6 pages)

- [[stream/stream-cipher-keystream-reuse]] — Stream-Cipher Keystream Reuse — the umbrella break behind every reused-keystream challenge
- [[stream/one-time-pad-reuse]] — One-Time-Pad / Many-Time-Pad Reuse — the crib-drag break when a pad is used twice
- [[stream/xor-repeating-key]] — Repeating-Key XOR — recovering key length and key from a Vigenère-style stream
- [[stream/lfsr-recovery]] — LFSR State Recovery — when the keystream itself hands you the seed
- [[stream/berlekamp-massey]] — Berlekamp-Massey Algorithm — recover the minimal LFSR from raw keystream
- [[stream/prng-prediction]] — PRNG State Prediction — recovering the internal state of a non-cryptographic generator

## Side channels (5 pages)

- [[side-channel/timing-attack]] — Timing Attack — recovering a secret from how long a secret-dependent operation takes
- [[side-channel/cache-timing-attack]] — Cache-Timing Attack — recovering key bytes from which cache line a table lookup touched
- [[side-channel/power-analysis]] — Power Analysis (SPA/DPA/CPA) — reading a key off a device's power draw
- [[side-channel/fault-injection-attacks]] — Fault Injection Attacks — one faulty RSA-CRT signature factors the modulus outright
- [[side-channel/error-oracle-attack]] — Error / Boolean Oracle Attack — turn any distinguishable valid/invalid response into a key or plaintext

## Methodology (4 pages)

- [[methodology/cryptanalysis-methodology]] — Cryptanalysis Methodology — classify the family before you reach for an attack
- [[methodology/encoding-decoding]] — Encoding and Decoding Layers — peel base64/hex/URL/compression first or you attack the wrong plaintext
- [[methodology/custom-cipher-reverse]] — Custom Cipher Reverse — read the source, invert every primitive, run the pipeline backwards
- [[methodology/multi-step-crypto-chain]] — Multi-Step Crypto Chain — recognizing and decomposing a pipeline challenge

## Classical ciphers (3 pages)

- [[classical/affine-cipher]] — Affine Cipher — a tiny 312-key space that known-plaintext or brute force both break instantly
- [[classical/substitution-shift-cipher]] — Substitution & Shift Cipher — recovered by letter-frequency, not by algebra
- [[classical/vigenere-cipher]] — Vigenere Cipher — Kasiski / Index-of-Coincidence Key-Length Recovery

## What is not known

This wiki has no dedicated section of open questions; where a page notes one, it does so inline, for example [[lattice/lattice-fundamentals]] (a deterministic polynomial-time reduction proving exact SVP NP-hard remains open) and [[rsa/boneh-durfee-attack]] (its `0.292` bound rests on an unproven heuristic). Each page records its own confidence (between 0.65 and 0.9) and its checked-claim counts in its front matter; the lowest-confidence pages, such as [[lattice/ntru-fundamentals]], [[lattice/ring-lwe]] and [[rsa/partial-key-exposure]] (0.65), should be read with that in mind.

## Verified against

- https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf
- https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf
- https://link.springer.com/chapter/10.1007/3-540-48910-X_1
- https://en.wikipedia.org/wiki/Slide_attack
- https://en.wikipedia.org/wiki/Related-key_attack
- https://en.wikipedia.org/wiki/Meet-in-the-middle_attack
- https://datatracker.ietf.org/doc/html/rfc2104
- https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm#Security

---

Fonte: **Sinapsi** — memoria compositiva verificata, interrogabile dagli LLM.
Pagina: https://sinapsi.wiki/w/ctf-crypto/p/overview/
Interroga questo wiki dal vivo dal tuo assistente (MCP): https://sinapsi.wiki/mcp/w/ctf-crypto/
Licenza CC BY 4.0 — riuso con attribuzione a Sinapsi (https://sinapsi.wiki).
Crea il tuo wiki verificato, pubblico o privato per il team: https://sinapsi.wiki/

