LWE Attacks with Leaked Hints: DDGR20 by Hand
Fold side-channel or decryption-failure equations directly into a primal LWE basis using the DDGR20 framework and watch LLL recover the secret.
Prerequisite: CVP by Kannan Embedding
Suppose a power trace on an ML-KEM microcontroller leaks the noisy Hamming weight of 40 polynomial multiplications, or a cold-boot snapshot reveals 60 scattered bits of the secret key. Neither leak recovers by Gaussian elimination alone, yet clearly the remaining instance is weaker than a fresh NIST Level 3 key. At CRYPTO 2020, Dachman-Soled, Ducas, Gong, and Rossi (DDGR20) unified side-channel cryptanalysis and lattice reduction by showing how each leaked equation reshapes the primal Kannan lattice before BKZ ever starts.
The four DDGR20 hint types and their geometric effect
Recall from Primal LWE Attacks by Hand that a reducer wins when . Every useful hint improves that inequality through one of three levers: lowering dimension , increasing covolume (making competing lattice points sparser), or shrinking target variance :
| Hint type | Algebraic form | Geometric effect on | Typical physical source |
|---|---|---|---|
| Perfect hint | ⟨v, s⟩ = l (exact over ℤ) | Intersect with hyperplane; eliminates 1 lattice dimension & rescales covolume | Cold-boot bit recovery, faulted zero coefficient, exact Hamming-weight slice |
| Modular hint | ⟨v, s⟩ ≡ l (mod k) | Sparsifies lattice to an index-k sublattice; multiplies det(L) by k without raising d | CRT/NTT butterfly leak, partial key bits modulo 2^r |
| Approximate hint | ⟨v, s⟩ = l + ε (Var(ε) = σ_ε²) | Updates posterior mean μ and covariance Σ; anisotropic whitening W = Σ^(−1/2) | Power/EM template trace (SPA/DPA), decryption-failure inequality |
| Short-vector hint | v ∈ Λ known to be unusually short | Projects lattice orthogonally off span(v), dropping dimension by 1 | Algebraic ring structure or leaked trapdoor vector |
Worked example: folding perfect and modular hints into a 7D basis
Take with secret and error :
The standard Kannan row basis has rows , , and , containing target with .
- Fold a perfect hint : Substitute directly into : subtract column 0 of from to get and replace columns by the single column . The lattice drops from dimension 7 to dimension 6 while keeping , raising the normalized covolume from to !
- Fold a modular hint (parity leak): Write , shift , and double the -coordinate weight so the lattice enforces even steps along that coordinate (an index-2 sublattice, doubling at fixed dimension 6!).
Why approximate hints require whitening
What if a power trace instead tells you with Gaussian measurement noise ? You cannot intersect the lattice with a hard hyperplane because . Instead, Bayesian conditioning updates the secret's mean vector and shrinks its covariance matrix from to a correlated ellipsoid (via the Sherman–Morrison formula). Re-centering the Kannan target at and multiplying the secret block on the right by restores spherical isotropy while multiplying by !
Fold a perfect hint and verify LLL recovery in Python
from fractions import Fraction
def lll_rows(basis: list[list[int]], delta: Fraction = Fraction(3, 4)) -> list[list[int]]:
rows = [r[:] for r in basis]
def dot(u, v): return sum(x * y for x, y in zip(u, v))
def gs(mat):
ortho, mu = [], {}
for i, r in enumerate(mat):
rf = list(map(Fraction, r))
v = rf[:]
for j, o in enumerate(ortho):
mu[i, j] = dot(rf, o) / dot(o, o)
v = [vi - mu[i, j] * oi for vi, oi in zip(v, o)]
ortho.append(v)
return ortho, mu
k = 1
while k < len(rows):
for j in range(k - 1, -1, -1):
_, mu = gs(rows)
c = round(mu[k, j])
if c:
rows[k] = [rk - c * rj for rk, rj in zip(rows[k], rows[j])]
ortho, mu = gs(rows)
if delta * dot(ortho[k-1], ortho[k-1]) > dot(ortho[k], ortho[k]) + mu[k, k-1]**2 * dot(ortho[k-1], ortho[k-1]):
rows[k-1], rows[k] = rows[k], rows[k-1]
k = max(1, k - 1)
else:
k += 1
return rows
q = 97
A = [[14, 35, 81], [62, 19, 44], [27, 73, 12]]
s, e = [2, -1, 1], [1, -1, 0]
b = [(sum(a * si for a, si in zip(row, s)) + ei) % q for row, ei in zip(A, e)]
# Fold perfect hint s0 + s1 = 1 => s0 = 1 - s1 (dimension drops 7 -> 6!)
b_folded = [(b[i] - A[i][0]) % q for i in range(3)]
B_hint = [
[q, 0, 0, 0, 0, 0],
[0, q, 0, 0, 0, 0],
[0, 0, q, 0, 0, 0],
[(A[0][1] - A[0][0]) % q, (A[1][1] - A[1][0]) % q, (A[2][1] - A[2][0]) % q, 1, 0, 0],
[A[0][2], A[1][2], A[2][2], 0, 1, 0],
[-b_folded[0], -b_folded[1], -b_folded[2], 0, 0, 1],
]
v = lll_rows(B_hint)[0]
sgn = v[5]
s1_rec, s2_rec = sgn * v[3], sgn * v[4]
s0_rec = 1 - s1_rec
e_rec = [-sgn * c for c in v[:3]]
assert [s0_rec, s1_rec, s2_rec] == s and e_rec == e
print("Recovered s =", [s0_rec, s1_rec, s2_rec], "and e =", e_rec, "from 6D hinted lattice!")In full ML-KEM-768 (), each independent perfect bit hint roughly shaves off : leaking ~450 bits of secret information drops from 624 into practical sieving range () on a workstation running G6K or g6k-rs.