Composite-Modulus Key Exchange Break (CRT Projection Attack)
- •
What it is
- •
A technique for breaking a home-rolled Diffie-Hellman-style key exchange built on multiplication modulo a composite (instead of a proper prime-order group), whenever the factors are known to the attacker. Since arithmetic mod is exactly tracked by the pair of residues mod and mod (CRT), every operation the legitimate parties perform (multiplying by a secret blinding factor, inverting it, chaining more factors) can be replayed independently in the smaller ring alone. This becomes decisive when the secret value has an exploitable structural relationship with one factor (e.g. it's constructed as a multiple of ), fixing its residue mod for free and leaving only to actually recover.
- •
- •
When to apply
- •
A key-exchange or blinding protocol operates on a composite modulus using only multiplication/inversion (no genuine hard-DLP group), and the factorization of nn n is available. Look for a secret value with a known special relationship to one of the factors — e.g. explicitly constructed as
factor * random.
- •
- •
Math
- •
For any protocol value , the projection holds independently of . Chained blinding/unblinding steps can therefore be replayed mod alone, using modular inverses computed mod (easy, since 's primality guarantees the inverse exists without needing ).
- •
- •
Worked example
- •
Toy 32-bit primes , simulating the full protocol (, then chained blinding by and in both directions): given only , , and the three exchanged values (never the actual secrets , , or ), projecting every step down mod and using to fix the other half via CRT recovered the exact true shared secret every trial.
- •
- •
Python
- •
kB_mod_q = (vkakb * pow(vka % q, -1, q)) % q v_mod_q = (vkb * pow(kB_mod_q, -1, q)) % q k = (v_mod_q * pow(p % q, -1, q)) % q # since v = p*k, v mod q = (p mod q)*k mod q v = (p * k) % (p * q) # unique in [0, n) once k mod q is known
- •
- •
Related
- •
Cards
- •
What structural weakness does this attack exploit, beyond just "the modulus is composite"?
- •
The secret value v was deliberately constructed as a multiple of one known factor (p), fixing v mod p trivially and leaving only v mod q to actually recover.
- •
- •
Why can chained blinding/unblinding operations be replayed independently mod q, ignoring p entirely?
- •
Arithmetic mod a composite n=pq is exactly tracked by its residues mod p and mod q separately (CRT), so every protocol step has an independent, valid "shadow" computation happening mod q alone.
- •
- •