Extension fields and MPC

Extension fields play an important role in secure multi-party computation, especially in protocols based on Shamir's secret-sharing scheme. Incorrect usage of extension fields leads, perhaps not surprisingly, to incorrect and/or insecure protocol behavior. This post takes a closer look at why that is.

Shamir's secret-sharing requires us to associate a unique element from the computation domain to each party, as well as another element (usually 0) which we associate with the secret. This naturally means that to perform a secure multi-party computation with \( n \) parties, using Shamir' secret-sharing, we will need to use a finite field \( \mathbb{F} \) with at least \( n + 1 \) elements. If we wish to do a binary computation—a computation consisting of XORs and ANDs—then we would reach for \( \mathbb{F} = \mathbb{Z}/2\mathbb{Z} \). But this field contains just enough elements to support one secret and one party, which is not very useful.

Binary computations on Shamir secret-shares

To perform a binary multi-party computation with Shamir secret-shares between \( n \) parties, each holding a secret bit \( b_i \in \{0, 1\} \), we would use an extension of \( \mathbb{F}_2 \) that is large enough to accomodate the \( n \) parties.

That is, we will use \( \mathbb{F}_{2^k} \) with \( k > \log_2(n) \) and then:

  1. Embed \( b_i \) in \( \mathbb{F}_{2^k} \) in the obvious way.1 Call this embedded value \( \hat{b}_i \).
  2. Secret share \( \hat{b}_i \) as \( [\hat{b}_i] \).
  3. Compute on these shares using the linearity of the shares, and whatever sub-protocol we chose for multiplication. The output of the computation is \( [\hat{y}] = (\hat{y}_1, \dots, \hat{y}_n) \).
  4. Each party reveals their share \( \hat{y}_i \), which is used to interpolate a polynomial \( p \). Each party computes \( \hat{y} = p(0) \) and turns it back into a bit \( y \) in the obvious way.2
  5. Output \( y \).

The above works assuming all inputs are well-formed.

But this is not guaranteed: Each party locally converts their input bit \( b_i \) into an element of the extension field \( \mathbb{F}_{2^k} \), and so there's nothing stopping a "misbehaving" party from skipping this conversion and directly inputting some \( \hat{x} \not\in \{0, 1\} \).

Let's see why that's not great.

An example

Suppose we wish to securely compute the circuit

\[ \mathcal{C}(a, x, b, y) = (a \oplus x) \wedge (b \oplus y). \]

Where \( a, b \) are the inputs of one party, and \( x, y \) are the inputs of another party (i.e., it's a two-party computation). If \( a \neq x \) and \( b \neq y \) then the output of \( \mathcal{C} \) is one, and each party learns that their input was the exact opposite of the other party. On the other hand, if either \( a = x \) or \( b = y \), then \( \mathcal{C} \) returns 0, but neither party learns which of their inputs matched the other party.

Note that we aren't actually doing a binary computation, so the above circuit is simply what we would expect to be computed. What we are actually computing, is the circuit below over some extension of \( \mathbb{F}_2 \).

\[ \mathcal{C}(a, x, b, y) = (a + x) \cdot (b + y). \]

Of course, if \( a,x,b,y \) are all bits, then the above circuit is equivalent to the circuit we think we're computing.

Let's use \( \mathbb{F}_{2^4} = \mathbb{F}_2[X] / (X^4 + X + 1) \) and see what happens if the inputs are \( a, X, b, X^3 \) for \( a,b \in\{0,1\} \). In other words the second party decides to do the bad thing and use inputs \( X \) and \( X^3 \), which are clearly not bits.

\begin{align*} \mathcal{C}(a, X, b, X^3) &= (a + X) \cdot (b + X^3) \\ &= ab + bX + aX^3 + X^4 \\ &= ab + bX + aX^3 + (X + 1) \\ &= (1 + ab) + (1 + b)X + aX^3 \end{align*}

Uh oh. The output leaks both inputs of the first party :(

Input-checking

It is not super deficult to check whether an input \( x \in \mathbb{F}_{2^k} \) is actualy restricted to \( \mathbb{F}_2 \). And in fact, it can usually be done as part of whatever input protocol is already being used, at least if it is in the "mask-and-open" style, which most input protocols are anyway. The idea is, as with many other problems one encounters in MPC protocols, to push the problem to a pre-processing phase.

Consider an input being performed by the party holding \( b_i \), which may or may not be an element of \( \mathbb{F}_2 \)—that is what we need to check. The fix goes as follows:

  1. Let \( [r] \) be a secret-shared bit obtained from some sort of pre-processing (this is the part where we push our problems to the pre-processing phase.)
  2. Open \( [r] \) towards the inputting party.
  3. The inputting party sends \( m_i = b_i + r \) to all the other parties.
  4. Everyone checks if \( m_i \in \mathbb{F}_2 \). If not, stop (or enter whatever failure mode the protocol uses).
  5. If \( m_i \in \mathbb{F}_2 \), define \( [b_i] = m_i - [r] \).

Since \( r \) was assumed to be a bit, \( m_i \) is a bit only if \( b_i \) was a bit (since \( \mathbb{F}_2 \) is closed under addition.)

Can't we just "define" the problem away?

It is tempting to ask: "Isn't this just malicious behavior in a semi-honest protocol"? The protocol clearly only works if inputs are restricted to \( \mathbb{F}_2 \), so can't we just make this restriction part of the protocol's "correct behavior"? In other words, can't we just define the problem away?

This kind of "attack" arguably falls within the category of "input substitution"—something that is not covered by MPC security definitions. In other words, the problem has already been "defined away", just not in the way we would expect.

If we are performing a binary computation using Shamir's secret-sharing, then this issue is an issue, so saying "well, the MPC definition says its OK" and calling it a day, isn't really satisfactory.

So, no, you cannot define the problem away.

Conclusion

It is extremely easy to perform this type of "attack", as all it requires are inputs of a particular form. And the input is—basically by definition—not even bad, so the problem has to be dealt with explicitly.

This can be quite a pitfall when implementing an MPC protocol. Indeed, if we take an MPC protocol for a finite field \( \mathbb{F} \) off-the-shelf, and then instantiate it with \( \mathbb{F}_{2^k} \), which is what we would do if we want to perform a binary computation, then we're almost guaranteed to run into trouble.

Oh, and it is worth noting that this issue also arises if we are performing MPC, using Shamir's secret-sharing, over \( \mathbb{Z}_{2^\ell} \), since this fella also requires an extension (a galois extension, but that's not important).

Footnotes:

1

Place the bit in the constant term.

2

Remove everything except the bit in the constant term.


CC BY-SA

Published: 2026-11-25