Return values are not checked for transferFrom
and transfer
calls to external tokens
#110
Labels
bug
Something isn't working
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/supervaults/contracts/SuperVault.sol#L271
https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/supervaults/contracts/SuperVault.sol#L283
https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/supervaults/contracts/SuperVault.sol#L218
Vulnerability details
Impact
when calling
transferFrom
ortransfer
of an external token a bool indicating success / failis returned. Not checking this return value can cause the transaction to proceed even when the transfer has failed.
for example in SuperVault.depositToVault
token.transferFrom
can fail but the asset will still get deposited.Proof Of Concept
From the ERC20 docs:
In
SuperValut.depositToVault,
SuperValut.depositAndBorrowFromVault,
SuperValut.emptyVault
transferFrom
(ortransfer
) return value is not checked. anasset
which returns false intransferFrom
(ortransfer
) can be passed to these functions.An example for such asset is the Basic Attention Token which implements this transfer() and this transferFrom()
Tools Used
Manual Inspection with VSCode.
Recommended Mitigation Steps
check the return values of these calls:
token.transferFrom(msg.sender, address(this), amount);
->
require(token.transferFrom(msg.sender, address(this), amount), "transfer failed");
and the same for
transfer()
The text was updated successfully, but these errors were encountered: