Target is hidden
This information is not publicly available.
Root cause: The withdrawal proof path accepts multiple raw bytes32 encodings of one BN254 field element, while scoped ZendexVaultManager and TreeOperator use those unvalidated raw encodings as distinct nullifier keys.
Exploit condition: An unprivileged user needs one ordinary funded note and its inclusion witness, then constructs withdrawal proofs whose Fiat-Shamir transcripts contain nullifier + kq for the BN254 scalar modulus q. No privileged role, victim interaction, forged circuit relation, unusual configuration, or public-chain mutation is required.
Impact: One funded note can be withdrawn six times. The deployed-state fork steals 300,005 of 15,000,000 pre-existing vault units (>2% TVL); the isolated arm steals 5% and makes a genuine 99-unit victim note insolvent.
Primary proof: pocs/noncanonical-nullifier-replay/artifacts/run_fork.txt
Weakness: Cryptography Implementation Flaw / CWE-20: Improper Input Validation / CWE-841: Improper Enforcement of Behavioral Workflow
Severity: Critical (program-defined)
withdraw is permissionless, the attacker seed is 60,001/15,000,000 units (0.400006% of pinned TVL), six proofs are produced in seconds after a one-time prover build, and maximum measured transaction gas is 4,221,921.Scope asset: https://github.com/hackenproof-public/zendex-sc
Affected:
b25f3c3a633056907690ed868deaae0b4ad33407 (the sole contest-repository commit).ZendexVaultManager proxy 0x349030c658eA1d5803daC35604d5061Ec9EF7Fc3 using withdrawal verifier 0xc14ADDA7C4193181D3fb2D2899BC1BEaD670c7A4.At pinned block 26476309, the documented mock-USDT vault holds 15,000,000 raw units. Alice mints the deployed test token's openly available 60,001 test units—the equivalent production seed would be acquired normally—then makes one valid private deposit. For each k=0..5, she generates a proof transcript against raw nullifier n + kq. The circuit still evaluates canonical field value n, but the manager consumes six different Solidity mapping keys and releases 60,001 units each time. Alice receives 360,006 units, steals 300,005 units of prior backing, and leaves 14,699,995. The matched isolated arm starts with a genuine 99-unit victim note plus Alice's one-unit note and proves the victim's authentic redemption reverts after the six withdrawals.
The generated withdrawal verifier transcript hashes each caller-supplied public input as raw bytes32, so a matching proof can be constructed for every distinct encoding. Later, the same verifier converts each public input with FrLib.fromBytes32, whose implementation applies % MODULUS. Consequently, n, n+q, ..., n+5q produce different transcripts but the identical public-input relation when they fit in uint256.
After verification, scoped ZendexVaultManager parses the same bytes as an unreduced uint256. The public withdraw path validates and consumes that raw value, while BaseManager's replay check and TreeOperator storage never enforce nullifier < q. Proof validity and replay identity therefore disagree.
The research patch changes only native prover transcript serialization; the witness and circuit relations remain canonical. The control proves that an ordinary proof with only calldata changed reverts. The exploit then supplies a separately constructed valid proof for each raw encoding. This violates Zendex's documented nullifier guarantee that publishing the nullifier prevents another spend.
Replay protection fails at the field-to-Solidity boundary: six state keys authorize six releases for one funded claim. On the current documented deployment snapshot, a 0.400006%-TVL seed steals 2.000033% of pre-existing vault backing in six calls. The shared-pool shortfall is borne entirely by other depositors: the last redeemers lose 100% of otherwise valid notes, so the same deployed arm exceeds the 1%-of-affected-deposit threshold. The isolated arm directly demonstrates this consequence with a genuine victim note that loses 5.05% and cannot redeem in full. The deployed token is an openly mintable testnet mock, so present monetary loss is nil; the Critical classification follows the program-defined relative thresholds and the identical production custody path.
Before proof verification or state lookup, reject every public input that is not a canonical BN254 scalar-field encoding (uint256(input) >= q). At minimum, enforce nullifier < q in the scoped manager before _validateNullifier and _consume; preferably centralize canonical checks for all proof public inputs in BaseManager/ZendexVerifierHub. Regenerate verifiers with the same check as defense in depth and retain tests for n + kq, including transcript-aware proofs rather than only mutated canonical proofs.
The attached pocs/noncanonical-nullifier-replay bundle pins Zendex and Barretenberg v0.87.0 source revisions, applies the transcript-only research patch and native Hardhat test patches, builds the pinned prover reproducibly in the PoC-local .work directory, and runs either PoC fork: deployed verifier accepts six aliases and loses over two percent TVL or PoC: six field aliases replay one note and make a victim note insolvent from test/ZendexVaultManager.withdraw.test.ts. Both modes use ephemeral Hardhat state and send no public transaction.
26476309. Expect 8-20 minutes for the clean native build; proof execution takes under one minute in the captured fork run.unzip noncanonical-nullifier-replay.zip
cd noncanonical-nullifier-replay
./run.sh --preflight
./run.sh --fork
# Archive override:
FORK_RPC_URL=https://archive.example ./run.sh --fork
1 passing receipt, FORK_ALIAS_ENCODINGS_ACCEPTED=6, FORK_VICTIM_BACKING_STOLEN=300005, and FORK_VAULT_AFTER=14699995 in artifacts/run_fork.txt; observe the stable Control:, Exploit:, Impact:, and RESULT: PASS lines in terminal output and artifacts/console_fork_summary.txt../run.sh
Confirm ordinary proof mutation is rejected, six aliases withdraw one unit each, and VICTIM_WITHDRAWAL_REJECTED=true in artifacts/run_poc.txt; observe RESULT: PASS in terminal output and artifacts/console_summary.txt..work directory.run.sh --fork run:
run.sh run:
pocs/noncanonical-nullifier-replay/artifacts/run_fork.txt - primary block-pinned deployed-state transcript.pocs/noncanonical-nullifier-replay/artifacts/run_poc.txt - isolated genuine-victim/control transcript.pocs/noncanonical-nullifier-replay/artifacts/assertions.txt, control_comparison.txt, and manifest.txt - stable proof markers, expected-versus-buggy boundary, and package hashes.pocs/noncanonical-nullifier-replay/noncanonical-barretenberg.patch - transcript-only pinned prover change.pocs/noncanonical-nullifier-replay/withdraw-replay.patch and withdraw-fork.patch - exact native test patches.pocs/noncanonical-nullifier-replay.zip - deterministic analyst replay bundle.
Comments are hidden
This information is not publicly available.