Anyone Can Arbitrarily Mint Fungible Tokens In VaderPoolV2.mintFungible()
#147
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
VaderPoolV2
Handle
leastwood
Vulnerability details
Impact
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 callingmintFungible()
. However, any arbitrary user could monitor the blockchain for contract approvals that matchVaderPoolV2.sol
and effectively frontrun their call tomintFungible()
by setting theto
argument to their own address. As a result, thenativeDeposit
andforeignDeposit
amounts are transferred from the victim, and LP tokens are minted and finally transferred to the malicious user who is represented by theto
address.Proof of Concept
https://github.com/code-423n4/2021-11-vader/blob/main/contracts/dex-v2/pool/VaderPoolV2.sol#L284-L335
Tools Used
Manual code review.
Discussions with dev.
Recommended Mitigation Steps
Consider removing the
from
argument inmintFungible()
and update thesafeTransferFrom()
calls to instead transfer frommsg.sender
.The text was updated successfully, but these errors were encountered: