The DaiGoldAuction
contract allows setting the bid token to any ERC20 token, assuming it has no internal taxes, fees, or callbacks. If a token with callback functions is used (intentially or not), unexpected behaviour can occur, because Checks-Effects-Interactions (CEI) pattern is not applied in the bid
function of DaiGoldAuction
contract.
The DaiGoldAuction
contract’s bid token can be set to any ERC20 token, and it relies on the assumption that the bid token has no internal taxes, fees, or callbacks. This assumption is not enforced programmatically, making the contract vulnerable to tokens with callback functions.
The current implementation of the bid
function transfers the tokens before updating the state, which is not compliant with the CEI pattern:
Without the CEI pattern, a token with a callback function could exploit the transfer and re-enter the contract, causing unexpected behavior.
This finding is similar to https://codehawks.cyfrin.io/c/2024-07-templegold/s/clyh2yrok0005bru09c788sjx, but with different unexpected outcome.
Using a token with callback functions as the bid token in the DaiGoldAuction
contract can lead to reentrancy attacks. At first glance this can not lead to losses because depositors[msg.sender][epochIdCache
] andinfo.totalBidTokenAmount
are accrued, the picture would be different if it was a claim like function or deduction was the operation used, hence I believe the Impact is LOW and likelihood is MEDIUM. Hence the severity is M/L.
Manual Review
Use the Checks-Effects-Interactions (CEI) pattern or/and a reentrancy guard:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.