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

6 stars 4 forks source link

FastTiger - The `FaultDisputeGame.sol#step()` function is vulnerable to Front-running Attack. #111

Closed sherlock-admin3 closed 6 months ago

sherlock-admin3 commented 7 months ago

FastTiger

medium

The FaultDisputeGame.sol#step() function is vulnerable to Front-running Attack.

Summary

Due to weak access control in the FaultDisputeGame.sol#step() function, an attacker can steal all bonds from honest challengers that call step() function at MAX_DEPTH.

Vulnerability Detail

At the max depth of the game, claims represent commitments to the state of the fault proof VM at a single instruction step interval. Because the game can no longer bisect further, when the honest challenger counters these claims, the only option for an honest challenger is to execute a VM step on-chain to disprove the claim at MAX_GAME_DEPTH. If the counteredBy of the claim being countered is non-zero, the claim has already been countered and the honest challenger does not perform any action.

Otherwise, similar to the above section, the honest challenger will issue an attack step when in response to such claims with invalid ClaimHash commitments. Otherwise, it issues a defense step. At this time, the bonds are distributed to the honest challenger. However, Anyone can call the step() function. Therefore, if an attacker finds an honest challenger's step() function in the mempool, he can front run it with the same parameters. Afterwards, when the resolveClaim() function is called, the bond is distributed to the attacker. As a result, an attacker can steal all bonds from honest challengers that call step() function at MAX_DEPTH.

Impact

an attacker can steal all bonds from honest challengers that call step() function at MAX_DEPTH.

Code Snippet

https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol#L142

Tool used

Manual Review

Recommendation

It is recommended that the step() function be called only by honest challengers who participated in the game.

Duplicate of #97

FastTiger777 commented 6 months ago

Escalate I think the attacker can front run about challenge of the honest player.

sherlock-admin2 commented 6 months ago

Escalate I think the attacker can front run about challenge of the honest player.

The escalation could not be created because you are not exceeding the escalation threshold.

You can view the required number of additional valid issues/judging contest payouts in your Profile page, in the Sherlock webapp.

nevillehuang commented 6 months ago

I believe this is a design, the faster challenger should be the one receiving the bonds. Bond are there to do just this, to incentivize quickness of challenging dishonest claims as noted in my comment here.