← Articles
Vulnerability research

Breaking a zk-SNARK library: gnark's classic-GLV soundness failure

A constraint-valid scalar split, an incomplete addition, and a Groth16 proof for an off-curve result in gnark's BLS12-381 and BW6-761 gadgets.

Whoopwhoop new GHSA alert: GHSA-4g5f-3gmm-9q87

Here, we’re gonna follow my classic-GLV finding through one BLS12-381 case in detail. The other cases I reproduced follow the same pattern; the advisory also covers independent findings.

Okeyyy, ready? Then let’s start with a lil’ context.

I started looking at gnark’s scalar-multiplication code after reading GHSA-7fx8-hmgc-82jp , an earlier gnark advisory about a fake-GLV soundness issue discovered by Certora. It listed BLS12-381 as unaffected by that bug. That curve’s classic-GLV path computes the result in-circuit. If those names are unfamiliar, we’ll go through both methods and what went wrong in that advisory below.

Soooo yea’, I got the target to fight with: the classic-GLV implementation. My goal: to see how far I could push the values accepted by the circuit and to observe if an off-curve point could be accepted.

A researcher encounters the glowing advisory identifier GHSA-7fx8-hmgc-82jp in the zk-SNARK forest of wisdo(o)m.

gnark and classic GLV#

gnark is a Go library for writing zk-SNARK circuits and proving them with backends such as Groth16 or PLONK. A circuit’s Define method looks like ordinary Go, but it runs at compile time over symbolic variables. Calls such as api.Mul or api.AssertIsEqual build a constraint system. Later, the prover supplies a witness satisfying those constraints and produces a proof; the verifier checks the proof against the compiled relation.

This distinction matters for hints. A hint runs as ordinary Go during witness generation and gives the solver values that would be costly to derive inside the circuit. The verifier never runs that code. It only checks the constraints attached to the returned values, so a malicious prover can replace the hint output with any other values satisfying the same constraints.

gnark’s standard library includes emulated elliptic-curve arithmetic. Scalar multiplication computes [s]P[s]P, which normally requires processing every bit of ss. Classic GLV shortens this operation on curves with a cheap endomorphism. For curves of the form y2=x3+by^2=x^3+b, a nontrivial cube root of unity β\beta gives the map:

ϕ(x,y)=(βx,y). \phi(x,y)=(\beta x,y).

Inside the prime-order subgroup, that map acts as multiplication by a fixed eigenvalue λ\lambda:

ϕ(P)=[λ]P. \phi(P)=[\lambda]P.

The scalar can then be split into two signed, roughly half-sized values satisfying:

s1+λs2≡s(modr), s_1+\lambda s_2\equiv s\pmod r,

where rr is the subgroup order. This turns one full multiplication into a joint multiplication:

[s]P=[s1]P+[s2]ϕ(P). [s]P=[s_1]P+[s_2]\phi(P).

The two shorter scalars are processed together, sharing the same doublings. The endomorphism is cheap, so the circuit saves constraints without asking the prover to supply the final result. This last point is the difference between classic GLV, used here by BLS12-381 and BW6-761, and the fake-GLV verification method from the earlier advisory.

Reference: the fake-GLV advisory#

The advisory I reviewed concerned P-256, P-384, and the STARK curve, which don’t have the cheap endomorphism needed by classic GLV. Their variable-base multiplication used fake GLV, with the prover supplying RR as a hint instead of computing R=[s]QR=[s]Q. Outside the separately handled zero-scalar and infinity-input cases, the prover supplied short integers a≥0a\geq0 and signed bb. The circuit checked b≢0(modn)b\not\equiv0\pmod n and

a≡bs(modn), a\equiv bs\pmod n,

then checked

[a]Q−[b]R=O. [a]Q-[b]R=\mathcal O.

If QQ and RR belong to the same prime-order group of order nn, this is sound. Since b≢0(modn)b\not\equiv0\pmod n, it has an inverse modulo nn, and the checked equation implies R=[s]QR=[s]Q. The missing prerequisite was an on-curve constraint for RR. Once an off-curve pair of coordinates is allowed into formulas that assume curve points, the group argument no longer applies, even though the circuit equations can still be satisfied.

That gap reached gnark’s ECDSA gadgets and P256Verify. A malicious prover could choose the off-curve contribution used in the verification equation and produce a proof for a signature that wasn’t made by the claimed private key. The fix added the missing curve-membership constraint, but affected circuits had to be recompiled and their proving and verification keys regenerated because the relation itself changed. Certora’s article, Take no hint: soundness vulnerability in gnark zk-SNARK library , gives a more detailed walkthrough of hints, fake GLV, and the ECDSA forgery.

The diagram below summarizes how classic GLV and fake GLV use hints to compute or verify scalar multiplication:

Classic GLV and fake GLV at a glance

Classic GLV

  1. Start with the input

    A point PP, a scalar ss, and a cheap endomorphism ϕ(P)=[λ]P\phi(P)=[\lambda]P.

  2. Hint a scalar split

    Check the bounded signed values satisfy s1+λs2≡s(modr)s_1+\lambda s_2\equiv s\pmod r.

  3. Compute inside the circuit

    A joint loop processes the bits of s1s_1 and s2s_2, sharing doublings.

  4. Return the computed point

    R=[s1]P+[s2]ϕ(P). R=[s_1]P+[s_2]\phi(P).

    Correct loop arithmetic makes this the intended scalar multiple.

Fake GLV

  1. Start with the input

    A point QQ and a scalar ss, without the cheap endomorphism used by classic GLV.

  2. Hint the result

    The prover supplies RR. Check short a≥0a\geq0 and signed bb, with b≢0(modn)b\not\equiv0\pmod n and a≡bs(modn)a\equiv bs\pmod n; handle zero scalars and infinity inputs separately.

  3. Verify a group relation

    For QQ and RR in the same required prime-order group, check:

    [a]Q−[b]R=O. [a]Q-[b]R=\mathcal O.
  4. Accept the supplied point

    Inverting bb modulo nn makes that relation imply R=[s]QR=[s]Q.


Okeyy perfect, but now what? Back to classic GLV, then. The circuit computes the point itself, so we’ll go a lil’ deeper: what does the arithmetic assume about its inputs, and where are those assumptions enforced?

My spider-sense is tingling#

What caught my eye in that classic-GLV branch was the warning above doubleAndAdd . Its inputs must be nonzero and different from each other and each other’s inverse. The helper assumes that precondition on this path; it doesn’t assert it. From there, it was all about finding a split that passed the checks and still made the loop do what that comment said it shouldn’t. Good news, I’m usually good at breaking invariants :D

