Submitted by leastwood
The mintFungible() function is callable by any user that wishes to mint liquidity pool fungible tokens. The protocol expects a user to first approve the contract as a spender before calling mintFungible(). However, any arbitrary user could monitor the blockchain for contract approvals that match VaderPoolV2.sol and effectively frontrun their call to mintFungible() by setting the to argument to their own address. As a result, the nativeDeposit and foreignDeposit amounts are transferred from the victim, and LP tokens are minted and finally transferred to the malicious user who is represented by the to address.
https://github.com/code-423n4/2021-11-vader/blob/main/contracts/dex-v2/pool/VaderPoolV2.sol#L284-L335
Manual code review.
Discussions with dev.
Consider removing the from argument in mintFungible() and update the safeTransferFrom() calls to instead transfer from msg.sender.
SamSteinGG (Vader) disputed:
alcueca (judge) commented:
SamSteinGG (Vader) confirmed:
