sherlock-audit / 2024-02-optimism-2024-judging

6 stars 4 forks source link

0x007 - DelayedWETH.DELAY_SECONDS could be bypassed by calling resolve a long time after unlocking #109

Closed sherlock-admin4 closed 6 months ago

sherlock-admin4 commented 7 months ago

0x007

medium

DelayedWETH.DELAY_SECONDS could be bypassed by calling resolve a long time after unlocking

Summary

DelayedWETH.DELAY_SECONDS is an airgap that's used to freeze assets incase there's mistake in resolve. But tokens are unlocked before resolve and there's no enforcement in the codebase to resolve immediately after unlock.

Vulnerability Detail

After resolveClaim has been called for all claimIndex, all tokens would be unlocked. However, the game has not resolve unless, resolve is called to change the game status. This could be used to bypass the delay airgap.

PoC

Impact

An attacker could bypass the DELAY_SECONDS and claim ETH for a wrongly resolved game.

Code Snippet

https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/dispute/weth/DelayedWETH.sol#L31 https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/dispute/weth/DelayedWETH.sol#L57 https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol#L704 https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol#L630-L645 https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol#L386-L464

Tool used

Manual Review

Recommendation

You could add the airgap to the dispute game and start counting after resolve has been called and status has been updated. Or you could call resolve when resolveClaim for index zero is called.

nevillehuang commented 6 months ago

Duplicate of #132, invalid, since resolving a game is permisionless, I believe this is not an issue