Status DataClose notification

Zendex Disclosed Report

Audit Report

Duplicate join inputs mint an unbacked note and allow theft of vault deposits

Target

Target is hidden

This information is not publicly available.

Vulnerability details

Summary

Root cause: ZendexVaultManager.join validates both input nullifiers before consuming either, while neither the contract nor the JOIN circuit requires the two inputs to be distinct.

Exploit condition: An unprivileged user needs one valid funded note and its ordinary inclusion proof. The inflated withdrawal can be redeposited and doubled again, so the attacker does not need capital comparable to the amount stolen; no privileged role, victim interaction, forged proof, or unusual configuration is required.

Impact: The user can count one note twice, withdraw twice the value supplied, and take the difference from other users’ assets held by ZendexVault.

Primary proof: pocs/duplicate-join-inflation/artifacts/run_fork.txt

Weakness: Business Logic Errors / CWE-841: Improper Enforcement of Behavioral Workflow / CWE-682: Incorrect Calculation

Severity: Critical (program-defined)

  • Severity rationale — high likelihood: the attack is permissionless, needs one ordinary funded note, and the authoritative fork replay's maximum measured transaction gas is 8,498,651, below the deployed 30,000,000 gas block limit.
  • High impact: against the pinned testnet deployment, the PoC compounds a 238,095-unit seed into 15,238,080 units in six cycles and steals 14,999,985 of the vault's 15,000,000 pre-existing mock-USDT units (99.9999%). The isolated victim control separately demonstrates complete loss and failed redemption of a genuine 63-unit depositor note, exceeding both program thresholds.

Scope asset: https://github.com/hackenproof-public/zendex-sc

Affected:

  • Commit b25f3c3a633056907690ed868deaae0b4ad33407 (the sole contest-repository commit).
  • Current documented Horizen testnet ZendexVaultManager proxy 0x349030c658eA1d5803daC35604d5061Ec9EF7Fc3 using the listed JOIN verifier 0xC1931b6d98641B6301Df9f440680a0dDb50Cb4aE.

Attack Scenario

At pinned block 26476309, the testnet vault holds 15,000,000 raw mock-USDT units. The fork uses the deployed mock token's open mint to fund Alice with 238,095 test units—the equivalent production attacker capital would be acquired normally—then Alice deposits them and supplies the same inclusion proof and note as both A and B to join. Because the identical nullifiers are checked before either is consumed, the manager inserts a real double-value commitment. Six deposit/join/withdraw cycles grow the seed to 15,238,080 units and reduce the vault to 15 without touching the public chain. The matched isolated control creates a genuine 63-unit depositor note, drains the vault from a one-unit attacker seed, and proves the unspent depositor note can no longer withdraw.

Technical Details / Evidence

The manager implementation verifies both proofs, calls _validateNullifier for A and B against unchanged state, and only then calls _consume twice. For nullifierA == nullifierB, both validations succeed and both writes merely set the same consumed flag.

The JOIN circuit verifies each nullifier and commitment independently and constrains amount_a + amount_b == amount_c, but never asserts that A and B differ. Identical witnesses therefore produce a valid proof whose output amount is twice the single funded note.

The block-pinned snapshot in artifacts/deployed_state.txt binds this to the real in-scope deployment: at Horizen block 26476309, the documented manager proxy resolves to explorer-verified ZendexVaultManager implementation 0x261ee065ab1b3a4c42ffe695d837019fe2e42fd4; its verified Solidity is identical to the pinned repository file except for one trailing newline. The manager returns the documented vault, the verifier hub returns the documented JOIN verifier, and the vault holds 15,000,000 raw USDT units. The primary replay resets an ephemeral Hardhat chain to that exact block and executes against those deployed contracts and state. No public-chain state was mutated.

