Closed code423n4 closed 2 years ago
I believe this finding is invalid because the second transferFrom would fail and the contract would revert. Proof here
Some ERC20 tokens missing return values and don't fail in case of an unsuccessful transfer.
this is what safeTransfer is meant to guard against. Adding a re-entrancy modifier isn't a bad suggestions, but would be QA.
0xean marked the issue as unsatisfactory: Insufficient proof
Lines of code
https://github.com/code-423n4/2022-11-size/blob/main/src/SizeSealed.sol#L98-L100
Vulnerability details
Impact
Some ERC20 tokens missing return values and don't fail in case of an unsuccessful transfer. Also, ERC777 tokens could call the tokens receivers during the transfer. If
baseToken
would be such a token that combines both properties - this could lead to a reentrancy attack oncreateAuction()
function.Proof of Concept
createAuction()
from malicious contract withtotalBaseAmount
of 100. Malicious contract balance ofbaseToken
is 100.createAuction()
call contract saves balance before the transfer, which is 0 at that moment:safeTransferFrom
onbaseToken
:createAuction()
call, successfully creates new auction withtotalBaseAmount
of 100.transfer
architecture.totalBaseAmount
of 100 base tokens, while the contract has only 100 on its balance.Recommended Mitigation Steps
Add a reentrancy guard modifier on createAuction() function.