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-02 MitigationConfirmed #30

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

M-02 MitigationConfirmed #30

c4-bot-8 opened this issue Jun 6, 2024 · 4 comments
Labels
mitigation-confirmed MR-M-02 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@c4-bot-8
Copy link
Contributor

c4-bot-8 commented Jun 6, 2024

Lines of code

Vulnerability details

The fix applied by the team fully mitigates M-02.

@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 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
@c4-judge
Copy link

c4-judge commented Jun 8, 2024

alcueca marked the issue as unsatisfactory:
Insufficient quality

@s1n1st3r01
Copy link

Original vulnerability


The WithdrawQueue contract inherits PausableUpgrade to provide the ability for an admin to pause users' withdrawals and claims. It also provides access to the internal functions _pause() and _unpaise() through permissioned external functions (pause() and unpause()).

// @POC: WithdrawQueue inherits PausableUpgradeable
contract WithdrawQueue is
    Initializable,
    PausableUpgradeable,
    ReentrancyGuardUpgradeable,
    WithdrawQueueStorageV1
{
    // ...

    function pause() external onlyWithdrawQueueAdmin {
        _pause();
    }

    function unpause() external onlyWithdrawQueueAdmin {
        _unpause();
    }

    // ...
}

The issue is that the user-accessible claim() and withdraw() functions in the same contract do not implement the whenNotPaused modifier, resulting in these functions being unpausable by administrators when they want to do so.

contract WithdrawQueue is
    Initializable,
    PausableUpgradeable,
    ReentrancyGuardUpgradeable,
    WithdrawQueueStorageV1
{
    // ...

    function withdraw(uint256 _amount, address _assetOut) external nonReentrant {
        // ...
    }

    function claim(uint256 withdrawRequestIndex) external nonReentrant {
        // ...
    }
}

Mitigation analysis


The mitigation successfully fixes this issue by introducing the whenNotPaused modifier to both functions: WithdrawQueue::claim() and WithdrawQueue::withdraw().

-    function withdraw(uint256 _amount, address _assetOut) external nonReentrant {
+    function withdraw(uint256 _amount, address _assetOut) external nonReentrant whenNotPaused {

-    function claim(uint256 withdrawRequestIndex) external nonReentrant {
+    function claim(uint256 withdrawRequestIndex) external nonReentrant whenNotPaused {

This mitigation ensures that mean admins decide to pause these functionalities, they'll be able to do so by calling the permissioned function WithdrawQueue::pause().

@c4-judge
Copy link

c4-judge commented Jun 9, 2024

alcueca marked the issue as satisfactory

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mitigation-confirmed MR-M-02 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

4 participants