Let’s dive to see what actually reach it and what the prover can manipulate.

Ectario parts the forest foliage to reveal doubleAndAdd and the classic-GLV branch.

Circuit settings & the prover’s entry point#

BLS12-381’s parameters set PreferClassicGLV: true . For a variable-base point, the default ScalarMul dispatch selects scalarMulGLV.

The implementation supports signed subscalars. A hint returns two magnitudes and their sign bits, and the circuit range-checks the magnitudes and constrains their signed combination modulo rr.

The hint’s usual decomposition algorithm isn’t part of that constraint. The prover can supply a different bounded pair, as long as it satisfies the same relation. So the loop has to handle every accepted decomposition, including ones the stock solver wouldn’t choose.

A complete API with an incomplete loop#

The default ScalarMul API describes complete arithmetic. Here, complete means that the operation gives the correct group result for every input in its stated domain. For point addition, that includes equal points, inverse points whose sum is infinity O\mathcal O, and infinity itself. A complete scalar multiplication also handles a zero scalar and an input at infinity.

Completeness can come from formulas that cover all those cases, or from explicit, constrained handling of the exceptional ones. In a circuit, the guarantee has to hold for every accepted witness, including alternative hint outputs.

An implementation can still use an incomplete formula internally if it proves that the formula’s preconditions always hold at that call. This requires a loop invariant, a property established at initialization and preserved by every update. For this loop, it must keep each helper’s inputs finite and its affine denominators nonzero, for every accepted scalar split. The decomposition relation alone doesn’t establish that property.

Inside scalarMulGLV, the merged loop updates the accumulator like this:

go
// Acc = [4]Acc + T
Acc = c.double(Acc)
Acc = c.doubleAndAdd(Acc, T)

Each iteration consumes two bits from each subscalar and selects TT from a precomputed table. The first instruction doubles the accumulator; doubleAndAdd(p, q) then computes [2]p+q[2]p+q, giving the intended [4]Acc+T[4]\mathrm{Acc}+T update.

Classic GLV loop logic and behavior: an accepted scalar split initializes the accumulator, repeated double and doubleAndAdd calls require finite inputs and nonzero affine denominators, and AddUnified applies to the final low-bit corrections.
Classic GLV loop logic and behavior. Open the full-size diagram .

But doubleAndAdd uses incomplete affine formulas. For inputs X,YX,Y, its first chord requires finite points with X≠±YX\neq\pm Y. Its second denominator also excludes Y=−[2]XY=-[2]X. The surrounding doubling has its own requirement that the accumulator be finite and have nonzero yy. These are the prerequisites the invariant needs to preserve. The complete-mode AddUnified selection applies to the final low-bit corrections, not these loop calls.

And as we’ve seen, equal inputs are enough to violate the helper’s precondition. Now, to reach them, the scalar bits need to make the first doubling land on exactly the point the table selects. Prepare yourself, it will be a long road…

A researcher climbs a mountain through seven milestones, from prover-controlled hints to an accepted proof for an off-curve point.

Choosing the bits that make the points collide#

For BLS12-381, the configured eigenvalue is:

text
lambda = 228988810152649578064853576960394133503

We’re gonna start with one accepted split and follow its bits ’till the two inputs meet.

From a valid scalar split to equal point inputs

1. Start with a split the circuit accepts

Choose the scalar and positive subscalars:

s=9(λ+1),s1=2λ+9,s2=7. \begin{aligned} s &= 9(\lambda+1),\\ s_1 &= 2\lambda+9,\\ s_2 &= 7. \end{aligned}

Both magnitudes fit the enforced 129-bit bounds, and ss is canonical. The decomposition relation holds exactly over the integers:

s1+λs2=2λ+9+7λ=9(λ+1)=s. \begin{aligned} s_1+\lambda s_2&=2\lambda+9+7\lambda\\ &=9(\lambda+1)=s. \end{aligned}

We’ll see how to get these values in the appendix . For now, just enjoy how they’ll break the invariant.

2. Start both accumulator coefficients at 1

Because both subscalars are positive, the initialization uses PP and ϕ(P)\phi(P) with their original signs. The input point is named Q in the code:

Acc=P+ϕ(P). \mathrm{Acc}=P+\phi(P).

As the bits are read, track the coefficient of PP using s1s_1, and the coefficient of ϕ(P)\phi(P) using s2s_2. A bit of 1 adds its base point after doubling; a bit of 0 subtracts it.

For either processed binary prefix kk, the corresponding coefficient is 2k+12k+1. Initially k=0k=0, so both coefficients are 1. This relation lets us recover the accumulator from the bits already processed.

Deriving the coefficient 2k + 1 from the loop

For either base point, let CC be its accumulator coefficient. The underlying single-bit step doubles CC, then adds 1 or subtracts 1 according to the bit b∈{0,1}b\in\{0,1\}:

C′=2C+(2b−1). C'=2C+(2b-1).

Let kk be the ordinary binary prefix already read, meaning the integer represented by the bits processed so far. Before any bits are read, k=0k=0 and C=1C=1, so C=2k+1C=2k+1. Appending a bit to that prefix changes it to k′=2k+bk'=2k+b. Applying the signed-bit update gives:

C′=2(2k+1)+(2b−1)=2(2k+b)+1=2k′+1. C'=2(2k+1)+(2b-1)=2(2k+b)+1=2k'+1.

Each bit preserves C=2k+1C=2k+1. The merged update applies two such steps at a time, so the same relation holds after each merged iteration.

If you’d like a small exercise, write this as a proof by induction on the number of processed bits. The initial k=0,C=1k=0,C=1 gives the base case, and the update above gives the induction step.

3. Pause just before the last merged iteration

Processed
Next pair
Correction
Position
... 5 4 3
2 1
0
s1
high prefix
1 1
1
s2
0 ... 0
1 1
1

Bits are numbered from 0 at the least significant end. The loop reads two bits per subscalar , at positions i and i-1, then decreases i by two. Near the end, i = 4 consumes bits 4 and 3. At i = 2, bits 2 and 1 are next; bit 0 is reserved for the final conditional correction , which subtracts the corresponding base point if that bit is 0.

At entry to i = 2, the processed prefixes therefore exclude the three lowest bits. Removing three binary positions means shifting right by three, or dividing by 23=82^3=8 and rounding down. Both chosen subscalars end in 111, whose value is 7, so discarding those bits gives:

