Reproduced Exploit

VaderPoolV2 `mintSynth` mints a victim's deposit to an attacker (arbitrary `from`)

Nov 2021Otheraccess-control3 min read

Chain

Other

Category

access-control

Date

Nov 2021

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 42335-h-13-anyone-can-arbitrarily-mint-synthetic-assets-in-vaderpo. Standalone Foundry PoC and full write-up: 42335-h-13-anyone-can-arbitrarily-mint-synthetic-assets-in-vaderpo_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/access-control/missing-auth · vuln/defi/frontrun · fake-account-substitution

Reproduction: the test deploys the REAL, unmodified audited Vader dex-v2 contracts (VaderPoolV2, BasePoolV2, SynthFactory, Synth, LPWrapper, LPToken, VaderMath) vendored under src/vader/ and runs the actual mintSynth exploit end to end. Only the opaque native/foreign ERC20s are minimal real tokens.

Root cause#

VaderPoolV2.mintSynth is external and permissionless, yet it takes a caller-supplied from and pulls the native deposit from it:

SOLIDITY
function mintSynth(IERC20 foreignAsset, uint256 nativeDeposit, address from, address to)
    external override nonReentrant supportedToken(foreignAsset) returns (uint256 amountSynth)
{
    nativeAsset.safeTransferFrom(from, address(this), nativeDeposit); // @> pulls from an ATTACKER-chosen address
    ...
    synth.mint(to, amountSynth);                                     // @> mints the synth to an ATTACKER-chosen address
}

The protocol intends users to interact through the router, so a user first approves the pool and then calls mintSynth for themselves. Because from is unauthenticated, any account can watch the mempool for a pool approval and front-run the victim, calling mintSynth(foreignAsset, nativeDeposit, from = victim, to = attacker). The victim's approved native is spent and the resulting synth is minted to the attacker. The fix (per the finding) is to remove from and transfer from msg.sender.

The exact audited source is vendored at src/vader/contracts/dex-v2/pool/VaderPoolV2.sol (mintSynth, L126-167).

Exploit walkthrough (real numbers)#

  1. A legitimate LP seeds the USDC pair with 100 native / 100 foreign via the real mintFungible, so the synth price is non-zero.
  2. The victim holds 10 VADER and approves the pool (intending to mint a synth for themselves).
  3. The attacker calls mintSynth(USDC, 10e18, from = victim, to = attacker).
  4. Result: the victim's 10 VADER is pulled into the pool and 8.264 synth (calculateSwap(10, 100, 100)) is minted to the attacker for free. The victim ends with 0 native and 0 synth.
sequenceDiagram participant V as Victim participant P as VaderPoolV2 (real) participant A as Attacker participant S as Synth (real) V->>P: approve(pool, max) (intends to mint a synth later) A->>P: mintSynth(USDC, 10, from=Victim, to=Attacker) P->>V: safeTransferFrom(Victim, pool, 10 VADER) P->>S: mint(Attacker, 8.264) Note over A,S: Attacker receives 8.264 synth<br/>Victim loses 10 VADER

Reproduction#

BASH
_shared/run-poc/run_poc.sh 42335-h-13-anyone-can-arbitrarily-mint-synthetic-assets-in-vaderpo_exp -vvvvv

Expected: 1 passed. The assertions in test/42335-h-13-anyone-can-arbitrarily-mint-synthetic-assets-in-vaderpo_exp.sol verify the victim's native drops to 0 and the attacker receives the full minted synth amount.

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.