I Verified Both Arena Circuits. Both Will Prove the Wrong Thing If You Only Check the Proof.
#AgentGames @ZKVProtocol
By @stoploss44, for the zkVerify Agent Games Creator Track, Season 01 (21 October – 21 November 2026; judging 22–30 November 2026). Entry 2 of 2.
Entry 1 verified the Proof Gatekeeper circuit and built a working gatekeeper loop around it. This entry does the thing entry 1 left open: it verifies the second arena circuit — vfyPolicy, the Steal the VFY policy circuit — with real proofs, real traps, and real timings. Then it turns around and attacks the entry-1 gatekeeper itself, to find out exactly which attacks it stops and where each one stops.
Everything below was executed locally on my own machine: no mainnet transaction, no VFY spent, no live endpoint, no wallet connected. Where something could not be verified, I say so instead of guessing.
1. The second circuit — and where its input names came from
The tournament serves two circuits at /api/circuit-info. Entry 1 used the first. The second:
vfyPolicy vkHash: 0x6c56509f1c56fd1fd4e9737f906d2220f4b95f1d507f1adf6899085bd74be047
https://agentgames.zkverify.io/circuits/vfy-policy.wasm (2,991,212 bytes)
https://agentgames.zkverify.io/circuits/vfy-policy_final.zkey (810,586 bytes)
SHA-256 of the files I downloaded (verified on 17 November 2026):
bc0998250d2baf75b89deef5306867ffa7085a08d4f7d2caf0dd63a060b134d2 vfy-policy.wasm
f9666a1655279ef27f7fee6d535ac8aa9e39286ac40ff6279fea87c21ab6ce41 vfy-policy_final.zkey
Exported verification key with snarkjs 0.7.6: curve bn128, 9 public inputs.
The site does not publish the circuit source or the input signal names — same as the gatekeeper. I took the names from a fellow participant's public, open-source repo (DaddyUnikii/zkverify-agent, src/stealVfy.js and test/test.js), then confirmed them against the circuit itself: snarkjs groth16 fullProve rejects unknown or missing input names outright, and the proofs below only succeed with exactly these names. The policy the circuit enforces also matches that repo's decision function, trap by trap — see §2.
| # | signal | role |
|---|---|---|
| 1 | commitment |
Poseidon hash of the 8 strategy params + salt (public) |
| 2 | matchId |
match id as an integer (public) |
| 3 | turnNumber |
turn number (public) |
| 4 | selfBalance |
my balance this turn (public) |
| 5 | opponentBalance |
opponent balance this turn (public) |
| 6 | action |
0 = HOLD, 1 = FORTIFY, 2 = EXTRACT (public) |
| 7 | amount |
amount to extract (public) |
| 8 | circuitVersion |
circuit version, "1" (public) |
| — | salt |
private nonce (private) |
| — | strategyParams |
8 private strategy numbers (private) |
The 9 public signals are one output plus these 8 public inputs, in this order:
[output, commitment, matchId, turnNumber, selfBalance, opponentBalance, action, amount, circuitVersion]
The demo fixture I used is the public starter default from that same repo — params 8,18,8,0,0,0,0,0, salt 12345678901234567890. That salt is a published demo value, not a secret. The policy it encodes: if selfBalance < params[1] (18) → FORTIFY; else if opponentBalance < params[2] (8) → HOLD; otherwise → EXTRACT params[0] (8). Match id used: a1b2c3d4-0000-1111-2222-333344445555 (decimal 214933908028433900551448047275865298261).
The commitment is Poseidon([8, 18, 8, 0, 0, 0, 0, 0, 12345678901234567890]):
18509752657592529527109630018603854483195680471699643211660232613401632907815
0x28ec26140d6d66210a6816b9caef250448cc76a6f5e440a0a23dea4ead032227
I verified that value independently: it appears as public signal [1] in every valid proof below, and a proof with a different commitment fails (T2).
2. The policy circuit, run for real — 3 valid cases, 4 traps
All runs: snarkjs groth16 fullProve + groth16.verify against the exported verification key, local only.
| case | what I did | result |
|---|---|---|
| V1 — EXTRACT | turn 1, self 100, opp 100, action EXTRACT 8 | PROVED + VERIFIED, 2,007 ms, proof 723 bytes |
| V2 — FORTIFY | turn 2, self 10 (< 18), opp 100, action FORTIFY | PROVED + VERIFIED, 1,098 ms, proof 721 bytes |
| V3 — HOLD | turn 3, self 100, opp 5 (< 8), action HOLD | PROVED + VERIFIED, 898 ms, proof 724 bytes |
| T1 — wrong action | self 10 (policy says FORTIFY), claimed EXTRACT 8 |
FAILED, 140 ms — Assert Failed. Error in template VfyPolicyProof_154 line: 140
|
| T2 — wrong commitment | commitment from a different salt (999) |
FAILED, 273 ms — VfyPolicyProof_154 line: 72
|
| T3 — wrong amount | EXTRACT 5 when params[0] is 8 |
FAILED, 183 ms — VfyPolicyProof_154 line: 149
|
| T4 — wrong circuitVersion | circuitVersion "2" instead of "1", everything else valid | PROVED + VERIFIED, 1,000 ms, proof 724 bytes |
| T5 — replay | V1's proof verified against turn-2 public signals | verify = false, 22 ms (control: V1 proof against its own signals verifies = true) |
V1's full public signals, for the record:
["6396486238659655343650970048011779167413974050820627010779539413176448134638",
"18509752657592529527109630018603854483195680471699643211660232613401632907815",
"214933908028433900551448047275865298261",
"1", "100", "100", "2", "8", "1"]
Three things matter here.
First, the circuit enforces the policy. T1, T2 and T3 each fail at a different assert line — the circuit checks the action against the balances (line 140), the commitment against the private params and salt (line 72), and the amount against the committed extract size (line 149). You cannot manufacture a proof for a move your committed strategy would not make.
Second, the circuit does NOT enforce circuitVersion. T4 proves and verifies with version "2". The build guide says a submission with a circuitVersion that doesn't match the registered strategy commitment is rejected — so that check lives on the platform, not in the circuit. If the platform ever stopped checking it, a version-"2" proof would sail through verification. That is exactly the pattern entry 1 warned about, now measured on the second circuit.
Third, replay is bound to the turn. T5 shows a turn-1 proof fails verification the moment the public signals say turn 2 (22 ms). The binding is in the public signals themselves — matchId and turnNumber are public inputs — so a stale proof cannot be re-presented as a fresh turn. The platform's independent public-inputs hash check is the same idea at the protocol layer: I computed the keccak256 hash of the 8 public fields for the V1 case as 0x8facf862e7a8e83cf9361fdda2d07f8e83149d88d165f2c9a064f367fa288d9b using the same 8-field layout as the public reference implementation. Whether the platform's independently computed hash matches that value for a live turn is something I cannot check locally — I never submitted a live turn — so I state it as untested, not as confirmed.
One honest unknown: public signal [0] — the circuit's output. In the gatekeeper, entry 1 identified it as Poseidon([salt, taskId]). For vfyPolicy I tested about twenty candidate constructions (Poseidon over the public inputs in several orders, with and without the salt and params, chained two-stage Poseidon, MiMC sponge, and the keccak256 public-inputs hash reduced mod the field prime). None matched. What I did establish: it changes whenever any public input changes, including circuitVersion alone (V1 vs T4 prove that). It is a binding hash of some kind, but its exact preimage is not published and I could not identify it from the outside. The circuit source is unpublished, so this stays open — I am not going to invent a formula for it.
3. Attacking my own gatekeeper — 7 attacks, measured
Entry 1 built the gatekeeper; this entry tries to break it. Same local server (gatekeeper.cjs from entry 1, port 8787), same demo secret. Every attack below was run, not reasoned about.
| attack | what I did | result |
|---|---|---|
| A1 — replay | Valid task first, then the same envelope again, then the same proof_tx under a different task id |
First: APPROVE (VALID_CONDITION), 2,380 ms, proof attached. Replay, same task: REJECT (PROOF_REFUSED), 110 ms, no proof. Replay, different task id: REJECT (PROOF_REFUSED), no proof. |
| A2 — salt reuse | Same salt (987654321) on two different tasks |
Both APPROVE. Poseidon([987654321, 24]) = 4538591768452999874275481926009620849813943225939850916630922448132760538048; Poseidon([987654321, 25]) = 13443885870864708259168547632395828089111360433007526592635045250264796213919 — different. Second task: APPROVE (VALID_CONDITION), 1,150 ms, proof attached. |
| A3 — fake VK | Direct circuit run: registered and proof VK both 0xaaaa… (self-consistent, never registered), valid condition, decision APPROVE |
PROVED + VERIFIED, 2,020 ms, proof 722 bytes. Both hash fields in the public signals: 11529997542692971282308106103353446636534896575845606328543776778881327606439 (the 0xaaaa… hash reduced mod the field prime). |
| A4 — forged HMAC | Signed a valid envelope, then changed amount 500 → 1500 without re-signing; also a request with the wrong secret |
HTTP 401 in 4 ms ({"error":"bad signature"}); wrong secret: HTTP 401 in 3 ms.
|
| A5 — wrong decision | (a) Prove decision REJECT for a valid condition. (b) Take entry 1's real APPROVE proof and flip its decision signal 1 → 0, then verify. | (a) FAILED, 104 ms — GatekeeperEvaluation_79 line: 102. (b) verify = false, 91 ms (unflipped control: verify = true). |
| A6 — proof transplant | Take entry 1's real proof (task 24) and verify it against public signals with taskId 25 | verify = false, 20 ms. |
| A7 — response tamper | Recompute the HMAC of a server response with the demo secret; then change one character in the body and check the old signature | Signature matches recomputed HMAC: true. After a 1-character tamper, the old signature is still valid: false. |
What each attack actually shows:
-
A1: replay is stopped — but not by the circuit. The gatekeeper's seen-set catches the reused
proof_txfirst and decides REJECT. Then the circuit refuses to prove that rejection, because for a valid condition the only provable decision is APPROVE — so the response carries reasonPROOF_REFUSEDand no proof at all. A proof refusal is itself the fail-closed rejection. If you treated "circuit failed" as an error to retry, you would re-approve a replayed payment. The handler does not do that. - A2: salt reuse across tasks is safe, by design. The salt is the same in both tasks (the demo server uses one fixed salt), but the commitment binds salt and task id, so the two commitments differ and both proofs are independently valid. Reusing a salt is not a vulnerability here — the binding is what matters, and it holds.
-
A3: this is the hole. A proof generated under a verification key nobody registered verifies perfectly — 2,020 ms, 722 bytes,
verify = true. The circuit only checks that the two VK hashes are equal to each other. The check that saves you lives outside the proof: the gatekeeper compares the registered VK against the value the platform published (0x6b79c6…d77b0) and rejects anything else. A verifier that only callsverify()and skips that comparison would accept this proof and authorize a payment under an attacker's key. That is the sentence from the build guide, now with a receipt: a proof can verify perfectly and still authorize the wrong action. - A4: the signature check is the first wall, and it holds. A tampered body is rejected in 4 ms, before any parsing or proving. Nothing after the HMAC check ever sees a forged envelope.
- A5 and A6: the proof is bound to the decision and the task. You cannot prove the wrong decision (the witness does not exist, line 102), you cannot flip the decision inside a real proof's public signals (verify = false), and you cannot move a real proof to another task (verify = false). These are the bindings the circuit does enforce, and they hold.
4. Both circuits, head to head
| Proof Gatekeeper | vfyPolicy (Steal the VFY) | |
|---|---|---|
| System | Groth16 / BN128, Circom 2.x | Groth16 / BN128, Circom 2.x |
| Public inputs | 13 | 9 |
| WASM / zkey bytes | 1,755,820 / 309,750 | 2,991,212 / 810,586 |
| Valid prove time | 1,050 ms (entry 1) | 898–2,007 ms (V1–V3) |
| Proof size | 721 bytes (entry 1) | 721–724 bytes |
| Template | GatekeeperEvaluation_79 |
VfyPolicyProof_154 |
| Enforces in-circuit | decision == computed verdict (7 checks); proof bound to task id + decision | action == committed policy; commitment == Poseidon(params, salt); proof bound to matchId + turn |
| Verified NOT enforced in-circuit | VK must equal the registered VK (only equality of the two hashes); replay (seen-set, off-circuit) |
circuitVersion (T4 proves with "2"); replay is bound in-circuit via matchId + turn (T5) |
| Output [0] |
Poseidon([salt, taskId]) — identified (entry 1) |
Binding hash, changes with every public input — preimage unidentified, see §2 |
The pattern is the same in both arenas, and it is the whole point of this entry: the circuit is the narrow part of the system. Each circuit enforces exactly what it says and nothing more. The gatekeeper will happily prove an approval under a key the platform never registered. The policy circuit will happily prove a move under a version the platform never issued. In both cases the proof is real, the verification is real, and the payment or move would still be wrong — unless the agent checks the key against the registered value, the version against the registered commitment, the proof reference against the seen-set, and the signature before anything else. Verify the proof. Then verify everything else too. That was entry 1's conclusion; entry 2 is the evidence for it, on the second circuit and against its own gatekeeper.
5. What this is — and what it is not
This is: a local, reproducible verification of the tournament's second circuit (3 valid proofs, 4 traps, 1 replay check, all with timings and assert lines); an adversarial test of the entry-1 gatekeeper (7 attacks, each with a measured outcome); and a head-to-head comparison of what each circuit enforces versus what must be checked off-circuit.
This is not: a live arena entry. I did not deploy a public endpoint, did not play a Steal the VFY match, did not submit anything to Kurier or zkVerify mainnet, and spent no VFY. I did not verify the platform's independent public-inputs hash against a live turn, and I did not identify vfyPolicy's output [0] — both are stated above as unverified / unknown, not as results.
Reproduce it yourself:
curl -sL -o vfy-policy.wasm https://agentgames.zkverify.io/circuits/vfy-policy.wasm
curl -sL -o vfy-policy_final.zkey https://agentgames.zkverify.io/circuits/vfy-policy_final.zkey
npm install snarkjs@0.7.6 circomlibjs
node node_modules/snarkjs/build/cli.cjs zkey export verificationkey vfy-policy_final.zkey vfy-policy_verification_key.json
# then: snarkjs.groth16.fullProve(input, 'vfy-policy.wasm', 'vfy-policy_final.zkey')
# snarkjs.groth16.verify(verification_key, publicSignals, proof)
Input names are in §1; the demo params and salt are 8,18,8,0,0,0,0,0 and 12345678901234567890; the match id in §1. If your witness fails with the assert at VfyPolicyProof_154 line 140, your action disagrees with the committed policy; line 72 is the commitment; line 149 is the amount. And if your proof verifies with circuitVersion: "2", that is the circuit doing exactly what it was built to do — and your platform check doing nothing.
Built by @stoploss44 for the zkVerify Agent Games Creator Track. Season 01 runs 21 October – 21 November 2026; judging 22–30 November. Circuit files are the tournament's own, from agentgames.zkverify.io/circuits; verification-key hashes from /api/circuit-info. Input signal names cross-checked against a fellow participant's public repo (github.com/DaddyUnikii/zkverify-agent) and confirmed by the circuit itself. All runs local; no funds moved. #AgentGames
Top comments (0)