Path: blob/main/frontier/08-lattices-post-quantum/break/lll-low-dimension-attack.ipynb
483 views
Break: LLL Attack on Low-Dimension Lattice Scheme
Module 08 | Breaking Weak Parameters
When the lattice dimension is too small, the LLL algorithm tears through your encryption like tissue paper.
Why This Matters
Lattice-based cryptography relies on the hardness of finding short vectors in high-dimensional lattices. The LLL algorithm (notebook 08c) finds approximately short vectors in polynomial time, but its approximation factor degrades exponentially with dimension:
In low dimensions (), LLL often finds vectors much shorter than this worst-case bound --- sometimes close to the actual shortest vector. This means any lattice-based scheme using small dimensions is completely broken by a polynomial-time algorithm.
In this notebook, we set up a toy LWE-based encryption scheme, break it with LLL when the dimension is small, and observe how increasing the dimension makes the attack fail.
The Scenario: A Toy LWE Encryption Scheme
We build a simplified LWE-based encryption scheme with deliberately small parameters. The setup follows notebook 08d:
Key generation: Pick a random matrix and a secret vector with small entries. Compute where is a small error vector. The public key is ; the secret key is .
Attack goal: Given the public key , recover .
Recovering from is equivalent to solving a Closest Vector Problem (CVP) on the -ary lattice --- find the lattice point that is closest to . If the dimension is small enough, LLL + Babai's algorithm solves this instantly.
Step 2: Construct the Lattice
To attack LWE with lattice reduction, we embed the problem into a lattice. The -ary lattice associated with is:
We construct a lattice basis by stacking on top of . The target vector is close to the lattice point (displaced by the small error ). So recovering reduces to CVP.
Step 3: Apply LLL + Babai to Recover the Secret
Our attack has two phases:
LLL reduction: Apply
.LLL()to the lattice basis to get a reduced basis with short, nearly orthogonal vectors.Babai's nearest plane algorithm: Use the reduced basis to find the lattice point closest to . If the reduced basis is good enough, Babai's algorithm finds , from which we recover .
Step 5: Increasing Dimension Makes LLL Fail
Now we repeat the attack for increasing dimensions. As grows:
The lattice dimension grows (making LLL slower and less effective)
The error is harder to strip away (LLL's approximation degrades exponentially)
At some point, LLL + Babai can no longer find the closest lattice point
This is exactly the security mechanism of real-world lattice-based crypto.
The Fix: Use Real-World Dimensions
Modern lattice-based schemes use parameters far beyond LLL's reach:
| Scheme | Ring dimension | Module rank | Effective lattice dim | Security |
|---|---|---|---|---|
| ML-KEM-512 (Kyber) | 256 | 2 | ~512 | AES-128 equivalent |
| ML-KEM-768 (Kyber) | 256 | 3 | ~768 | AES-192 equivalent |
| ML-KEM-1024 (Kyber) | 256 | 4 | ~1024 | AES-256 equivalent |
At dimension 512+, even the most advanced lattice reduction algorithms (BKZ-2.0, G6K sieve) cannot find short enough vectors to break the scheme. The best known attacks require time , which for is astronomically large.
The appropriate noise level is chosen so that:
The error is large enough that lattice reduction cannot strip it away
The error is small enough that legitimate decryption still works (the noise does not overwhelm the message)
For Kyber, the error uses a centered binomial distribution with small parameter , giving coefficients in .
Summary
| Dimension | LLL Attack | Real-World Status |
|---|---|---|
| Instant break | Toy only | |
| Sometimes works | Still insecure | |
| Fails consistently | Marginal | |
| (Kyber) | No known attack | Standardized by NIST |
Key takeaways:
The LLL algorithm (from notebook 08c) combined with Babai's nearest plane algorithm can completely break LWE-based schemes when the dimension is small.
The attack works by reducing CVP on the -ary lattice to a short vector problem, which LLL handles well in low dimensions.
LLL's approximation factor degrades exponentially with dimension, so increasing makes the attack fail.
Real-world schemes (ML-KEM / Kyber) use with module structure, placing the effective lattice dimension at 512+ --- far beyond LLL's reach.
The fix: use dimension and appropriate noise. Dimension is the primary security knob.