This violates the project’s documented nullifier guarantee that publishing a nullifier prevents the same commitment from being spent twice. The authoritative fork transcript records FORK_VAULT_BEFORE=15000000, FORK_SEED_CAPITAL=238095, FORK_ATTACKER_FINAL=15238080, FORK_VICTIM_BACKING_STOLEN=14999985, FORK_VAULT_AFTER=15, and FORK_MAX_GAS_USED=8498651 using the deployed scoped contracts and authentic Noir verifier artifacts.

Impact

Every successful call creates an unbacked claim equal to the attacker’s current input note. With reinvestment, an initial amount A becomes 2^n × A, limited only by vault backing. On the pinned fork, six cycles steal 99.9999% of the pre-existing mock-USDT balance. The matched isolated arm proves the deficit consumes all backing for a genuine 63-unit depositor note and makes its authentic withdrawal revert with ZendexVault__InsufficientBalance.

Mitigation / Patch

Reject equal input nullifiers before proof verification or state mutation, for example if (jp.nullifierA == jp.nullifierB) revert DuplicateJoinInput();, and add the equivalent distinctness constraint to the JOIN circuit (assert(nullifier_a != nullifier_b)). Regenerate and deploy the JOIN verifier, upgrade the manager, and retain a regression test showing that identical inputs revert before commitment insertion.

Validation steps

Proof of Concept

The attached pocs/duplicate-join-inflation bundle pins the target commit, applies the included patches, compiles the scoped contracts and authentic Noir-generated verifiers, and selects cases PoC fork: duplicate join drains the deployed vault backing or PoC: duplicate join compounds a one-unit seed and drains victim backing from test/ZendexVaultManager.join.test.ts. Quick verification is ./run.sh --fork; both modes operate only on ephemeral Hardhat state and never mutate the live testnet.

Steps to Reproduce

  1. Prerequisites: Use Linux with Bash, Git, Node.js 18 or newer, npm, about 3 GiB free disk, and internet access. Fork mode needs archive access to public Horizen testnet block 26476309, defaults to https://horizen-testnet.rpc.caldera.xyz/http, and takes about 4-15 minutes depending on CPU threads; its test timeout is 15 minutes. The isolated mode takes about 1-3 minutes.
  2. Extract and enter the PoC directory:
    unzip duplicate-join-inflation.zip
    cd duplicate-join-inflation
    
  3. Check prerequisites:
    ./run.sh --preflight
    
  4. Primary verification — run the deployed-state fork replay:
    ./run.sh --fork
    
    To override the archive endpoint, run FORK_RPC_URL=https://archive.example ./run.sh --fork. If the pinned block is unavailable, run the isolated arm in step 6 and use the attached fork transcript for deployment corroboration.
  5. Confirm the result: Observe Control: exact deployed proxies, verifiers, tree, vault, token, and pinned state are used on a local fork, the native 1 passing receipt, the 15,238,080-unit attacker balance, 14,999,985-unit loss, and RESULT: PASS in artifacts/run_fork.txt.
  6. Matched isolated control: Run ./run.sh and observe the one-unit seed drain all 63 units, the post-consumption replay rejection, and VICTIM_WITHDRAWAL_REJECTED=true for the genuine unspent depositor note.
  7. Cleanup: run.sh removes its .work clone and build products automatically on success, failure, or interruption. If forcibly killed, remove only the PoC-local directory with rm -rf -- .work, then confirm test ! -e .work.

run.sh --fork run: uploaded-image

run.sh run: uploaded-image

Artifacts & Attachments

  • pocs/duplicate-join-inflation/artifacts/run_fork.txt - primary block-pinned deployed-state fork transcript.
  • pocs/duplicate-join-inflation/artifacts/run_poc.txt - matched isolated victim/control transcript.
  • pocs/duplicate-join-inflation/artifacts/deployed_state.txt - read-only block-pinned binding to the real in-scope deployment.
  • pocs/duplicate-join-inflation/join-duplicate.patch and join-fork.patch - exact isolated and fork test source patches.
  • pocs/duplicate-join-inflation.zip - deterministic one-command analyst replay bundle.

Attachments

duplicate-join-inflation.zip

Comments are hidden

This information is not publicly available.