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

0xmujahid002 - Insufficient checks to confirm the correct status of sequencerUptimeFeed in DebitaChainlink.sol #1

Open
sherlock-admin3 opened this issue Nov 25, 2024 · 0 comments

Comments

@sherlock-admin3
Copy link

sherlock-admin3 commented Nov 25, 2024

0xmujahid002

High

Insufficient checks to confirm the correct status of sequencerUptimeFeed in DebitaChainlink.sol

Summary

The missing check for a 0 value in sequencerUptimeFeed.startedAt will cause inaccurate sequencer status validation for the Debita platform as getThePrice() will pass incorrectly when startedAt is 0 and answer is also 0, failing to validate the sequencer status effectively.

Root Cause

In DebitaChainlink.sol:61, the lack of a startedAt != 0 check in checkSequencer() fails to confirm an updated sequencer status during invalid rounds.

Making sure startedAt isn't 0 is crucial for keeping the system secure and properly informed about the sequencer's status.

Internal pre-conditions

  1. checkSequencer() to be called within getThePrice().
  2. sequencerUptimeFeed to have both answer and startedAt set to 0.

External pre-conditions

  1. experiencing a brief downtime with delayed updates in Chainlink's L2 uptime feed.
  2. Invalid round leading to a startedAt value of 0.

Attack Path

  1. The sequencer feed returns answer == 0 and startedAt == 0 due to invalid round.
  2. checkSequencer() executes without startedAt check, passing verification even though sequencer status is unconfirmed.

Impact

Debita suffers an approximate security vulnerability, as the contract mistakenly assumes sequencer uptime, exposing protocol to outdated or incorrect oracle data.

FYR: Chainlink smartcontractkit/documentation#1995

PoC

A recent pull request to update the chainlink docs

Mitigation

Add a require(startedAt != 0, "Invalid sequencer status"); check in checkSequencer().

DebitaChainlink.sol

DebitaChainlink.sol


function checkSequencer() public view returns (bool) {
    (, int256 answer, uint256 startedAt, , ) = sequencerUptimeFeed.latestRoundData();

    // Check if the sequencer is up
    bool isSequencerUp = answer == 0;
    if (!isSequencerUp) {
        revert SequencerDown();
    }

+   // Ensure that startedAt is valid and non-zero
+   require(startedAt != 0, "Invalid sequencer status");

    // Calculate the time since the sequencer came back up
    uint256 timeSinceUp = block.timestamp - startedAt;
    if (timeSinceUp <= GRACE_PERIOD_TIME) {
        revert GracePeriodNotOver();
    }

    return true;
}
@sherlock-admin3 sherlock-admin3 changed the title Silly Flaxen Goose - Insufficient checks to confirm the correct status of sequencerUptimeFeed in DebitaChainlink.sol 0xmujahid002 - Insufficient checks to confirm the correct status of sequencerUptimeFeed in DebitaChainlink.sol Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant