Incorrect exchange rate provided to Balancer pools
LessDupes Follow with Bauchibred
Originally disclosed on Code4rena
Submitted by LessDupes, also found by Bauchibred
The xRenzoDeposit contract, apart from being the entry point for deposits on L2s, also acts as a rate provider for Balancer pools on L2s, allowing them to determine the exchange rate between xezWETH and WETH tokens. Rate providers are crucial for Balancer pools to calculate token prices and determine yield protocol fees during joins and exits, as explained in the Balancer documentation.
However, the getRate() function in xRenzoDeposit does not provide the correct exchange rate. It simply returns the lastPrice state variable, which:
- May be stale if
updatePrice()orupdatePriceByOwner()have not been called recently. - May be older than the rate provided by
oracle.getMintRate(). - Can be different from the rate at which xezETH are minted in
_deposit(), which uses the newest of the oracle and internallastPricevalues, opening up arbitrage opportunities.
Impact
By providing an incorrect and potentially outdated exchange rate, xRenzoDeposit can cause Balancer pools to misprice xezWETH relative to WETH. This can lead to incorrect yield calculations and enable manipulation of pool joins and exits.
Proof of Concept
xRenzoDepositis set as the rate provider betweenxezWETHandWETHfor a Balancer pool.- The price of
ezETHrelative toETHchanges on L1, but the receiver fails andupdatePrice()is not called onxRenzoDeposit. - However, the oracle feed still provides accurate data.
- A user executes an operation on a WETH/xezETH Balancer pool, which calls
getRate()onxRenzoDepositto fetch the price. getRate()returns the stale price from the internallastPricevariable.- The Balancer pool uses this incorrect rate for its calculations, leading to mispricing of
xezWETHand potential manipulation.
Recommended Mitigation Steps
Update the getRate() function to provide the same exchange rate used when minting xezETH. This can be achieved by calling getMintRate() instead of returning lastPrice directly:
- return lastPrice;
+ (uint256 rate, uint256 timestamp) = getMintRate();
+ require(block.timestamp <= timestamp + 1 days, "Price is stale");
+ return rate;
This ensures that the rate provided to Balancer pools is consistent with the actual minting rate and is not stale.
The PR adds staleness check in
getRatefunction forbalancerPoolson L2.
Status: Mitigation confirmed. Full details in reports from 0xCiphky, grearlake, Fassi_Security, LessDupes, and Bauchibred.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity security bug in Renzo. Code4rena made it public on 7 June 2024. Found in the 2024-04-renzo audit contest (finding M-12), also found by 1 other warden.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.