code-423n4 / 2024-05-arbitrum-foundation-validation

0 stars 0 forks source link

If both validator's and challenger's assertion is not honest, the wrong assertion can be confirmed with a winner getting back the bond #347

Open c4-bot-6 opened 6 months ago

c4-bot-6 commented 6 months ago

Lines of code

https://github.com/code-423n4/2024-05-arbitrum-foundation/blob/6f861c85b281a29f04daacfe17a2099d7dad5f8f/src/rollup/RollupUserLogic.sol#L210-L218

Vulnerability details

Impact

Two wrong assertions can create an incorrect assertion and one will still retain its bond.

Proof of Concept

When an assertion has a rival, the rival's stake will be deposited into the loserStakeEscrow.

if (!getAssertionStorage(newAssertionHash).isFirstChild) {
            // We assume assertion.beforeStateData is valid here as it will be validated in createNewAssertion
            // only 1 of the children can be confirmed and get their stake refunded
            // so we send the other children's stake to the loserStakeEscrow
            // NOTE: if the losing staker have staked more than requiredStake, the excess stake will be stuck
            IERC20(stakeToken).safeTransfer(loserStakeEscrow, assertion.beforeStateData.configData.requiredStake);
        }

Let's say there are two assertion. The first assertion, 0xabc, is made by a dishonest validator. The next assertion, 0xdef, is made by a dishonest challenger. The dispute game is played, and eventually one of them ends up as the winner. The loser will still lose his bond but the winner does not lose his stake.

By right, if there are two dishonest assertions, and they both lose, both bonds should be confiscated.

Tools Used

Manual Review

Recommended Mitigation Steps

Make sure that the dishonest validator is also punished when creating an invalid stake with a dishonest challenger.

Assessed type

Token-Transfer

cryptostaker2 commented 5 months ago

Hi,

Validator 3 mentions: There will always be an honest winner.

It's true that if both validator and challenger is dishonest, the fastConfirmer can create a new assertion and frontrun the dishonest validator.

The dishonest validator can still get their bond back because it is not in the loser escrow.

Instead, if both validator and challenger is dishonest, both should lose their bonds.

Thanks for reviewing again!

Picodes commented 5 months ago

@cryptostaker2 from the contest's readme: The resolution of challenges that do not involve honest claims are out of scope unless they lead to incorrect assertions being confirmed