Platform: Code4rena
Start Date: 30/10/2021
Pot Size: $35,000 ETH
Total HM: 2
Participants: 16
Period: 3 days
Judge: alcueca
Total Solo HM: 1
Id: 48
League: ETH
Rank: 4/16
Findings: 2
Award: $4,064.26
🌟 Selected for report: 3
🚀 Solo Findings: 0
🌟 Selected for report: cmichel
1994.4252 USDC - $1,994.43
cmichel
Some tokens (like USDT L199) do not work when changing the allowance from an existing non-zero allowance value. They must first be approved by zero and then the actual allowance must be approved.
IERC20(token).safeApprove(address(operator), 0); IERC20(token).safeApprove(address(operator), amount);
This leads to an issue in LibERC20Token.approveIfBelow
's safeIncreaseAllowance
call which does not safeApprove(0)
first.
When using one of these unsupported tokens, all transactions revert and the protocol cannot be used.
Safeapprove with a zero amount first before setting the actual amount. Or just approve the max amount once for each token to circumvent this issue and save gas.
🌟 Selected for report: cmichel
1994.4252 USDC - $1,994.43
cmichel
This is probably what is meant by:
"
rescueTokens
andrescueTokensFromExecutioner
can be gamed however it is not a concern. They are in place "just in case" and should not be used in the first place."
However, this approach does not even call rescueTokens
and rescueTokensFromExecutioner
, so I thought I'd mention it just in case.
There are several ways how tokens can end up in the Executioner
:
tradeAll
which will leave dustThese left-over tokens can be stolen by a backrunner that does not provide tokens themselves (fromAmount = 0
) but still trades these tokens using the encodedCalldata
and receives the swap output.
Tokens that end up in the contract after a series of misconfigured trades can be stolen by anyone.
This is rather cumbersome to completely prevent with the current opaque encodedCalldata
and not knowing which tokens are touched.
#0 - tommyz7
2021-11-04T17:17:55Z
This is true, however, as stated in the contest readme, it's not a concern.
🌟 Selected for report: cmichel
75.3985 USDC - $75.40
cmichel
Instead of using block.timestamp
for a deadline like in swap
, consider using a constant in the future instead, like 1e10
.