codehawks-2023-07-dsc-m01
[M-01] staleCheckLatestRoundData() does not check the status of the Arbitrum sequencer in Chainlink feeds
Summary
프로토콜이 L2 체인에서 운영된다면 시퀀서 이슈가 발생할 수 있다. 시퀀서가 중단되면 프로토콜은 오래된 가격 정보를 기반으로 운영될 수 있다.
Keyword
l2, sequencer, chainlink price oracle, chainlink sequencer feed
Vulnerability
이 프로토콜은 어느 EVM 체인이든 배포될 수 있으며(타겟 체인이 따로 제한된 것이 아니며) Chainlink를 이용한다.
만약 아비트럼같은 L2 체인을 이용한다면 일반적으로 시퀀서의 상태를 확인할 필요가 있다. 시퀀서가 중단된 경우 가격 오라클 데이터가 오랫동안 업데이트 되지 않을 수 있다.
staleCheckLatestRoundData 함수에서 오래된 가격인지 여부를 확인하지만, 시퀀서가 활성화되어 있는지 여부는 확인하지 않는다. 이 역시 Chainlink의 L2 시퀀서 피드를 이용해 확인할 수 있다.
Impact
시퀀서가 중단되면 프로토콜은 오래된 가격 정보를 기반으로 운영된다.
Mitigation
Chainlink의 L2 시퀀서 피드를 이용해 시퀀서가 최근까지 살아있었는지 확인한다.
function isSequencerAlive() internal view returns (bool) {
(, int256 answer, uint256 startedAt,,) = sequencer.latestRoundData();
if (block.timestamp - startedAt <= GRACE_PERIOD_TIME || answer == 1)
return false;
return true;
}
function staleCheckLatestRoundData(AggregatorV3Interface priceFeed)
public
view
returns (uint80, int256, uint256, uint256, uint80)
{
require(isSequencerAlive(), "Sequencer is down");
....//remaining parts of the functiontags: bughunting, codehawks, smart contract, solidity, chainlink, l2, l2 sequencer down, arbitrum chain, severity medium