CBC-MAC Finite Uniform-Random-Function Bounds and Forgery Separations #
Formalizes the Cipher Block Chaining Message Authentication Code (CBC-MAC) over BitString n, its
prefix-free smoothness, the information-theoretic uniform-random-function step
abs_cbcUniformFunctionSuccess_sub_cbcIdealSuccess_le (#6046) toward prefix-free CBC-MAC PRF
security ([BS23], Section 6.4.1, Theorem 6.3, pp. 226–229; [KL20], Section
4.4.2, pp. 123–127) bounding cbcMacFinite g for a uniform random function
g : BitString n → BitString n rather than a keyed computational PRF, and explicit forgery
counterexamples for six relaxations of basic CBC-MAC ([KL20], Section 4.4, pp. 120–127,
and Chapter 4 Exercises, p. 140ff.; interior [KL20] numbering from the existing module
notes, see manual/sources.md).
Main definitions #
cbcMacBlocks,CBCInput,cbcInputBlocks,cbcMacFinite: basic CBC-MAC block folding and bounded nonempty block-vector domain.CBCPrefixFree,CBCSmooth: prefix-free query-list predicate and(q, ℓ, δ)-smoothness for random-function CBC-MAC.CBCOracleSpec,cbcQueryRun,CBCAdmissible,cbcUniformFunctionSuccess,cbcIdealSuccess: adaptive oracle distinguishers asOracleComp (CBCOracleSpec n ℓ) Boolprograms, their query-logging run throughOracleComp.interpret, the execution-based prefix-free query budget, and uniform-block-function vs. ideal-MAC acceptance probabilities for the information-theoretic step (#6046).ForgeryTrace,ForgeryTrace.Valid,cbcTwoToFourAttack,cbcToThreeAttack,cbcAllTagsTwo,cbcLeakedTagsAttack,cbcRandomIVMac,cbcRandomIVAttack,lengthAppendedCBC,cbcLengthSuffixAttack,zeroPadCBC,zeroPadAttack: explicit CBC-MAC forgery constructions for Exercises 4.13–4.16 (the all-ones block is(1 : BitString n), zero padding isList.rightpad, and block splitting isBitString.padBlocks).
Main results #
cbcMacBlocks_append,getLast_cbcEncryptBlocks_eq_cbcMacBlocks: chaining composition identity and equivalence between the final block ofcbcEncryptBlocksandcbcMacBlocks.cbcSmooth_iff,cbcSmooth_of_prefixFree: counting characterization and(q, ℓ, q^2 * ℓ^2 / (2 * 2^n))-smoothness of prefix-free CBC-MAC, sharpening [KL20], Claim 4.13.abs_cbcUniformFunctionSuccess_sub_cbcIdealSuccess_le: information-theoretic uniform-random-function step|cbcUniformFunctionSuccess - cbcIdealSuccess| ≤ q^2 * ℓ^2 / (2 * 2^n)(#6046) toward prefix-free CBC-MAC PRF security ([BS23], Section 6.4.1, Theorem 6.3, pp. 226–229; [KL20], Section 4.4.2), boundingcbcMacFinite gfor a uniform random functiong : BitString n → BitString nrather than a keyed computational PRF.cbcTwoToFourAttack_valid,cbcToThreeAttack_valid,cbcLeakedTagsAttack_valid,cbcRandomIVAttack_valid,cbcLengthSuffixAttack_valid_any_encoding,cbcLengthSuffixAttack_valid,rightpad_false_true_collide,zeroPadAttack_valid: probability-1forgery attacks when prefix-freeness, tag hiding, fixed zero IV, length prepending, or injective padding is violated ([KL20], Exercises 4.13–4.16).
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 6.4.1, Theorem 6.3, pp. 226–229.
- J. Katz, Y. Lindell, Introduction to Modern Cryptography, 3rd ed.,
Section 4.4 (pp. 120–127) and Chapter 4 Exercises (p. 140ff.; interior theorem/exercise numbers
not re-audited against the Chapter 4 body, see
manual/sources.md).
CBC-MAC chaining ([KL20], Section 4.4, Construction 4.9): folds the CBC step
state ↦ g (state + block) across a list of n-bit blocks starting from iv (which is 0 in
standard basic CBC-MAC).
Chaining identity for cbcMacBlocks: processing xs ++ ys from iv is identical to
processing ys from the intermediate tag cbcMacBlocks g iv xs.
The final block of multi-block CBC encryption (cbcEncryptBlocks) on a nonempty message
equals the cbcMacBlocks tag from the same initial state iv.
CBC smoothness ([KL20], Section 4.4, p. 125): CBCSmooth n q ℓ δ states that
for every injective family of q prefix-free queries of at most ℓ blocks and every
assignment of target tags tags : Fin q → BitString n, a uniform random function g : BitString n → BitString n satisfies ∀ i, cbcMacFinite g (inputs i) = tags i with probability
at least (1 - δ) * 2^(-n * q).
Counting characterization of CBCSmooth.
The oracle interface of CBC-MAC distinguishers: a query is a bounded nonempty block input
CBCInput n ℓ, answered by an n-bit tag.
Run an oracle program against a fixed oracle CBCInput n ℓ → BitString n, interpreting each
call with OracleComp.interpret in the writer monad that logs the query. Returns the output
together with the list of queried inputs, in order and with repetitions.
One oracle call: the output and log of the continuation on the answer, after the query.
The output of cbcQueryRun is the plain interpretation of the program with the oracle.
An oracle program is q-admissible if, run against every fixed oracle, its queries are
prefix-free and it makes at most q of them. Quantifying over executions keeps paths that no
consistent oracle produces (inconsistent answers to repeated queries) out of the restriction.
Acceptance probability of a distribution D over adaptive oracle programs when interacting with
cbcMacFinite g over a uniform random block function g : BitString n → BitString n (not a
keyed computational PRF; #6046).
Ideal-world acceptance probability of a distribution D over adaptive oracle programs when
interacting with a uniform random function f : CBCInput n ℓ → BitString n.
Information-theoretic uniform-random-function step (#6046) toward prefix-free CBC-MAC PRF
security ([BS23], Section 6.4.1, Theorem 6.3, pp. 226–229; [KL20], Section
4.4.2, pp. 123–127), bounding cbcMacFinite g for a uniform random function
g : BitString n → BitString n rather than a keyed computational PRF: for every block width n,
query budget q, maximum block length ℓ, and distribution D over q-admissible adaptive
oracle programs, the distinguishing advantage between cbcMacFinite g and a uniform random
function f : CBCInput n ℓ → BitString n is at most q^2 * ℓ^2 / (2 * 2^n).
The trace of a deterministic MAC forgery attack: the messages it queried, and the message and tag it outputs.
A forgery trace is valid against the tagging function mac if its message was never queried
and mac gives it the claimed tag.
cbcTwoToFourAttack succeeds with probability 1 against every round function g using a
single 2-block query and forging a fresh 4-block message ([KL20], Exercise 4.13(a),
p. 142).
cbcToThreeAttack succeeds with probability 1 against every round function g using two
queries ([0] and [0, 0]) and forging the fresh 3-block message [0, g(0), 0]
([KL20], Exercise 4.13(b), p. 142).
Leaked-intermediate-tags forgery attack ([KL20], Exercise 4.14(a), p. 142):
queries (0, 0), (1^n, 0), and (1^n, 1^n), and uses the leaked first-block tags to forge a
fresh 2-block message: (0, 1^n) with tag c when a.1 = b.1, or (0, a.1 + b.1) with tag
(a.1, b.2) otherwise.
cbcLeakedTagsAttack makes 3 queries and outputs a valid fresh 2-block forgery against
cbcAllTagsTwo g for every round function g whenever 0 < n ([KL20], Exercise
4.14(a), p. 142).
cbcRandomIVAttack produces a fresh 1-block message 1^n ≠ 0 whose random-IV CBC-MAC tag
(cbcRandomIVMac) validates for every iv and g whenever 0 < n ([KL20],
Exercise 4.14(b), p. 142).
cbcLengthSuffixAttack succeeds with 3 queries against lengthAppendedCBC for every
encodeLength and g whenever 0 < n ([KL20], Exercise 4.15, p. 142).
For a single-block length encoding and 4 ≤ n, all queries and the forged message of
cbcLengthSuffixAttack also satisfy the < 2^n bit-length bound ([KL20], Exercise
4.15, p. 142).
Insecure zero-padded CBC-MAC for messages of length at most ℓ * 2^n bits: right-pad with
false bits to length ℓ * 2^n (List.rightpad), then split into the (ℓ * 2^n) / n blocks of
BitString.padBlocks (the floor block count; exact when n ∣ ℓ * 2^n) ([KL20],
Exercise 4.16, p. 142).
zeroPadAttack succeeds with 1 query against zeroPadCBC for every 0 < n, 0 < ℓ, and
g ([KL20], Exercise 4.16, p. 142).