Revisiting MAC Forgeries, Weak Keys and Provable Security of GCM
Bo Zhu, Yin Tan and Guang Gong University of Waterloo, Canada
CANS 2013 Nov 20, 2013
1 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
Revisiting MAC Forgeries, Weak Keys and Provable Security of GCM Bo - - PowerPoint PPT Presentation
Revisiting MAC Forgeries, Weak Keys and Provable Security of GCM Bo Zhu, Yin Tan and Guang Gong University of Waterloo, Canada CANS 2013 Nov 20, 2013 1 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM Galois/Counter Mode (GCM)
CANS 2013 Nov 20, 2013
1 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ One design of AEAD by McGrew and Viega in 2005
◮ Counter Mode (CM) for encryption ◮ Galois MAC (GMAC) for authentication ◮ Polynomial-based MAC
◮ Features
◮ Parallelizable computation ◮ Intel CPU hardware instructions (around 1 cycle/byte) ◮ IEEE 802.1AE, IPsec, and TLS v1.2 ◮ To replace RC4 and AES-CBC in TLS 2 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ One design of AEAD by McGrew and Viega in 2005
◮ Counter Mode (CM) for encryption ◮ Galois MAC (GMAC) for authentication ◮ Polynomial-based MAC
◮ Features
◮ Parallelizable computation ◮ Intel CPU hardware instructions (around 1 cycle/byte) ◮ IEEE 802.1AE, IPsec, and TLS v1.2 ◮ To replace RC4 and AES-CBC in TLS
◮ Recent attacks
◮ A flaw found in GCM’s security proofs in Crypto’12 ◮ Forgery attacks in FSE’12 and FSE’13 2 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
3 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
4 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Authentication key: H = EK(0)
The image is from Procter and Cid’s slides in FSE’13. 5 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ GMAC = GHASHH(A, C) + EK(N)
◮ N: non-repeating nonce
◮ GHASH-like, polynomial based (keyed) hash
m
◮ Note: constant term is zero
6 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
The image is from Saarinen’s paper in FSE’12.
◮ Initial counter
◮ If len(N) = 96, Y0 = N||032 ◮ If len(N) = 96, Y0 = GHASHH(N)
◮ Consecutive counters
7 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
8 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ General forgeries by Procter and Cid in FSE’13
◮ Based on the work by Saarinen in FSE’12
◮ Attacking the polynomial-based hash functions
m
9 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ General forgeries by Procter and Cid in FSE’13
◮ Based on the work by Saarinen in FSE’12
◮ Attacking the polynomial-based hash functions
m
◮ If we can find a polynomial f (x) ∈ F[x]
◮ Constant term is zero ◮ f (H) = 0 9 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ General forgeries by Procter and Cid in FSE’13
◮ Based on the work by Saarinen in FSE’12
◮ Attacking the polynomial-based hash functions
m
◮ If we can find a polynomial f (x) ∈ F[x]
◮ Constant term is zero ◮ f (H) = 0
9 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
10 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ q(H) = 0 ◮ Note: constant term Q0 does NOT need to be zero
10 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ q(H) = 0 ◮ Note: constant term Q0 does NOT need to be zero
10 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ q(H) = 0 ◮ Note: constant term Q0 does NOT need to be zero
10 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Definition of weak key classes by Handschuh and Preneel
◮ Members of the key class make the algorithm behaves in an
unexpected way
◮ e.g., high probability for MAC forgeries ◮ Easy to detect whether a key belongs to the class ◮ e.g., less #queries than #elements of the class 11 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Definition of weak key classes by Handschuh and Preneel
◮ Members of the key class make the algorithm behaves in an
unexpected way
◮ e.g., high probability for MAC forgeries ◮ Easy to detect whether a key belongs to the class ◮ e.g., less #queries than #elements of the class
◮ For any subset of authentication keys, we can determine if the
◮ Try to make a forgery by
q(x) =
n
(x ⊕ Hi) and query the verification oracle once
11 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Definition of weak key classes by Handschuh and Preneel
◮ Members of the key class make the algorithm behaves in an
unexpected way
◮ e.g., high probability for MAC forgeries ◮ Easy to detect whether a key belongs to the class ◮ e.g., less #queries than #elements of the class
◮ For any subset of authentication keys, we can determine if the
◮ Try to make a forgery by
q(x) =
n
(x ⊕ Hi) and query the verification oracle once
◮ For comparison, the original forgery attack by Procter and Cid
◮ Cannot get rid of 0 by only one query ◮ For |S| ≥ 3, use two queries ◮ For |S| ≥ 2 and 0 ∈ S, use one query 11 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
12 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Previously mentioned forgery attacks are all trial-and-error
◮ (Perhaps randomly) choose a q(x) ◮ Forge a tuple (N, M, T) and send it to verification oracle ◮ If fails, try another q(x) 13 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Previously mentioned forgery attacks are all trial-and-error
◮ (Perhaps randomly) choose a q(x) ◮ Forge a tuple (N, M, T) and send it to verification oracle ◮ If fails, try another q(x)
◮ GCM’s special structure can amplify this probability
◮ GHASH is reused to compute the initial counter number if
len(N) = 96.
◮ Previous forgeries also work for this GHASH 13 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Previously mentioned forgery attacks are all trial-and-error
◮ (Perhaps randomly) choose a q(x) ◮ Forge a tuple (N, M, T) and send it to verification oracle ◮ If fails, try another q(x)
◮ GCM’s special structure can amplify this probability
◮ GHASH is reused to compute the initial counter number if
len(N) = 96.
◮ Previous forgeries also work for this GHASH
◮ New forgery attack
13 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Previously mentioned forgery attacks are all trial-and-error
◮ (Perhaps randomly) choose a q(x) ◮ Forge a tuple (N, M, T) and send it to verification oracle ◮ If fails, try another q(x)
◮ GCM’s special structure can amplify this probability
◮ GHASH is reused to compute the initial counter number if
len(N) = 96.
◮ Previous forgeries also work for this GHASH
◮ New forgery attack
◮ Once a collision is found
◮ Obtain a polynomial for more forgeries ◮ Solve the equation to get the auth key 13 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
14 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Security of GCM highly depends the prob of counter collisions
◮ Y ′
r1 = Y ′′ r2
15 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Security of GCM highly depends the prob of counter collisions
◮ Y ′
r1 = Y ′′ r2
◮ if len(N) = 96, GHASH(N1) ⊞ r1 = GHASH(N2) ⊞ r2 15 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Security of GCM highly depends the prob of counter collisions
◮ Y ′
r1 = Y ′′ r2
◮ if len(N) = 96, GHASH(N1) ⊞ r1 = GHASH(N2) ⊞ r2
15 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Security of GCM highly depends the prob of counter collisions
◮ Y ′
r1 = Y ′′ r2
◮ if len(N) = 96, GHASH(N1) ⊞ r1 = GHASH(N2) ⊞ r2
15 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Security of GCM highly depends the prob of counter collisions
◮ Y ′
r1 = Y ′′ r2
◮ if len(N) = 96, GHASH(N1) ⊞ r1 = GHASH(N2) ⊞ r2
◮ For a randomly chosen H, the collision probability is
15 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Security of GCM highly depends the prob of counter collisions
◮ Y ′
r1 = Y ′′ r2
◮ if len(N) = 96, GHASH(N1) ⊞ r1 = GHASH(N2) ⊞ r2
◮ For a randomly chosen H, the collision probability is
◮ In the original proofs of GCM, it was believed it has the same
15 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Pointed out by Iwata et al. in Crypto’12 ◮ Yr ⊞ 1 is non-linear in Galois field ◮
16 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Pointed out by Iwata et al. in Crypto’12 ◮ Yr ⊞ 1 is non-linear in Galois field ◮
◮ Much more solutions than the expected
◮ αr times more solutions
◮ for r < 232, αr is up to 222
16 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ New security bounds of GCM were also given by Iwata et al.
◮ for both of privacy (encryption) and authenticity (MAC) ◮ almost 222 looser than the originally claimed 17 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ New security bounds of GCM were also given by Iwata et al.
◮ for both of privacy (encryption) and authenticity (MAC) ◮ almost 222 looser than the originally claimed
◮ It would be better to repair GCM s.t.
◮ retain the original bounds, and ◮ leave original proofs largely unchanged ◮ with a small fix to the original design 17 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Generally in CM, the counter is incremented by 1, i.e.
18 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Generally in CM, the counter is incremented by 1, i.e.
◮ CM is secure if next() outputs uniquely
◮ next() is indistinguishable if the underlying block cipher is
secure
18 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Generally in CM, the counter is incremented by 1, i.e.
◮ CM is secure if next() outputs uniquely
◮ next() is indistinguishable if the underlying block cipher is
secure
◮ McGrew, Counter Mode Security: Analysis and
◮ The details of the next-counter function are unimportant; ◮ That function does not provide any security properties other
than the uniqueness of the inputs to the block cipher.
18 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Generally in CM, the counter is incremented by 1, i.e.
◮ CM is secure if next() outputs uniquely
◮ next() is indistinguishable if the underlying block cipher is
secure
◮ McGrew, Counter Mode Security: Analysis and
◮ The details of the next-counter function are unimportant; ◮ That function does not provide any security properties other
than the uniqueness of the inputs to the block cipher.
◮ Design a different next() to “fix” GCM?
18 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ non-repeating 19 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ non-repeating
19 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ non-repeating
◮ e.g., f (x) ⊞ r1 = g(x) ⊞ r2 ⇔ f (x) ⊞ (r1 − r2) = g(x) ◮ to keep the original proofs largely unchanged 19 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ addition, i.e. XOR
◮ not a permutation ◮ unless defined as next(Y , r) = Y ⊕ r, with r as an index ◮ but f ⊕ r1 = g ⊕ r2
⇒ f ⊕ (r1 − r2) = g
◮ e.g., f ⊕ 2 = g ⊕ 1 implies ◮ f ⊕ 2 ⊕ 1 = f ⊕ 3 = g ◮ but not f ⊕ (2 − 1) = f ⊕ 1 = g
◮ multiplication, by a constant
◮ multiplying with a primitive element w ◮ w r1f = w r2g =
⇒ w r1−r2f = g
◮ cyclic permutation, but with two cycles ◮ {1, w, w 2, · · · , w 2n−2}, and {0} 20 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
21 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Lw(x) is a full-cycle permutation ◮ Lr1 w(f (x)) = Lr2 w(g(x)) ⇔ Lr1−r2 w
21 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Lw(x) is a full-cycle permutation ◮ Lr1 w(f (x)) = Lr2 w(g(x)) ⇔ Lr1−r2 w
◮ Next, to investigate the number of solutions for
w(f (x)) = g(x)
21 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
w(f (x)) = g(x)
1.1 If Lr
w(f (x)) = 0, then g(x) = 0.
1.2 If Lr
w(f (x)) = 0, then g(x) = w r−1.
2.1 If Lr
w(f (x)) = 0, then g(x) = 0.
2.2 If Lr
w(f (x)) = 0, let f (x) = w r1 and Lr w(f (x)) = w r2, where
0 ≤ r1, r2 < 2n − 1. Then we have
2.2.1 If r1 ≤ r2, then w rf (x) = g(x). 2.2.2 If r1 > r2, then w r−1f (x) = g(x).
22 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
w(f (x)) = g(x)
1.1 If Lr
w(f (x)) = 0, then g(x) = 0.
1.2 If Lr
w(f (x)) = 0, then g(x) = w r−1.
2.1 If Lr
w(f (x)) = 0, then g(x) = 0.
2.2 If Lr
w(f (x)) = 0, let f (x) = w r1 and Lr w(f (x)) = w r2, where
0 ≤ r1, r2 < 2n − 1. Then we have
2.2.1 If r1 ≤ r2, then w rf (x) = g(x). 2.2.2 If r1 > r2, then w r−1f (x) = g(x).
22 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ Replacing counter ⊞ 1 by Lw
w(Y0) ◮ The upper bound of counter collision will decrease
◮ from 222d to 22d
◮ Tighten the bounds of GCM by around 220 (1 million) times
◮ both privacy and authenticity 23 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
24 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ The attacks focus on the MAC scheme ◮ Successful forgeries will render the encryption not trustworthy
25 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ The attacks focus on the MAC scheme ◮ Successful forgeries will render the encryption not trustworthy ◮ Previous papers mentioned one straightforward way to fix this
◮ Change GCM to MAC-then-Enc ◮ Computer T from P ◮ Encrypt T by CM encryption 25 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ The attacks focus on the MAC scheme ◮ Successful forgeries will render the encryption not trustworthy ◮ Previous papers mentioned one straightforward way to fix this
◮ Change GCM to MAC-then-Enc ◮ Computer T from P ◮ Encrypt T by CM encryption
◮ However, since the forgery attacks are based the linear
◮ Also penetrate Counter Mode ◮ Applying q(x) to C is equivalent to applying to P ◮ Please see our paper for details and computational examples 25 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
26 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
◮ All polynomials can be used in the forgery attacks
◮ With or without constant terms
◮ All subsets with at least two authentication keys are weak
◮ Only one query to verification oracle
◮ How to turn forgery attacks to birthday attacks
◮ Attack encryption oracle instead of verification oracle ◮ To increase forgery success probabilities
◮ A simple fix to GCM
◮ Improve security bounds of GCM by a factor of around 220 ◮ Keep most parts of security proofs unchanged
◮ MAC-then-Enc won’t make GCM more secure
27 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM
28 of 28 MAC Forgeries, Weak Keys and Provable Security of GCM