# VaderPoolV2 minting synths & fungibles can be frontrun

VaderPoolV2 mintSynth/mintFungible take a caller-supplied `from` address, letting an attacker frontrun a victim's approval and mint to themselves, stealing the deposit.

- Payout: Audit contest
- Severity: high
- Program: Vader Protocol
- Found by: cmichel
- Disclosed: 2022-05-03
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2021-12-vader-findings/issues/147
- Library page: https://bugbountylibrary.com/r/c4%3A2021-12-vader%3AH-01
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:access-control vuln:business-logic

**Target:** VaderPoolV2 mintSynth/mintFungible pool functions
**Root cause:** mintSynth and mintFungible call nativeAsset.safeTransferFrom(from, address(this), nativeDeposit) with a user-supplied `from` instead of msg.sender, so anyone holding an approval can pull a victim's tokens and direct output to an arbitrary `to`.
**Steps:**
1. Victim approves VaderPoolV2 for nativeAsset (tx 1).
2. Victim submits `mintSynth(foreignAsset, nativeDeposit, from=victim, to=victim)` (tx 2).
3. Attacker observes tx 2 in mempool and submits `mintSynth(foreignAsset, nativeDeposit, from=victim, to=attacker)` with higher gas.
4. Attacker's tx executes first: safeTransferFrom pulls victim's approved nativeDeposit, synths minted to attacker.
5. Victim's tx reverts or is drained of allowance.
**How found:** Code review of mintSynth/mintFungible noticed the `from` parameter is caller-controlled rather than msg.sender, and that these functions are called directly on the pool (not via Router), forcing a separate approval tx that creates a frontrunnable window.
**Exploitation:** Attacker needs only the victim's pending mint tx and an existing approval to the pool. By replaying the same `from=victim` with `to=attacker` and outbidding gas, the attacker's call consumes the victim's allowance and receives the minted synths/fungibles, extracting the victim's native deposit value.
**Insight:** When a mint/deposit function accepts a `from` address instead of using msg.sender, any prior approval becomes spendable by anyone; also note that bypassing a Router means users must approve the pool directly, widening the frontrun window across two transactions.
