Closed sherlock-admin2 closed 9 months ago
akhoronko
medium
Registry.getRateInUsd
When using Chainlink with L2 chains, smart contracts must check whether the L2 Sequencer is down to avoid stale pricing data
There is no check for down sequencer:
function getRateInUsd(bytes32 oracleSequence) external view returns (uint256 rate) { ... for (uint256 i; i < length; ++i) { if (baseToQuoteAsset[i]) { // @audit rate might be stale rate = rate.mulDivDown(IOracleModule(oracleToOracleModule[oracles[i]]).getRate(oracles[i]), 1e18); } else { // @audit rate might be stale rate = rate.mulDivDown(1e18, IOracleModule(oracleToOracleModule[oracles[i]]).getRate(oracles[i])); } } }
This function is used in Asset Module in getValue to return the USD value of an asset
getValue
If the L2 sequencer goes down, the protocol will allow users to continue to operate at the previous (stale) rates.
https://github.com/sherlock-audit/2023-12-arcadia/blob/main/accounts-v2/src/Registry.sol#L580-L600
Manual Review
Pass creditor asset as parameter and add sequencerNotDown modifier ( https://github.com/sherlock-audit/2023-12-arcadia/blob/main/accounts-v2/src/Registry.sol#L131 ) as it done in other oracle related functions (getValuesInUsd, getTotalValue, etc):
creditor
sequencerNotDown
getValuesInUsd
getTotalValue
function getRateInUsd(address creditor, bytes32 oracleSequence) external view sequencerNotDown(creditor) returns (uint256 rate) { ... }
Duplicate of #105
1 comment(s) were left on this issue during the judging contest.
takarez commented:
invalid
akhoronko
medium
Missing checks for down L2 Sequencer in
Registry.getRateInUsd
functionSummary
When using Chainlink with L2 chains, smart contracts must check whether the L2 Sequencer is down to avoid stale pricing data
Vulnerability Detail
There is no check for down sequencer:
This function is used in Asset Module in
getValue
to return the USD value of an assetImpact
If the L2 sequencer goes down, the protocol will allow users to continue to operate at the previous (stale) rates.
Code Snippet
https://github.com/sherlock-audit/2023-12-arcadia/blob/main/accounts-v2/src/Registry.sol#L580-L600
Tool used
Manual Review
Recommendation
Pass
creditor
asset as parameter and addsequencerNotDown
modifier ( https://github.com/sherlock-audit/2023-12-arcadia/blob/main/accounts-v2/src/Registry.sol#L131 ) as it done in other oracle related functions (getValuesInUsd
,getTotalValue
, etc):Duplicate of #105