Submitted by cmichel, also found by cccz, Critical, danb, leastwood, and TomFrenchBlockchain
The VaderPoolV2 mintFungible and mintSynth functions perform an unsafe nativeAsset.safeTransferFrom(from, address(this), nativeDeposit) with a parameter-specified from address.
Note that these functions are not called by the Router, they are directly called on the pool.
Therefore, users will usually be required to send two transactions, a first one approving the pool, and then a second one for the actual mintSynth.
An attacker can frontrun the mintSynth(IERC20 foreignAsset, uint256 nativeDeposit, address from, address to) function, use the same from=victim parameter but change the to parameter to the attacker.
Its possible to frontrun victims stealing their native token deposits and receiving synths / fungible tokens.
Remove the from parameter and always perform the safeTransferFrom call with from=msg.sender.
SamSteinGG (Vader) acknowledged
