Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

ecexit - eccentricexit - Updates to Inflation Multiplier on L2 can undone by anyone via OOG + replay. #159

Closed
sherlock-admin opened this issue May 25, 2023 · 5 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Escalation Resolved This issue's escalations have been approved/rejected High A valid High severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented May 25, 2023

ecexit

high

eccentricexit - Updates to Inflation Multiplier on L2 can undone by anyone via OOG + replay.

Summary

The protocol governs governs the inflation multiplier on the L2EcoBridge contract via an L1 to L2 message. An adversary can craft a transaction with just enough gas so that when it reaches the L2 it runs out of gas at the proper moment. Then, when favorable, they can replay this message to update the inflation multiplier to an old value.

Vulnerability Detail

The behavior is as following:

  1. The adversary (Alice) calls L1ECOBridge.rebase(). This initiates an L1 to L2 message that will write the current inflationMultiplier to L2EcoBridge.inflationMultiplier. She passes a large enough _l2Gas to the call such that it enters L2ECOBridge.rebase function, but small enough that it reverts there due to Out Of Gas (OOG) error:
    function rebase(uint256 _inflationMultiplier)
        external
        virtual
        onlyFromCrossDomainAccount(l1TokenBridge)
        validRebaseMultiplier(_inflationMultiplier)
    {
        inflationMultiplier = _inflationMultiplier; // revert due to OOG in this scope;
        l2Eco.rebase(_inflationMultiplier);
        emit RebaseInitiated(_inflationMultiplier);
    }

L2ECOBridge.rebase

  1. The call then returns to L2CrossDomainMessenger.relayMessage and it marks that transaction (tx1) as failed:
        ...
        bool success = SafeCall.call(_target, gasleft() - RELAY_RESERVED_GAS, _value, _message);
        xDomainMsgSender = Constants.DEFAULT_L2_SENDER;

        if (success) {
            successfulMessages[versionedHash] = true;
            emit RelayedMessage(versionedHash);
        } else {
            failedMessages[versionedHash] = true; // Tx marked as replayable.
            ...
        }
        ...
  1. Things continue operating normally. Inflation multiplier is updated L1 ECO token 1 or N times, people call L1ECOBridge.rebase with enough gas, keeping the L2 up to date.

  2. Alice doesn't like the current inflation multiplier so she sends a transaction to L2CrossDomainMessenger.relayMessage to replay her old tx1 transaction. This time, she provides enough gas such that the execution completes, reverting the inflation multiplier to the old value.

Impact

An adversary can effectively DoS updates to the inflation multiplier indefinitely and benefit from the broken, inconsistent state.

Code Snippet

Tool used

Manual Review

Recommendation

Disallow in the contract passing a too low l2Gas to L1ECOBridge.rebase.

Duplicate of #142

@github-actions github-actions bot added High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels May 29, 2023
@sherlock-admin sherlock-admin added Non-Reward This issue will not receive a payout and removed High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Jun 5, 2023
@eccentricexit
Copy link

Escalate for 10 USDC

This is not the same issue reported on number #52, but it is a duplicate of the already recognized issue #142 so it should receive a reward.

@sherlock-admin
Copy link
Contributor Author

Escalate for 10 USDC

This is not the same issue reported on number #52, but it is a duplicate of the already recognized issue #142 so it should receive a reward.

You've created a valid escalation for 10 USDC!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

@sherlock-admin sherlock-admin added the Escalated This issue contains a pending escalation label Jun 7, 2023
@nknavkal nknavkal added the Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label label Jun 7, 2023
@nknavkal
Copy link

nknavkal commented Jun 7, 2023

This issue is a duplicate of #142

@hrishibhat
Copy link

Escalation accepted

Valid duplicate of #142

@sherlock-admin sherlock-admin removed the Escalated This issue contains a pending escalation label Jun 8, 2023
@sherlock-admin
Copy link
Contributor Author

Escalation accepted

Valid duplicate of #142

This issue's escalations have been accepted!

Contestants' payouts and scores will be updated according to the changes made on this issue.

@sherlock-admin sherlock-admin added the Escalation Resolved This issue's escalations have been approved/rejected label Jun 8, 2023
@hrishibhat hrishibhat added High A valid High severity issue and removed Non-Reward This issue will not receive a payout labels Jun 9, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Jun 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Escalation Resolved This issue's escalations have been approved/rejected High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

4 participants