Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M-12 MitigationConfirmed #32

Open
c4-bot-3 opened this issue Jun 6, 2024 · 4 comments
Open

M-12 MitigationConfirmed #32

c4-bot-3 opened this issue Jun 6, 2024 · 4 comments
Labels
edited-by-warden mitigation-confirmed MR-M-12 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@c4-bot-3
Copy link
Contributor

c4-bot-3 commented Jun 6, 2024

Lines of code

Vulnerability details

The fix applied by the team fully mitigates M-12, but introduces a new issue.

@alcueca
Copy link

alcueca commented Jun 8, 2024

The mitigation review should include more than just links to the issue and the fix. Not much is needed, but at least a description of both.

@c4-judge
Copy link

c4-judge commented Jun 8, 2024

alcueca marked the issue as unsatisfactory:
Insufficient quality

@c4-judge c4-judge closed this as completed Jun 8, 2024
@c4-judge c4-judge added the unsatisfactory does not satisfy C4 submission criteria; not eligible for awards label Jun 8, 2024
@s1n1st3r01
Copy link

Original vulnerability


The xRenzoDeposit contract acts as a rate provider for Balancer pools on L2s, allowing them to determine the correct exchange rate between xezETH and WETH tokens.

The issue is that the getRate() function is providing an inaccurate exchange rate. It simply returns the lastPrice state variable which can be stale if, for example, updatePrice() has not been called recently. It can also be stale if it's older than the rate provided by the oracle through oracle.getMintRate().

    function getRate() external view override returns (uint256) {
        return lastPrice;
    }

Providing a stale exchange rate can cause the balancer pools to misprice xezETH relative to WETH and therefore enable manipulation of pool joins and exits.

Mitigation Analysis


The mitigation fixes the original issue effectively by relying on the getMintRate() function to provide a correct _lastPrice. The getMintRate() function is responsible for returning the rate used to mint xezETH.

-        (uint256 _lastPrice, ) = getMintRate();
+        (uint256 _lastPrice, uint256 _lastPriceTimestamp) = getMintRate();
+        if (block.timestamp > _lastPriceTimestamp + 1 days) {
+            revert OraclePriceExpired();
+        }

Notes


While the mitigation proposed effectively fixes the original issue (returning of the incorrect exchange) rate, it also introduces a new potential issue discussed in great detail here

@c4-judge c4-judge reopened this Jun 9, 2024
@c4-judge c4-judge added satisfactory satisfies C4 submission criteria; eligible for awards and removed unsatisfactory does not satisfy C4 submission criteria; not eligible for awards labels Jun 9, 2024
@c4-judge
Copy link

c4-judge commented Jun 9, 2024

alcueca marked the issue as satisfactory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
edited-by-warden mitigation-confirmed MR-M-12 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

5 participants