k1=⌊s1/8⌋=s1−78=λ+14,k2=⌊s2/8⌋=7−78=0. \begin{aligned} k_1&=\left\lfloor s_1/8\right\rfloor =\frac{s_1-7}{8} =\frac{\lambda+1}{4},\\ k_2&=\left\lfloor s_2/8\right\rfloor =\frac{7-7}{8}=0. \end{aligned}

Substituting those prefixes into C=2k+1C=2k+1, the coefficients of PP and ϕ(P)\phi(P) are:

A1=2k1+1=λ+32,A2=2k2+1=1. \begin{aligned} A_1&=2k_1+1=\frac{\lambda+3}{2},\\ A_2&=2k_2+1=1. \end{aligned}

The accumulator is now:

Acc=[A1]P+[A2]ϕ(P)=[λ+32]P+ϕ(P). \begin{aligned} \mathrm{Acc}&=[A_1]P+[A_2]\phi(P)\\ &=\left[\frac{\lambda+3}{2}\right]P+\phi(P). \end{aligned}

4. Two paths reach the same point

The current accumulator and the next bit pair determine the two inputs to doubleAndAdd separately.

  • Double the accumulator

    The loop first computes [2]Acc[2]\mathrm{Acc}.
    Using ϕ(P)=[λ]P\phi(P)=[\lambda]P, its coefficient is 2A1+2λA2=λ+3+2λ2A_1+2\lambda A_2=\lambda+3+2\lambda:

    [2]Acc=[3(λ+1)]P. [2]\mathrm{Acc}=[3(\lambda+1)]P.
  • Select the table point

    At i = 2, the selector reads s1bits[2], s2bits[2], s1bits[1], and s2bits[1].
    All four bits are 1, so each underlying step adds P+ϕ(P)P+\phi(P).

    Merging the two steps doubles the first contribution and adds the second.
    The precomputed table entry is:

    T=[2](P+ϕ(P))+(P+ϕ(P))=[3]P+[3]ϕ(P)=[3(λ+1)]P. \begin{aligned} T&=[2](P+\phi(P))\\ &\quad+(P+\phi(P))\\ &=[3]P+[3]\phi(P)\\ &=[3(\lambda+1)]P. \end{aligned}
[2]Acc=T=U. [2]\mathrm{Acc}=T=U.

Calling that shared point UU, the next instruction becomes:

go
Acc = c.doubleAndAdd(U, U)

Its inputs are equal, violating the incomplete helper’s precondition. The decomposition check accepted exactly the values needed to reach this forbidden input pair.

Niiiice, we’ve managed to give the helper exactly the input it asked us not to. Before following what happens to the coordinates, here’s a small Python check of the split, bounds, bits, and coefficient equality:

python
lam = 228988810152649578064853576960394133503
r = int(
    "73eda753299d7d483339d80809a1d80553"
    "bda402fffe5bfeffffffff00000001", 16
)

s = 9 * (lam + 1)
s1, s2 = 2 * lam + 9, 7

assert 0 < s < r
assert s1.bit_length() <= 129
assert s2.bit_length() <= 129
assert s1 + lam * s2 == s
assert ((s1 >> 1) & 3) == 3
assert ((s2 >> 1) & 3) == 3

