Reproduced Exploit
VaderPoolV2 `mintFungible` steals a victim's deposit to an attacker (arbitrary `from`)
Chain
Other
Category
access-control
Date
Nov 2021
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
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.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 42336-h-14-anyone-can-arbitrarily-mint-fungible-tokens-in-vaderpoo. Standalone Foundry PoC and full write-up: 42336-h-14-anyone-can-arbitrarily-mint-fungible-tokens-in-vaderpoo_exp in the
evm-hack-registrymirror.
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,LPWrapper,LPToken,VaderMath) vendored undersrc/vader/and runs the actualmintFungible+burnFungibleexploit. Only the opaque native/foreign ERC20s are minimal real tokens.
Root cause#
VaderPoolV2.mintFungible is external and permissionless, yet it takes a caller-supplied from and pulls BOTH deposits from it:
function mintFungible(IERC20 foreignAsset, uint256 nativeDeposit, uint256 foreignDeposit, address from, address to)
external override nonReentrant returns (uint256 liquidity)
{
...
nativeAsset.safeTransferFrom(from, address(this), nativeDeposit); // @> pulls from an ATTACKER-chosen address
foreignAsset.safeTransferFrom(from, address(this), foreignDeposit); // @> pulls from an ATTACKER-chosen address
...
lp.mint(to, liquidity); // @> mints LP to an ATTACKER-chosen address
}
A user first approves the pool for both assets, then calls mintFungible for themselves. Because from is unauthenticated, any account can front-run the victim, calling mintFungible(foreignAsset, nativeDeposit, foreignDeposit, from = victim, to = attacker). The victim's approved native+foreign are pulled into the pool and the LP tokens are minted to the attacker — who then burns them to withdraw the victim's assets. The Vader team confirmed these mint functions should have carried onlyRouter. The fix is to remove from and transfer from msg.sender.
The exact audited source is vendored at src/vader/contracts/dex-v2/pool/VaderPoolV2.sol (mintFungible, L284-335).
Exploit walkthrough (real numbers)#
- The victim holds 100 VADER + 100 USDC and
approves the pool for both (intending to add liquidity themselves). - The attacker calls
mintFungible(USDC, 100e18, 100e18, from = victim, to = attacker). - The victim's 100 VADER + 100 USDC are pulled into the pool (first mint →
liquidity = nativeDeposit = 100e18), and 100 LP is minted to the attacker. - The attacker
burnFungibles the 100 LP and receives 100 VADER + 100 USDC — the victim's entire deposit. The victim ends with 0 / 0.
Reproduction#
_shared/run-poc/run_poc.sh 42336-h-14-anyone-can-arbitrarily-mint-fungible-tokens-in-vaderpoo_exp -vvvvv
Expected: 1 passed. The assertions in test/42336-h-14-anyone-can-arbitrarily-mint-fungible-tokens-in-vaderpoo_exp.sol verify the victim's native and foreign both drop to 0 and the attacker recovers 100 of each.
Sources#
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 42336-h-14-anyone-can-arbitrarily-mint-fungible-tokens-in-vaderpoo_exp (evm-hack-registry mirror).
- AuditVault finding: 42336-h-14-anyone-can-arbitrarily-mint-fungible-tokens-in-vaderpoo.
- Upstream DeFiHackLabs PoC directory: src/test.
Alerts & third-party analyses
- DeFiHackLabs incident explorer: search "VaderPoolV2
mintFungiblesteals a victim's deposit to an attacker (arbitraryfrom)". - Web3Sec X hacked database: search.
- Rekt leaderboard: search.
- Solodit incident search: search.
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.