Lack of slippage and deadline during withdraw and deposit
The withdraw and deposit functions in Renzo's contracts lack slippage and deadline parameters, so users may receive less than expected if oracle prices change or if their transaction is front-run. An attacker could exploit this by manipulating the oracle or front-running to cause a worse rate for the user.
t0x1c Follow with ZanyBonzy, hunter_w3b and 23 others
Originally disclosed on Code4rena
Submitted by t0x1c, also found by ZanyBonzy, hunter_w3b, carlitox477 (1, 2), umarkhatab_465 (1, 2), btk, ladboy233, ilchovski, jokr, Shaheen, PNS, FastChecker, MSaptarshi, atoko, Tigerfrake, Maroutis, honey-k12, 0xDemon, DanielArmstrong, rbserver, NentoR, 0xCiphky, crypticdefense, twcctop, SBSecurity, Ocean_Sky, Rhaydden, and Bauchibred
When users call withdraw() to burn their ezETH and receive redemption amount in return, there is no provision to provide any slippage & deadline params. This is necessary because the withdraw() function uses values from the oracle and the users may get a worse rate than they planned for.
Additionally, the withdraw() function also makes use of calls to calculateTVLs() to fetch the current totalTVL. The calculateTVLs() function makes use of oracle prices too. Note that though there is a MAX_TIME_WINDOW inside these oracle lookup functions, the users are forced to rely on this hardcoded value & can’t provide a deadline from their side. These facts are apart from the consideration that users’ call to withdraw() could very well be unintentionally/intentionally front-run which causes a drop in totalTVL.
In all of these situations, users receive less than they bargained for and, hence, a slippage and deadline parameter is necessary.
Similar issue can be seen inside deposit() and depositETH().
Recommended Mitigation Steps
Allow users to pass a slippage tolerance value and a deadline parameter while calling these functions.
jatinj615 (Renzo) disputed and commented:
Oracle updates the value every 24 hours and technically, it creates an arbitrage opportunity which will not be beneficial to users as they will arbitraging 1 days reward share and losing on 7 days rewards due to
coolDownPeriod.We need the warden to provide a POC of delta around
depositandwithdrawconsidering we will be implementing slashing pricing mechanism at the time of claim specified in #326.
sin1st3r__ (warden) commented:
@alcueca - I believe this should be a QA rather than a Med. You need slippage and deadline when the price can be manipulated like in an AMM. Here, since the price of the exchange is always fair because it can’t be moved by however large user operation, but only by changes in oracle price (that is fair by definition), there is no strong case for the same of level of protection as in AMMs.
Staking on Lido for example doesn’t have slippage or deadline either. See here.
The thing is that Renzo is using market oracles, as stated in #13. These oracles can fluctuate more than the actual exchange rate, due to market forces. In some situations the users might be displeased that their withdrawals rended less value because of a temporary spike in the oracle.
It is quite borderline, because it needs the oracles to have jumps large enough to bother users. However, I do see value to add slippage controls, and let users disable them in volatile conditions when they just want to dump.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the functions rely on oracle prices and total value calculations without allowing users to specify a minimum output or a deadline, leaving them exposed to price changes and front-running.
Impact
Users could receive less than they bargained for due to oracle price fluctuations or front-running, though the judge noted it is borderline because it requires large oracle jumps to bother users.
What the attacker needed
User calls withdraw or deposit; oracle price changes or front-running occurs
The fix
The functions should be fixed by allowing users to pass a slippage tolerance value and a deadline parameter when calling them.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you swap tokens, the price can change between when you send the transaction and when it is processed. Without a slippage setting, you might get fewer tokens than you agreed to. This report says the withdraw and deposit functions do not let users set a minimum acceptable amount or a deadline, so users could lose out.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.