A1 = 2 * (s1 // 8) + 1
A2 = 2 * (s2 // 8) + 1
assert A1 == (lam + 3) // 2
assert A2 == 1
assert 2 * (A1 + lam * A2) == 3 * (lam + 1)
Ectario follows a mountain trail toward a sunlit summit, with glowing assertion checks in the chasm below.

When the slope stops being constrained#

The chosen bits have brought the loop to doubleAndAdd(U, U). The intended result is [3]U[3]U, but the helper’s first slope calculation assumes distinct points. For generic inputs PP and QQ, it uses the chord formula:

m=yQ−yPxQ−xP. m=\frac{y_Q-y_P}{x_Q-x_P}.

assertedRatio obtains mm from ratioHint and enforces:

m(xQ−xP)=yQ−yP(modp), m(x_Q-x_P)=y_Q-y_P\pmod p,

where pp is the curve’s base-field modulus, distinct from the subgroup order rr.

With a nonzero denominator, that equation determines the ratio. With equal inputs P=Q=UP=Q=U, both coordinate differences vanish:

m⋅0=0. m\cdot0=0.

The constraint no longer determines a slope. Equal-point handling would need different formulas; continuing with this chord formula doesn’t implement the intended group operation.

The stock ratioHint already handles a zero denominator by returning zero:

go
den := new(big.Int).Mod(in[1], p)
if den.Sign() == 0 {
    out[0].SetInt64(0)
    return nil
}

For this witness, the stock slope hint supplies zero, the constraint accepts it, and the remaining arithmetic produces an off-curve result. Both subscalars are odd, so the final low-bit selectors retain the loop result. The adversarial witness changes only the GLV decomposition; the standard slope hint supplies everything else.

The malformed point survives the EIP-2537 wrapper#

That off-curve value survives the low-bit corrections and becomes the ScalarMul output. Now let’s see whether the wrapper lets it through too. For BLS12-381, we can trace it to the public expected result through the exported ECG1ScalarMulSumBLS gadget. This wrapper accumulates a scalar multiplication as part of the operation defined by EIP-2537’s G1 MSM precompile .

Its relevant statements are:

go
g1.AssertIsOnG1(P)
res := curve.ScalarMul(P, s)
sum := curve.AddUnified(prev, res)
g1.AssertIsEqual(sum, expected)

AssertIsOnG1(P) validates the input’s subgroup membership. The wrapper then binds the computed result to expected through coordinate equality, with no membership constraint on either result.

With prev = (0, 0), the normal initial accumulator and infinity representation, AddUnified forwards the malformed result. Supplying those coordinates as expected satisfies the final equality, so the malformed value becomes the public EIP-2537 output accepted by the circuit.

Ectario approaches a glowing summit gate marked High severity Finding and Precompile affected.

Summary of the attack surface & other dispatch paths#

Now that we’ve got the pattern and the full attack path in mind, let’s see where else we can weaponize this primitive.

But first, just a reminder of what we’ve got:

With PP, ss, and the claimed output public, standard Groth16 Setup, Prove, and Verify produce and accept a proof for an off-curve result different from native [s]P[s]P. The BLS12-381 circuit calls ECG1ScalarMulSumBLS.

During private witness generation, the malicious prover chooses a constraint-valid GLV decomposition that drives the fixed circuit into doubleAndAdd(U, U), with a valid input point and canonical scalar. The circuit and verification key stay unchanged, the proving parameters are generated honestly, and the verifier runs normally. Every constraint is satisfied, so the forged witness produces a standard proof that verifies.

Digging, digging… Aaaaand yep! BW6-761 takes us back to the same weak spot with its own curve parameters. Like BLS12-381, it sets PreferClassicGLV: true and reaches the same loop. A separate signed decomposition within its 189-bit bounds makes the final doubleAndAdd receive equal points.

Okey, now from this, since the pattern repeat on BW6-761, I reported it immediately and signaled to the gnark team about arithmetic primitives for similar unchecked assumptions.

For secp256k1 and BN254, though, the variable-base dispatch takes us elsewhere. Their parameters provide efficient-endomorphism constants but leave PreferClassicGLV at its default value, false, so ScalarMul selects scalarMulGLVAndFakeGLV after the fixed-base-comb fast path. That routine always constrains its hinted result to lie on the curve. In the default complete mode, it also uses AddUnified and the unified doubling variant instead of the incomplete doubleAndAdd loop reached by classic GLV.

My confirmed cases covered variable-base G1 multiplication on BLS12-381 and BW6-761. The team’s published advisory lists a wider surface through ScalarMul, ScalarMulBase, JointScalarMul, and MultiScalarMul, including callers in emulated KZG, PLONK, and Groth16 recursion over these curves.

Compile-time constant points route to the fixed-base comb path only when precomputation succeeds , which requires a finite on-curve point of order rr; otherwise they fall back to the variable-base dispatch.

G2 uses separate gadgets, but the same advisory also covers a distinct BW6-761 G2 subgroup-check issue found during the review.

Ectario overlooks glowing paths to the BLS12-381 and BW6-761 gates, while the other routes remain locked.

Patching & Keeping the optimization with a torsion offset#

The repair starts where this chain begins, at the exceptional addition inside the scalar-multiplication loop. Complete arithmetic can handle that case directly. Keeping the optimized incomplete formulas requires establishing that no accepted witness can reach their exceptional inputs.

In the report, I suggested a fixed nonzero odd-order torsion offset in the accumulator for subgroup-validated inputs, with order 3 for BLS12-381 and order 127 for BW6-761.

The gnark team confirmed & published GHSA-4g5f-3gmm-9q87 with High severity and released the fix in gnark v0.16.5 . The implementation follows this direction in ecbe370 : the offset supplies the invariant the incomplete loop needs, because the accumulator carries a component that no lookup point can cancel.

As a note: the review turned up other soundness bugs too, in BW6-761 G2 subgroup checks, opt-in incomplete arithmetic, and native BLS12-377 and Grumpkin primitives. Those were fixed in the same release.

Kudos to Dickson Wu for reporting the missing input-subgroup check in classic GLV, and to LeonPaulSchneider for the Grumpkin ScalarMul forgery. The patch now enforces input-subgroup membership by default in classic GLV, which supplies the premise for the offset argument below.

A bit of group theory to understand the torsion-part fix#

Let H=⟨P⟩H=\langle P\rangle be the prime-order subgroup of order rr, with P≠OP\neq\mathcal O. Choose a fixed valid curve point DD of exact odd order dd, where d=3d=3 or 127127 for the respective curves. Since gcd⁡(r,d)=1\gcd(r,d)=1, the two subgroups share only infinity:

H∩⟨D⟩={O}. H\cap\langle D\rangle=\{\mathcal O\}.

Put DD into the accumulator at initialization, while keeping the lookup table in HH. At each loop entry, the accumulator then has the form

Ai=Bi+[μi]D,Bi∈H. A_i=B_i+[\mu_i]D,\qquad B_i\in H.

Initially μ0=1\mu_0=1. The intended group update [4]Ai+Ti[4]A_i+T_i gives μi+1=4μi\mu_{i+1}=4\mu_i, because Ti∈HT_i\in H contributes no torsion component. A single-bit update multiplies it by 2 instead. Thus μi\mu_i remains a power of 2. No such power is divisible by the odd order dd, so the offset component never vanishes. We still need to check that the affine formulas safely implement these group updates.

Immediately before doubleAndAdd, the loop doubles the accumulator. The helper receives

Xi=[2]Ai=[2]Bi+[2μi]D,Yi=Ti∈H. \begin{aligned} X_i&=[2]A_i=[2]B_i+[2\mu_i]D,\\ Y_i&=T_i\in H. \end{aligned}

If the scalar bits could make Xi=YiX_i=Y_i, then

[2μi]D=Yi−[2]Bi. [2\mu_i]D=Y_i-[2]B_i.

The left side belongs to ⟨D⟩\langle D\rangle, and the right side belongs to HH. Their common value would have to be O\mathcal O, contradicting the nonzero offset. Replacing YiY_i with −Yi-Y_i gives the same contradiction. The inputs therefore have different xx-coordinates, so the first chord denominator can’t be zero.

The same argument keeps AiA_i and XiX_i away from infinity and points of order 2, since doubling preserves a nonzero torsion component. The standalone doubling therefore has a nonzero denominator too.

The table points are nonzero as well. Each is [a+bλ]P[a+b\lambda]P with a,b∈{±1,±3}a,b\in\{\pm1,\pm3\}. For these curves, λ2+λ+1≡0(modr)\lambda^2+\lambda+1\equiv0\pmod r. If a+bλ≡0(modr)a+b\lambda\equiv0\pmod r, substituting bλ≡−ab\lambda\equiv-a would give

0≡b2(λ2+λ+1)≡a2−ab+b2(modr). 0\equiv b^2(\lambda^2+\lambda+1) \equiv a^2-ab+b^2\pmod r.

But 1≤a2−ab+b2≤27<r1\leq a^2-ab+b^2\leq27<r, so this is impossible. Since PP has order rr, every selected YiY_i is nonzero.

Finally, the helper’s second denominator is x(Xi+Yi)−x(Xi)x(X_i+Y_i)-x(X_i). The first chord is already valid, so Xi+YiX_i+Y_i is finite. Equal xx-coordinates would mean Xi+Yi=±XiX_i+Y_i=\pm X_i, giving either Yi=OY_i=\mathcal O or Yi=−[2]XiY_i=-[2]X_i. The table excludes the first case. The second would require canceling [4μi]D[4\mu_i]D, which is impossible by the same subgroup argument.

This closes the induction. Starting from a valid initialization with μ0=1\mu_0=1, the invariant makes each formula valid, and its output preserves the invariant for the next iteration. Choosing different subscalars, including their signs, changes BiB_i and TiT_i within HH. It can’t change this separation between the accumulator and the table.

The argument relies on the input being constrained to the prime-order subgroup, with infinity handled separately, and on DD having the stated exact order. Only the accumulator receives the offset. In particular, the lookup entry T2 := Acc must retain the unshifted value.

The low-bit corrections add or subtract subgroup points, leaving the tracked torsion component unchanged. The bit recurrence and constrained scalar split therefore give

Afinal=[s]P+[μfinal]D. A_{\mathrm{final}}=[s]P+[\mu_{\mathrm{final}}]D.

Removing the known final offset with complete addition recovers [s]P[s]P, including when that result is infinity.

Ectario casts glowing group-theory equations over the BLS12-381 and BW6-761 gates at twilight.

Impact#

The advisory’s impact assessment includes forged precompile results, signature or commitment checks, and recursive proof verification, depending on how the affected arithmetic is used.

For example, with the EIP-2537 path we’ve followed, a validity system relying on this gadget to enforce precompile execution could accept an invalid execution trace and state root. That last step depends on the integration; the result established here is the accepted proof for a false G1MSM output.

TL;DR & Conclusion#

gnark’s classic-GLV loop relied on an arithmetic precondition that a constraint-valid scalar split could violate.

  • My reproduced cases: variable-base BLS12-381 G1 and BW6-761 G1 multiplication, including the BLS12-381 EIP-2537 G1 MSM gadget
  • Weak point: equal inputs to doubleAndAdd leave its first slope unconstrained. An off-curve result passes the circuit, and its Groth16 proof verifies with honestly generated keys
  • Impact: forged group results can undermine precompile execution, signature or commitment checks, and recursive verification, depending on the application
  • Patch: a fixed odd-order torsion offset, with input-subgroup checks, keeps the accumulator away from the loop’s exceptional inputs

My personal thought: this one really felt like a juicy chall’ from the old golden age moment in past CTFs. Overall, that was everything about the code comment giving me an assumption to poke at, and the whole puzzle became constructing a bad input while keeping every constraint happy and me trying to push it ’till it worked.

Ectario rests beneath a CTF constellation above the locked curve gates, beside a GHSA flag.

Appendix: how to pre-shot a collision and generalize it#

The split used in the walkthrough is one member of a larger family. For the BLS12-381 G1 loop in v0.16.4, we can construct at least 32 signed decompositions, including that example, that make doubleAndAdd receive two equal subgroup points. All 32 collide at the last merged iteration, i = 2.

We’ll keep the classic-GLV notation for the public scalar ss, point PP, endomorphism ϕ\phi, eigenvalue λ\lambda, and subgroup order rr. Assume PP is nonzero and belongs to that prime-order subgroup.

Write the collision condition in terms of bits#

To include the signed decompositions , write each component sjs_j, for j∈{1,2}j\in\{1,2\}, in terms of its magnitude mj=∣sj∣m_j=|s_j| and sign εj\varepsilon_j:

sj=εjmj,εj∈{−1,+1},0≤mj<2129. s_j=\varepsilon_j m_j, \qquad \varepsilon_j\in\{-1,+1\}, \qquad 0\leq m_j<2^{129}.

Here m1,m2m_1,m_2 correspond to the code’s s1, s2; the point-sign selection gives the bases [ε1]P[\varepsilon_1]P and [ε2]ϕ(P)[\varepsilon_2]\phi(P).

Let bj,t∈{0,1}b_{j,t}\in\{0,1\} denote bit position tt of mjm_j, using the bit numbering from the walkthrough . The signed-bit update contributes 2bj,t−12b_{j,t}-1 to its signed base point.

For a merged iteration indexed by its higher bit ii, the pair i,i−1i,i-1 gives a lookup digit dj,id_{j,i} for each component through the merged-step identity :

dj,i=2(2bj,i−1)+(2bj,i−1−1)=4bj,i+2bj,i−1−3. \begin{aligned} d_{j,i} &=2(2b_{j,i}-1)+(2b_{j,i-1}-1)\\ &=4b_{j,i}+2b_{j,i-1}-3. \end{aligned}
Bits (bj,i,bj,i−1)(b_{j,i},b_{j,i-1})Digit dj,id_{j,i}
00−3-3
01−1-1
1011
1133

The table lookup combines these digits into TiT_i, the point passed as the helper’s second argument:

Ti=[ε1d1,i]P+[ε2d2,i]ϕ(P). T_i=[\varepsilon_1d_{1,i}]P +[\varepsilon_2d_{2,i}]\phi(P).

Let kjk_j be the already-read prefix of mjm_j before iteration ii. For the current ii, its value is

kj=⌊mj2i+1⌋. k_j=\left\lfloor\frac{m_j}{2^{i+1}}\right\rfloor.

Let Acci\mathrm{Acc}_i be the accumulator at entry to iteration ii, before its first doubling. The 2k+12k+1 relation from the walkthrough applies to both signed base points, giving

Acci=[ε1(2k1+1)]P+[ε2(2k2+1)]ϕ(P). \mathrm{Acc}_i =[\varepsilon_1(2k_1+1)]P +[\varepsilon_2(2k_2+1)]\phi(P).

The two input paths collide when [2]Acci=Ti[2]\mathrm{Acc}_i=T_i. Expressing both points as multiples of PP gives

ε1(4k1+2−d1,i)+ε2λ(4k2+2−d2,i)≡0(modr). \begin{aligned} &\varepsilon_1(4k_1+2-d_{1,i})\\ &\quad+\varepsilon_2\lambda(4k_2+2-d_{2,i}) \equiv0\pmod r. \end{aligned}
From equal point inputs to the scalar congruence

Doubling the accumulator doubles each base-point coefficient. For either component, 2εj(2kj+1)=εj(4kj+2)2\varepsilon_j(2k_j+1)=\varepsilon_j(4k_j+2), so

[2]Acci=[ε1(4k1+2)]P+[ε2(4k2+2)]ϕ(P). \begin{aligned} [2]\mathrm{Acc}_i &=[\varepsilon_1(4k_1+2)]P\\ &\quad+[\varepsilon_2(4k_2+2)]\phi(P). \end{aligned}

For the inputs to be equal, subtracting TiT_i must give the point at infinity, O\mathcal O. The lookup contributes coefficient εjdj,i\varepsilon_jd_{j,i} for each base point, so subtracting it gives

[2]Acci−Ti=[ε1(4k1+2−d1,i)]P+[ε2(4k2+2−d2,i)]ϕ(P)=O. \begin{aligned} [2]\mathrm{Acc}_i-T_i &=[\varepsilon_1(4k_1+2-d_{1,i})]P\\ &\quad+[\varepsilon_2(4k_2+2-d_{2,i})]\phi(P)\\ &=\mathcal O. \end{aligned}

Now use the endomorphism relation , ϕ(P)=[λ]P\phi(P)=[\lambda]P. The second term becomes [ε2λ(4k2+2−d2,i)]P[\varepsilon_2\lambda(4k_2+2-d_{2,i})]P. Both terms multiply the same point, so their coefficients add.

Since PP has exact order rr, that sum represents O\mathcal O precisely when its coefficient is divisible by rr. This gives the congruence above. The coefficient doesn’t have to be zero as an integer; the next section uses the bounds to narrow down its possible multiples of rr.

For each component, call the doubled prefix coefficient minus its lookup digit uj=4kj+2−dj,iu_j=4k_j+2-d_{j,i}. Also write η=ε1ε2\eta=\varepsilon_1\varepsilon_2 for the relative sign of the two components. Multiplying by ε1\varepsilon_1, whose square is 1, reduces the condition to

u1+ηλu2≡0(modr). u_1+\eta\lambda u_2\equiv0\pmod r.

Here η=1\eta=1 means the components have the same sign, and η=−1\eta=-1 means their signs differ.

Interesting point: why can’t the earlier iterations (i > 2) collide?#

For BLS12-381, the configured eigenvalue and subgroup order satisfy

r=λ2+λ+1,λ≡3(mod4). r=\lambda^2+\lambda+1, \qquad \lambda\equiv3\pmod4.

The loop setup visits even indices from 128 down to 2. At any i≥4i\geq4, the prefix formula removes at least five low bits. Together with the possible lookup digits, this gives

0≤kj≤2124−1,−1≤uj≤2126+1<λ. 0\leq k_j\leq2^{124}-1, \qquad -1\leq u_j\leq2^{126}+1<\lambda.
Where the prefix and coefficient bounds come from

The largest allowed magnitude is 2129−12^{129}-1. At i=4i=4, dividing by 2i+1=322^{i+1}=32 leaves at most

kj≤⌊2129−132⌋=2124−1. k_j\leq\left\lfloor\frac{2^{129}-1}{32}\right\rfloor =2^{124}-1.

Earlier iterations divide by a larger power of two, so the same upper bound still holds. To bound uj=4kj+2−dj,iu_j=4k_j+2-d_{j,i}, take the smallest prefix and largest digit for its minimum, then the largest prefix and smallest digit for its maximum:

uj≥4⋅0+2−3=−1,uj≤4(2124−1)+2−(−3)=2126+1. \begin{aligned} u_j&\geq4\cdot0+2-3=-1,\\ u_j&\leq4(2^{124}-1)+2-(-3)\\ &=2^{126}+1. \end{aligned}

The configured value of λ\lambda is larger than 21272^{127}, so this upper bound is strictly below λ\lambda. The lower bound is only −1-1, which also gives ∣uj∣<λ|u_j|<\lambda.

Call the integer on the left of the collision congruence L=u1+ηλu2L=u_1+\eta\lambda u_2. Then

∣L∣≤∣u1∣+λ∣u2∣<λ+λ2<r. |L|\leq|u_1|+\lambda|u_2| <\lambda+\lambda^2<r.
Why the whole expression is smaller than r

The two terms in LL may have different signs. The triangle inequality bounds their sum regardless of those signs:

∣u1+ηλu2∣≤∣u1∣+∣ηλu2∣. |u_1+\eta\lambda u_2| \leq|u_1|+|\eta\lambda u_2|.

Since η∈{−1,1}\eta\in\{-1,1\} and λ>0\lambda>0, the second absolute value is λ∣u2∣\lambda|u_2|. Both ∣uj∣|u_j| are below λ\lambda, so the sum is below λ+λ2\lambda+\lambda^2. The identity r=λ2+λ+1r=\lambda^2+\lambda+1 puts that bound one unit below rr.

The only multiple of rr in that interval is zero, so a collision would require u1=−ηλu2u_1=-\eta\lambda u_2 over the integers. But u2u_2 is odd and can’t be zero. Hence ∣λu2∣≥λ|\lambda u_2|\geq\lambda, while ∣u1∣<λ|u_1|<\lambda, and the terms can’t cancel.

Why the modular condition forces an impossible equality

The congruence L≡0(modr)L\equiv0\pmod r means L=qrL=qr for some integer qq. Since ∣L∣<r|L|<r, we have ∣q∣<1|q|<1, leaving only q=0q=0. Rearranging L=0L=0 gives the required equality.

Now u2=4k2+2−d2,iu_2=4k_2+2-d_{2,i} subtracts an odd lookup digit from an even number, so it is odd. In particular, u2≠0u_2\neq0 and ∣u2∣≥1|u_2|\geq1. Multiplying by λ\lambda gives

∣ηλu2∣=λ∣u2∣≥λ. |\eta\lambda u_2|=\lambda|u_2|\geq\lambda.

For cancellation, u1u_1 would need that same absolute value. Its bound ∣u1∣<λ|u_1|<\lambda rules that out for either choice of η\eta.

That leaves only i = 2.

Solve the last merged iteration#

At i = 2, the prefix bound becomes kj≤2126−1k_j\leq2^{126}-1, giving

−1≤uj≤2128+1<2λ. -1\leq u_j\leq2^{128}+1<2\lambda.

The same expression LL now satisfies

∣L∣≤(λ+1)(2128+1)<2λ(λ+1)<2r. \begin{aligned} |L|&\leq(\lambda+1)(2^{128}+1)\\ &<2\lambda(\lambda+1)<2r. \end{aligned}

This interval allows the multiples −r,0,r-r,0,r. Parity removes the first and last. Both uju_j and λ\lambda are odd, so LL is even, whereas rr is odd. Once again, the congruence must be the integer equality

u1=−ηλu2. u_1=-\eta\lambda u_2.
Why the last iteration still forces L = 0

At i=2i=2, the prefix drops three low bits instead of at least five. Its maximum is now

kj≤⌊2129−18⌋=2126−1. k_j\leq\left\lfloor\frac{2^{129}-1}{8}\right\rfloor =2^{126}-1.

Putting this into the same coefficient formula gives uj≤4(2126−1)+5=2128+1u_j\leq4(2^{126}-1)+5=2^{128}+1; its minimum stays −1-1. The triangle inequality therefore gives

∣L∣≤(2128+1)+λ(2128+1)=(λ+1)(2128+1). \begin{aligned} |L|&\leq(2^{128}+1)+\lambda(2^{128}+1)\\ &=(\lambda+1)(2^{128}+1). \end{aligned}

For the configured λ\lambda, we have 2128+1<2λ2^{128}+1<2\lambda. The bound is therefore below 2λ(λ+1)=2(r−1)<2r2\lambda(\lambda+1)=2(r-1)<2r. Unlike the earlier iterations, this leaves room for L=±rL=\pm r.

Parity rules those out. Each uju_j is odd, so ηλu2\eta\lambda u_2 is odd too. Adding two odd integers gives an even LL, including when one term is negative. But r=λ(λ+1)+1r=\lambda(\lambda+1)+1 is odd, so neither rr nor −r-r can equal LL. Only zero remains.

The bounds now restrict u2u_2 to −1-1 or 1 and force u1=λu_1=\lambda. Every solution therefore satisfies

u1=λ,u2=−η. u_1=\lambda, \qquad u_2=-\eta.
How the bounds leave only these two coefficient values

Taking absolute values in u1=−ηλu2u_1=-\eta\lambda u_2 gives ∣u1∣=λ∣u2∣|u_1|=\lambda|u_2|. Since ∣u1∣<2λ|u_1|<2\lambda, dividing by the positive λ\lambda leaves ∣u2∣<2|u_2|<2. Its oddness leaves only u2∈{−1,1}u_2\in\{-1,1\}.

Substituting either value gives u1∈{−λ,λ}u_1\in\{-\lambda,\lambda\}. The lower bound u1≥−1u_1\geq-1 excludes −λ-\lambda, so u1=λu_1=\lambda. The equality then becomes 1=−ηu21=-\eta u_2, or u2=−ηu_2=-\eta.

For the first component, substituting the definition of u1u_1 gives

k1=λ−2+d1,24. k_1=\frac{\lambda-2+d_{1,2}}4.

Because λ≡3(mod4)\lambda\equiv3\pmod4, this is an integer only for d1,2=−1d_{1,2}=-1 or 3. For the second component, u2=−ηu_2=-\eta forces k2=0k_2=0, with digit 3 for equal signs and digit 1 for opposite signs. This gives four patterns we can use.

η\etad1,2d_{1,2}d2,2d_{2,2}k1k_1k2k_2
11−1-133(λ−3)/4(\lambda-3)/400
113333(λ+1)/4(\lambda+1)/400
−1-1−1-111(λ−3)/4(\lambda-3)/400
−1-13311(λ+1)/4(\lambda+1)/400
Why these are the four prefix-and-digit patterns

For k1k_1 to be an integer, its numerator must be divisible by four. Using λ≡3(mod4)\lambda\equiv3\pmod4,

λ−2+d1,2≡1+d1,2(mod4). \lambda-2+d_{1,2}\equiv1+d_{1,2}\pmod4.

We therefore need d1,2≡−1(mod4)d_{1,2}\equiv-1\pmod4. Among the four lookup digits, only −1-1 and 3 qualify. Substituting each gives the two listed prefixes for k1k_1.

For the second component, 4k2+2−d2,2=−η4k_2+2-d_{2,2}=-\eta. If k2≥1k_2\geq1, even the largest digit would give u2≥4+2−3=3u_2\geq4+2-3=3, contradicting u2∈{−1,1}u_2\in\{-1,1\}. Thus k2=0k_2=0, leaving d2,2=2+ηd_{2,2}=2+\eta. This is 3 for equal signs and 1 for opposite signs. Either second-component choice combines with either first-component choice, giving the four rows.

Turn the four patterns into 32 signed pairs#

The prefixes and lookup digits fix every magnitude bit except bit zero. Write that remaining bit as zj=bj,0∈{0,1}z_j=b_{j,0}\in\{0,1\}. Reassembling the magnitude gives

mj=8kj+4bj,2+2bj,1+zj=8kj+dj,2+3+zj. \begin{aligned} m_j&=8k_j+4b_{j,2}+2b_{j,1}+z_j\\ &=8k_j+d_{j,2}+3+z_j. \end{aligned}

For m1m_1, the two prefix-and-digit choices yield 2λ−4+z12\lambda-4+z_1 and 2λ+8+z12\lambda+8+z_1. For m2m_2, they yield 6+z26+z_2 when η=1\eta=1, or 4+z24+z_2 when η=−1\eta=-1.

Choose the first component’s sign σ=ε1∈{−1,+1}\sigma=\varepsilon_1\in\{-1,+1\}. The second sign is then ε2=ησ\varepsilon_2=\eta\sigma. Call the point passed as both helper inputs U=[2]Acc2=T2U=[2]\mathrm{Acc}_2=T_2. Substituting into the four patterns gives the following families.

FamilySigned s1s_1Signed s2s_2Collision point UU
Aσ(2λ−4+z1)\sigma(2\lambda-4+z_1)σ(6+z2)\sigma(6+z_2)[σ(3λ−1)]P[\sigma(3\lambda-1)]P
Bσ(2λ+8+z1)\sigma(2\lambda+8+z_1)σ(6+z2)\sigma(6+z_2)[σ(3λ+3)]P[\sigma(3\lambda+3)]P
Cσ(2λ−4+z1)\sigma(2\lambda-4+z_1)−σ(4+z2)-\sigma(4+z_2)[−σ(λ+1)]P[-\sigma(\lambda+1)]P
Dσ(2λ+8+z1)\sigma(2\lambda+8+z_1)−σ(4+z2)-\sigma(4+z_2)[σ(3−λ)]P[\sigma(3-\lambda)]P
Working through one row of the family table

Take the first pattern, which becomes family A. Substituting k1=(λ−3)/4k_1=(\lambda-3)/4 and d1,2=−1d_{1,2}=-1 into the magnitude formula gives

m1=8λ−34−1+3+z1=2λ−4+z1. \begin{aligned} m_1&=8\frac{\lambda-3}{4}-1+3+z_1\\ &=2\lambda-4+z_1. \end{aligned}

Its second component has k2=0k_2=0 and d2,2=3d_{2,2}=3, giving m2=6+z2m_2=6+z_2. Since η=1\eta=1, both components have sign σ\sigma. The lookup point is then

U=T2=[−σ]P+[3σ]ϕ(P)=[σ(3λ−1)]P. \begin{aligned} U=T_2&=[-\sigma]P+[3\sigma]\phi(P)\\ &=[\sigma(3\lambda-1)]P. \end{aligned}

The other rows follow by substituting their prefixes, lookup digits, and relative signs into these same formulas.

Each row allows two choices for each zjz_j and two choices for σ\sigma, giving eight signed pairs per row and 32 distinct pairs overall. All magnitudes fit the 129-bit bounds. Each chosen pair determines its public scalar through

s=(s1+λs2) mod r,0≤s<r. s=(s_1+\lambda s_2)\bmod r, \qquad 0\leq s<r.

Family B with σ=z1=z2=1\sigma=z_1=z_2=1 recovers the original example .

The zjz_j values don’t appear in UU, because bit zero hasn’t been processed when the collision occurs. Changing both component signs negates UU. For any fixed family and sign, the four bit-zero choices reach the same internal collision point.

Follow bit zero through to the public output#

Those four choices can still produce different final coordinates. Write U=(x,y)U=(x,y) over the coordinate field Fp\mathbb F_p .

Note: each multiplier of PP in the family table is nonzero modulo rr, so UU has order r>3r>3. Thus x,y≠0x,y\neq0: a finite point with y=0y=0 has order 2, and on this curve x=0x=0 gives order 3.

Substituting the stock hint’s zero slope into the remaining helper formulas gives the following ratio ℓ\ell and immediate loop output R0R_0:

ℓ=−2y3x,R0=(x+ℓ2,  ℓ3−y), \begin{aligned} \ell&=-\frac{2y}{3x},\\ R_0&=(x+\ell^2,\;\ell^3-y), \end{aligned}
Where the ratio and the coordinates of R0 come from

At the collision, both helper inputs are U=(x,y)U=(x,y), and its first slope is zero. The helper’s temporary coordinate , named x2 in the code, is therefore

x2=02−x−x=−2x. x_2=0^2-x-x=-2x.

The next ratio uses numerator 2y2y and denominator x2−xx_2-x, giving

ℓ=2yx2−x=2y−3x=−2y3x. \ell=\frac{2y}{x_2-x} =\frac{2y}{-3x} =-\frac{2y}{3x}.

Here ℓ\ell is the value stored in the helper’s λ2 after adding the zero first slope. That name comes from its negative-second-slope formula and is unrelated to the GLV eigenvalue λ\lambda.

If x0,y0x_0,y_0 denote the returned coordinates, substituting x2=−2xx_2=-2x into the last two formulas gives

x0=ℓ2−x−x2=x+ℓ2,y0=ℓ(x0−x)−y=ℓ3−y. \begin{aligned} x_0&=\ell^2-x-x_2=x+\ell^2,\\ y_0&=\ell(x_0-x)-y=\ell^3-y. \end{aligned}

These are the coordinates of R0R_0. This substitution follows the circuit’s field arithmetic after its exceptional input; it doesn’t assume the returned pair is a valid curve point.

We can check R0R_0 against the curve equation : here, a finite point (X,Y)(X,Y) must satisfy Y2−X3−4=0Y^2-X^3-4=0. Substituting its coordinates and using y2=x3+4y^2=x^3+4 and 3xℓ=−2y3x\ell=-2y, we get

(ℓ3−y)2−(x+ℓ2)3−4=−3x2ℓ2=−43y2≠0.(\ell^3-y)^2-(x+\ell^2)^3-4=-3x^2\ell^2=-\frac43y^2\neq0.

Since y≠0y\neq0, the result is nonzero, so R0R_0 is off curve before either low-bit correction.

The two low-bit corrections then act in order. Let ⊞\boxplus denote the exact AddUnified coordinate formula , including its selectors. Call the value after the first correction R1R_1:

R1={R0,z1=1,(−ε1P)⊞R0,z1=0, R_1= \begin{cases} R_0,&z_1=1,\\ (-\varepsilon_1P)\boxplus R_0,&z_1=0, \end{cases}

The second correction gives RexpectedR_{\mathrm{expected}}, the final coordinates compared with the public expected result:

Rexpected={R1,z2=1,(−ε2ϕ(P))⊞R1,z2=0. R_{\mathrm{expected}}= \begin{cases} R_1,&z_2=1,\\ (-\varepsilon_2\phi(P))\boxplus R_1,&z_2=0. \end{cases}
Why bit zero selects R1 and the final result this way

The correction is designed for the odd-prefix encoding . With valid loop arithmetic, the coefficient after processing every bit above position zero would be 2⌊mj/2⌋+12\lfloor m_j/2\rfloor+1 for the signed base point. The desired magnitude is mj=2⌊mj/2⌋+zjm_j=2\lfloor m_j/2\rfloor+z_j. Subtracting one copy of that signed base point when zj=0z_j=0 removes the difference; a bit of 1 needs no correction.

For the first component, that signed base point is [ε1]P[\varepsilon_1]P. The code computes the correction candidate (−ε1P)⊞R0(-\varepsilon_1P)\boxplus R_0, then Select(s1bits[0], ...) keeps R0R_0 for a bit of 1 or chooses that candidate for a bit of 0. The selected coordinates are R1R_1.

The second component works on this selected R1R_1, using signed base point [ε2]ϕ(P)[\varepsilon_2]\phi(P). Its correction candidate is (−ε2ϕ(P))⊞R1(-\varepsilon_2\phi(P))\boxplus R_1. The second selector keeps R1R_1 when z2=1z_2=1 and chooses the candidate when z2=0z_2=0, producing RexpectedR_{\mathrm{expected}}.

The order matters. If the first correction changes the coordinates, the second formula receives those changed coordinates. With z1=z2=1z_1=z_2=1, both selectors keep their input, so the final result is simply R0R_0.

Once R0R_0 is off curve, these corrections must be followed as coordinate arithmetic. Abstract group addition assumes valid curve points and can’t describe what the circuit does with this malformed operand.

With the standard BLS12-381 G1 generator as PP, all 32 reproduced cases had a final public output off curve and different from native [s]P[s]P, and a Groth16 proof for each verified with honestly generated keys.

Kudos for the curious one that arrived here btw :D