Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

One feedback attack witnesses corruption and hash-key entropy leakage

Open
QAlgorithms.Papers.Independent.Intake100.P41.recycling_leakage_attack

by Gohan · Oct 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

Let KKK be finite and nonempty, let XXX contain at least two messages, let T={0,1}mT=\{0,1\}^mT={0,1}m, and suppose h:K×X→Th:K\times X\to Th:K×X→T is 1/∣T∣1/|T|1/∣T∣-AXU2_22​. Choose the hash key uniformly once and use an independent perfect uniform pad for every authentication round. Suppose 1≤n≤∣T∣1\le n\le |T|1≤n≤∣T∣. Eve chooses the honest messages, intercepts each valid tagged message, substitutes a pair, and learns its verification result before the next round. There is one attack, chosen independently of the secret key and pads, such that

Pr⁡[at least one changed message is accepted in rounds 1,…,n]≥n∣T∣,\Pr[\text{at least one changed message is accepted in rounds }1,\ldots,n]\ge\frac{n}{|T|},Pr[at least one changed message is accepted in rounds 1,…,n]≥∣T∣n​,

and, for that same attack,

H(K∣Zn)≤log⁡2∣K∣∣T∣+(1−n∣T∣)log⁡2(∣T∣−n).H(K\mid Z_n)\le\log_2\frac{|K|}{|T|}+\left(1-\frac{n}{|T|}\right)\log_2(|T|-n).H(K∣Zn​)≤log2​∣T∣∣K∣​+(1−∣T∣n​)log2​(∣T∣−n).

The transcript ZnZ_nZn​ contains the honest and substituted messages, original and substituted tags, and all acceptance or rejection bits; the attack's fixed public choices are implicit constants. Entropy is Shannon entropy in bits of the retained hash key alone. At n=∣T∣n=|T|n=∣T∣ the second summand is interpreted as zero. The result shows leakage sufficient for certain forgery at saturation, while the residual key entropy can remain log⁡2(∣K∣/∣T∣)\log_2(|K|/|T|)log2​(∣K∣/∣T∣).

Formalization Note Conditional entropy is computed by averaging posterior-key entropy over the finite uniform key-and-pad sample space; no finite-message assumption is needed.

Preamble
import Definitions.Def_QAlgorithms_Papers_Independent_Intake100_P41
Formal statement
noncomputable section

open scoped BigOperators

namespace QAlgorithms.Papers.Independent.Intake100.P41

open QAlgorithms.Papers.Independent.Bridge50.P44 (xorWord verifyTag)

attribute [local instance] Classical.propDecidable Classical.decEq

/-- PDF pp.16--17, Theorem 8: one attack witnesses both the n/|T| success lower
bound and the conditional hash-key entropy upper bound. The full public trace
includes both tags and all verification feedback. The endpoint n = |T| is kept;
its residual entropy is log2(|K|/|T|), not necessarily zero. -/
theorem recycling_leakage_attack {K X : Type*} [Fintype K] [Nonempty K]
    [Nontrivial X] {m n : ℕ} (hn : 1 ≤ n) (hnmax : n ≤ Fintype.card (Tag m))
    (h : K → X → Tag m) (hh : IsAXU2 h (1 / (Fintype.card (Tag m) : ℝ))) :
    ∃ a : AdaptiveAttack X (Tag m),
      (n : ℝ) / (Fintype.card (Tag m) : ℝ) ≤
        uniformProbability (fun seed : K × (Fin n → Tag m) =>
          corrupts (attackTrace h a seed.1 seed.2)) ∧
      conditionalKeyEntropy (fun seed : K × (Fin n → Tag m) =>
        attackTrace h a seed.1 seed.2) ≤ leakageBound K m n := by sorry

end QAlgorithms.Papers.Independent.Intake100.P41

end
Source
Key recycling in authentication, arXiv:1202.1229v3, PDF p. 16, Theorem 8
Read-back

What the Lean code literally says, in plain math · gpt-6.1-sol

Let KKK be any finite nonempty set, let XXX be any type with at least two distinct elements, and let m,nm,nm,n be natural numbers with 1≤n≤t:=2m1\le n\le t:=2^m1≤n≤t:=2m. Tags are mmm-bit strings, and ⊕\oplus⊕ denotes coordinatewise exclusive-or. Let h:K×X→{0,1}mh:K\times X\to\{0,1\}^mh:K×X→{0,1}m satisfy, for every pair of distinct messages x,y∈Xx,y\in Xx,y∈X and every tag ccc, Pr⁡k uniform in K[h(k,x)⊕h(k,y)=c]≤1/t\Pr_{k\text{ uniform in }K}[h(k,x)\oplus h(k,y)=c]\le 1/tPrk uniform in K​[h(k,x)⊕h(k,y)=c]≤1/t. There exists an adaptive attack consisting of a function choosing a message from the previous transcript and a function choosing a submitted message–tag pair from that transcript and the current honest message–tag pair, with the following properties. Choose kkk uniformly from KKK and independently choose nnn uniform tags p0,…,pn−1p_0,\ldots,p_{n-1}p0​,…,pn−1​. Starting with an empty transcript, in round iii the attack chooses xix_ixi​, receives ti=h(k,xi)⊕pit_i=h(k,x_i)\oplus p_iti​=h(k,xi​)⊕pi​, submits a pair (yi,si)(y_i,s_i)(yi​,si​), and appends (xi,ti,(yi,si),bi)(x_i,t_i,(y_i,s_i),b_i)(xi​,ti​,(yi​,si​),bi​), where bib_ibi​ is true exactly when si=h(k,yi)⊕pis_i=h(k,y_i)\oplus p_isi​=h(k,yi​)⊕pi​. Writing ZZZ for this full nnn-round transcript, the probability that some round has bi=trueb_i=\mathrm{true}bi​=true and yi≠xiy_i\ne x_iyi​=xi​ is at least n/tn/tn/t, and

H(K∣Z)≤log⁡2 ⁣(∣K∣t)+{0,n=t,(1−n/t)log⁡2(t−n),n≠t.H(K\mid Z)\le \log_2\!\left(\frac{|K|}{t}\right)+ \begin{cases} 0,&n=t,\\ (1-n/t)\log_2(t-n),&n\ne t. \end{cases}H(K∣Z)≤log2​(t∣K∣​)+{0,(1−n/t)log2​(t−n),​n=t,n=t.​

Here H(K∣Z)H(K\mid Z)H(K∣Z) means the uniform average over all seeds (k,p0,…,pn−1)(k,p_0,\ldots,p_{n-1})(k,p0​,…,pn−1​) of −∑k′∈Kp(k′∣Z)log⁡2p(k′∣Z)-\sum_{k'\in K}p(k'\mid Z)\log_2 p(k'\mid Z)−∑k′∈K​p(k′∣Z)log2​p(k′∣Z), where p(k′∣z)p(k'\mid z)p(k′∣z) is the uniform probability of “key k′k'k′ and transcript zzz” divided by the uniform probability of transcript zzz. Division by zero is defined as zero, and zero-probability entropy terms contribute zero. The quantifiers include m=0m=0m=0, in which case there is one tag and necessarily n=1n=1n=1; they also include the endpoint n=tn=tn=t.

Human review
  • Endorsed by Shuze Chen · Oct 30, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 30, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me