Input Consistency in Two-Party Arithmetic MPC: Additive-Shift Attack and MAC Repair #
This module formalizes two complementary building blocks illustrating active input-consistency
vulnerabilities in unauthenticated two-party additive secret sharing over a prime field ZMod q
([Fact (Nat.Prime q)]) and their information-theoretic repair via random MAC authentication:
Corrupt-Party Additive-Shift Attack on
f(x) = x * (x - 1)(bitCheckPoly,AdditiveShare2,evalShiftedBitCheck,naiveBitCheckRealExp,naiveBitCheckIdealExp): SupposeP₀holds a secret bitx ∈ {0, 1} ⊆ ZMod qand shares it additively as(x₀, x₁)withx₀ + x₁ = x. In an unauthenticated arithmetic circuit evaluating the bit-check polynomialf(x) = x * (x - 1), a maliciousP₁can replace its sharex₁byx₁ + δfor an arbitrary offsetδ : ZMod q. We prove the exact algebraic evaluation identity $$f(x + \delta) = f(x) + \delta \cdot (2x + \delta - 1).$$ Forx ∈ {0, 1}andδ = 1, this simplifies tof(x + 1) = 2 * x, sof(0 + 1) = 0whilef(1 + 1) = 2. Wheneverq > 2is prime,2 ≠ 0inZMod q, so the circuit output deterministically revealsx(f(x + 1) = 0 ↔ x = 0andf(x + 1) = 2 ↔ x = 1), whereas the ideal functionality outputsf(x) = 0identically for bothx = 0andx = 1. In the explicitProbCompdistinguishing experiments, theδ = 1adversary achieves left-right distinguishing advantage1(versus0for any ideal-world observer) and hidden-bit recovery probability1(versus1 / 2in the ideal world).Random-MAC and Random-Linear-Combination Input-Authentication Repair (
SPDZ.AuthShare.tamperParty,mkAuthShare2,macSingleCheckGame,LinearCombAuthVec2,vecLinearCombCheckGame,vecBatchMacCheckGame):- Single authenticated share: authenticated inputs are two-party SPDZ shares
SPDZ.AuthShare q 2with public modifierδ = 0(mkAuthShare2). Given a uniform MAC keyα ← $ᵗ ZMod qunknown toP₁and a valid sharing of(x, t)witht = α * x, if a corruptP₁adds(δ_x, δ_t)to its value and MAC shares (SPDZ.AuthShare.tamperParty), the reconstructed checkSPDZ.AuthShare.Valid αpasses if and only ifα * δ_x = δ_t. For any nonzero input shiftδ_x ≠ 0, this holds with exact probability1 / q(viaSPDZ.eval_macKey_guess_eq). - Vector of
kinput shares: we package both (i) a batched vector-MAC / linear-code validity check (LinearCombAuthVec2) under a fresh uniform linear-combination keyr ← $ᵗ (Fin k → ZMod q), where honest shares pass with probability1and any nonzero tampering vectorδ ≠ 0passes with exact probability1 / q(viaCslib.Probability.toOuterMeasure_uniform_linearComb_eq), and (ii) a batched check (vecBatchMacCheckGame) ofkSPDZ-authenticated shares under independent random weightsr ← $ᵗ (Fin k → ZMod q)and scalar MAC keyα ← $ᵗ ZMod q, passing with probability1when honest and at most2 / qwhenδ_x ≠ 0; the tampered check has the distribution ofSPDZ.macCheckSoundnessGame, so the bound isSPDZ.probability_macCheckSoundnessGame_le.
- Single authenticated share: authenticated inputs are two-party SPDZ shares
Source mapping #
- Sections 1–2 formalize the attack in [BS23], Section 23.4.1, paragraph "Processing
inputs: a first idea" (printed p. 1035):
Q_jsharesx = x₁ + x₂, a corruptP₁adds one to its share, and the published output off(x) = x(x - 1)then reveals a binaryx. The source's input ownerQ_jand partiesP₁, P₂becomeP₀'s secret and the corrupt share holder here. Theq > 2hypothesis (needed for2 ≠ 0) and theProbCompreal/ideal distinguishing and bit-guessing games are original framing. - The source's repair, "Processing inputs: a second idea" (printed pp. 1035–1036, with its
analysis continuing to p. 1037), authenticates each input by
E = A * xbut checks it inside the circuit through validity codesDandFbuilt from shared triples. That in-circuit check, and a PPT-adversary treatment of the attack, are not formalized here; they remain open under #5829. - Section 3's single-share relation
α * δ_x = δ_tis the authentication-code checkK^{(i)} δ = δ^{(i)}of [BS23], Section 23.2.4.1, equation (23.2) (printed p. 1012), phrased on the SPDZ representation of [DPSZ12]. The batched scalar-MAC check of Section 4 is theMACCheckcheating equation of [DKL+13] (seeCslibFrontier.Crypto.Protocols.MPC.SPDZ). The standalone tampering games (macSingleCheckGame,vecLinearCombCheckGame,vecBatchMacCheckGame) and the linear-combination codeLinearCombAuthVec2are original.
Main definitions #
Cslib.Crypto.Protocols.MPC.InputConsistency.bitCheckPoly: the bit-check polynomialf(x) = x * (x - 1).Cslib.Crypto.Protocols.MPC.InputConsistency.AdditiveShare2,Cslib.Crypto.Protocols.MPC.InputConsistency.AdditiveShare2.reconstruct,Cslib.Crypto.Protocols.MPC.InputConsistency.AdditiveShare2.IsValidFor,Cslib.Crypto.Protocols.MPC.InputConsistency.AdditiveShare2.shiftShare1,Cslib.Crypto.Protocols.MPC.InputConsistency.evalShiftedBitCheck: two-party additive shares, corrupt share-1additive shift, and shifted bit-check evaluation.Cslib.Crypto.Protocols.MPC.InputConsistency.sampleAdditiveShare2,Cslib.Crypto.Protocols.MPC.InputConsistency.naiveBitCheckRealExp,Cslib.Crypto.Protocols.MPC.InputConsistency.naiveBitCheckIdealExp,Cslib.Crypto.Protocols.MPC.InputConsistency.shiftOneDistinguisher,Cslib.Crypto.Protocols.MPC.InputConsistency.naiveBitCheckRealLRGame,Cslib.Crypto.Protocols.MPC.InputConsistency.naiveBitCheckIdealLRGame,Cslib.Crypto.Protocols.MPC.InputConsistency.naiveBitCheckRealGuessGame,Cslib.Crypto.Protocols.MPC.InputConsistency.naiveBitCheckIdealGuessGame:ProbCompreal and ideal experiments and distinguishing games for theδ = 1attack.Cslib.Crypto.Protocols.MPC.InputConsistency.mkAuthShare2,Cslib.Crypto.Protocols.MPC.InputConsistency.macSingleCheckGame: two-party authenticated sharings withδ = 0and the single-input tampering check game (tampering isCslib.Crypto.Protocols.MPC.SPDZ.AuthShare.tamperParty).Cslib.Crypto.Protocols.MPC.InputConsistency.LinearCombAuthVec2,Cslib.Crypto.Protocols.MPC.InputConsistency.LinearCombAuthVec2.IsValidFor,Cslib.Crypto.Protocols.MPC.InputConsistency.LinearCombAuthVec2.tamper1,Cslib.Crypto.Protocols.MPC.InputConsistency.vecLinearCombCheckGame,Cslib.Crypto.Protocols.MPC.InputConsistency.batchMacCheckPasses,Cslib.Crypto.Protocols.MPC.InputConsistency.vecBatchMacCheckGame: vector input-sharing validity checks under fresh random linear-combination and MAC keys.
Main results #
Cslib.Crypto.Protocols.MPC.InputConsistency.bitCheckPoly_eq_zero_of_mem,Cslib.Crypto.Protocols.MPC.InputConsistency.bitCheckPoly_add,Cslib.Crypto.Protocols.MPC.InputConsistency.evalShiftedBitCheck_eq: exact algebraic evaluation identityf(x + δ) = f(x) + δ * (2 * x + δ - 1).Cslib.Crypto.Protocols.MPC.InputConsistency.bitCheckPoly_add_one_eq_zero_iff,Cslib.Crypto.Protocols.MPC.InputConsistency.bitCheckPoly_add_one_eq_two_iff: specialization toδ = 1and exact input recovery whenq > 2is prime.Cslib.Crypto.Protocols.MPC.InputConsistency.advantage_naiveBitCheckIdealLRGame,Cslib.Crypto.Protocols.MPC.InputConsistency.advantage_naiveBitCheckRealLRGame_shiftOne,Cslib.Crypto.Protocols.MPC.InputConsistency.probability_naiveBitCheckRealGuessGame,Cslib.Crypto.Protocols.MPC.InputConsistency.probability_naiveBitCheckIdealGuessGame,Cslib.Crypto.Protocols.MPC.InputConsistency.advantage_naiveBitCheckGuessGame: exact distinguishing advantages (1vs0) and bit-recovery probabilities (1vs1 / 2).Cslib.Crypto.Protocols.MPC.InputConsistency.probability_macSingleCheckGame_honest,Cslib.Crypto.Protocols.MPC.InputConsistency.probability_macSingleCheckGame_eq: single-share completeness and exact1 / qsoundness (throughCslib.Crypto.Protocols.MPC.SPDZ.AuthShare.valid_tamperParty_iff).Cslib.Crypto.Protocols.MPC.InputConsistency.LinearCombAuthVec2.tamper1_isValidFor_iff,Cslib.Crypto.Protocols.MPC.InputConsistency.probability_vecLinearCombCheckGame_honest,Cslib.Crypto.Protocols.MPC.InputConsistency.probability_vecLinearCombCheckGame_eq,Cslib.Crypto.Protocols.MPC.InputConsistency.batchMacCheckPasses_tamperParty_iff,Cslib.Crypto.Protocols.MPC.InputConsistency.probability_vecBatchMacCheckGame_honest,Cslib.Crypto.Protocols.MPC.InputConsistency.probability_vecBatchMacCheckGame_le: completeness (1) and soundness (1 / qand2 / q) fork-element input vectors.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 23.2.4.1 (equation (23.2), p. 1012) and Section 23.4.1 (pp. 1035–1037).
- I. Damgård, V. Pastro, N. P. Smart, S. Zakarias, Multiparty Computation from Somewhat Homomorphic Encryption.
- I. Damgård, M. Keller, E. Larraia, V. Pastro, P. Scholl, N. P. Smart, Practical Covertly Secure MPC for Dishonest Majority — Or: Breaking the SPDZ Limits.
1. Corrupt-party additive-shift attack on f(x) = x * (x - 1) #
The bit-check polynomial f(x) = x * (x - 1) over a ring R.
Output of the naive two-party bit-check circuit when corrupt P₁ adds offset δ to its
share before evaluation.
Any binary input x ∈ {0, 1} is a root of f(x) = x * (x - 1).
Exact algebraic shift identity: adding δ to x shifts f(x) = x * (x - 1) by
δ * (2 * x + δ - 1).
When s is a valid additive sharing of x, shifting P₁'s share by δ causes the naive
bit-check circuit to evaluate to f(x) + δ * (2 * x + δ - 1).
2. Explicit two-world distinguishing games for the δ = 1 shift attack #
Real-world experiment for secret bit b : Bool (x = if b then 1 else 0): P₀ samples a
uniform additive sharing of x, corrupt P₁ adds δ to its share, and the circuit outputs
evalShiftedBitCheck s δ.
In naiveBitCheckRealExp q δ b, the circuit deterministically outputs f(x + δ) regardless
of the random share x₀.
In the ideal world, naiveBitCheckIdealExp q b outputs 0 identically for both b = false
and b = true.
Distinguisher / bit-extractor for the δ = 1 attack: outputs true iff the circuit output
equals 2.
Ideal-world indistinguishability: every randomized distinguisher
D : ZMod q → ProbComp Bool has distinguishing advantage 0 between b = false (x = 0) and
b = true (x = 1) in the ideal world.
Real-world advantage 1: when q > 2 is prime, the δ = 1 shift adversary together with
shiftOneDistinguisher distinguishes b = false (x = 0) from b = true (x = 1) with
distinguishing advantage 1.
Hidden-bit recovery game in the real world (δ = 1): samples a uniform secret bit
b ← $ᵗ Bool, runs the shifted circuit, and checks whether shiftOneDistinguisher z = b.
Hidden-bit recovery game in the ideal world: samples a uniform secret bit b ← $ᵗ Bool,
runs the ideal bit-check circuit, and checks whether an arbitrary randomized observer
A : ZMod q → ProbComp Bool outputs b.
3. Random-MAC input-authentication repair on SPDZ.AuthShare #
Full single-input MAC verification game: samples a uniform MAC key α ← $ᵗ ZMod q and a
uniform two-party authenticated sharing of x (mkAuthShare2 with uniform x₀, t₀), lets
corrupt party 1 add (δ_x, δ_t) to its value and MAC shares, and checks the SPDZ MAC relation
SPDZ.AuthShare.Valid α (here t' = α * x', since δ = 0).
Honest single-input shares (δ_x = 0, δ_t = 0) pass macSingleCheckGame with probability
1.
Exact 1 / q single-input MAC soundness: for prime q and any nonzero input shift
δ_x ≠ 0, macSingleCheckGame q x δ_x δ_t accepts with probability exactly 1 / q.
4. Vector of k input shares: random-linear-combination and batched MAC checks #
Two-party vector input sharing of length k over R authenticated by a single batched
linear-combination MAC tag t = ∑ j, r j * x j.
- vals : Fin k → AdditiveShare2 R
Coordinatewise additive sharings
(x_{j,0}, x_{j,1})of thekinput elements. - tag : AdditiveShare2 R
Additive sharing
(t₀, t₁)of the batched linear-combination MAC tag.
Instances For
Reconstructed vector of k secret inputs j ↦ x_{j,0} + x_{j,1}.
Reconstructed batched MAC tag t₀ + t₁.
Validity predicate under linear-combination key r : Fin k → R:
t = ∑ j, r j * x j.
Corrupt party P₁ adds an offset vector δ : Fin k → R to its input shares and δ_t : R
to its MAC tag share.
Vector linear-combination tampering equivalence: when v is valid under r, the
tampered submission v.tamper1 δ δ_t satisfies t' = ∑ j, r j * x' j if and only if
∑ j, r j * δ j = δ_t.
Every vector sharing in the support of sampleLinearCombAuthVec2 q k r x satisfies
IsValidFor r.
Two-party vector input-consistency game under a fresh uniform linear-combination key
r ← $ᵗ (Fin k → ZMod q): samples r and valid additive shares of x, applies P₁'s
tampering (δ, δ_t), and checks t' = ∑ j, r j * x' j.
Honest vector shares (δ = 0, δ_t = 0) pass vecLinearCombCheckGame with probability 1.
Exact 1 / q vector soundness (ℝ≥0∞): for prime q and any nonzero tampering vector
δ ≠ 0, vecLinearCombCheckGame q k x δ δ_t accepts with exact probability q⁻¹.
Batched MAC verification predicate for k SPDZ authenticated shares under global MAC key α
and random linear-combination weights r : Fin k → ZMod p:
∑ j, r j * γ_j = α * ∑ j, r j * (a_j + δ_j), the MAC relation SPDZ.AuthShare.Valid α of the
r-weighted combination of the shares.
Instances For
Batched scalar-MAC tampering equivalence: when every s j is valid under α, party i's
tampering by (δ_x, δ_t) passes batchMacCheckPasses alpha r if and only if
α * ∑ j, r j * δ_x j = ∑ j, r j * δ_t j.
Batched k-share MAC check game: samples a fresh uniform MAC key α ← $ᵗ ZMod q and fresh
uniform linear-combination weights r ← $ᵗ (Fin k → ZMod q), generates uniform two-party
authenticated sharings mkAuthShare2 of each x j, lets corrupt party 1 add (δ_x j, δ_t j) to
its shares of the j-th input, and checks batchMacCheckPasses alpha r.
Honest shares (δ_x = 0, δ_t = 0) pass vecBatchMacCheckGame with probability 1.
Batched k-share scalar-MAC soundness (≤ 2 / q): for prime q and any nonzero input
tampering vector δ_x ≠ 0, vecBatchMacCheckGame q k x δ_x δ_t passes with probability at most
2 / q; this is SPDZ.probability_macCheckSoundnessGame_le applied to the cheating equation the
tampering induces.