Platform: Code4rena
Start Date: 06/01/2022
Pot Size: $60,000 USDC
Total HM: 20
Participants: 33
Period: 7 days
Judge: LSDan
Total Solo HM: 9
Id: 67
League: ETH
Rank: 29/33
Findings: 2
Award: $90.06
🌟 Selected for report: 0
🚀 Solo Findings: 0
90.0579 USDC - $90.06
ye0lde
Since the code does not use a minimum return value for swaps it is susceptible to sandwich attacks. More information here: https://cmichel.io/de-fi-sandwich-attacks/
Here the code Calls Curve to convert the existing underlying balance into UST
:
https://github.com/code-423n4/2022-01-sandclock/blob/a90ad3824955327597be00bb0bd183a9c228a4fb/sandclock/contracts/strategy/NonUSTStrategy.sol#L71-L85
/** * Calls Curve to convert the existing underlying balance into UST */ function _swapUnderlyingToUst() internal { uint256 underlyingBalance = _getUnderlyingBalance(); if (underlyingBalance > 0) { // slither-disable-next-line unused-return curvePool.exchange_underlying( underlyingI, ustI, underlyingBalance, 0 ); } }
It does not specify the minimum amount of UST to receive at line 82.
A similar problem occurs here: https://github.com/code-423n4/2022-01-sandclock/blob/a90ad3824955327597be00bb0bd183a9c228a4fb/sandclock/contracts/strategy/NonUSTStrategy.sol#L94
Visual Studio Code, Remix
Add minimum return amount checks.
#0 - naps62
2022-01-18T13:19:31Z
duplicate of #7