Closed c4-submissions closed 11 months ago
bytes032 marked the issue as insufficient quality report
OOS
https://badger.com/images/uploads/ebtc-security-review-spearbit.pdf
5.3.16 PriceFeed is not considering that the "Trigger parameters" of the Chainlink oracle could change
jhsagd76 marked the issue as unsatisfactory: Out of scope
Lines of code
https://github.com/code-423n4/2023-10-badger/blob/f2f2e2cf9965a1020661d179af46cb49e993cb7e/packages/contracts/contracts/PriceFeed.sol#L32-L33
Vulnerability details
Impact
PriceFeed.TIMEOUT_ETH_BTC_FEED
andPriceFeed.TIMEOUT_STETH_ETH_FEED
are used as:If those two constants are set too large, the system will detect Chainlink not working later than expect, which might cause the system uses stale price.
Proof of Concept
Quoting the code
Then I checked the aggregators for ETH_BTC_CL_FEED and STETH_ETH_CL_FEED.According etherscan's dashboard, Transmit method tx is used to update the price. So I download the Transmit type of tx from etherscan as csv file(for ETH_BTC, I download 03/01/2023 ~ 10/01/2023 because of 5000 records limit, and for STETH_ETH, I download all the data), and then and with the help of following python script, The MAX TIME GAP for TIMEOUT_ETH_BTC_FEED should be less than 3 mins, and The MAX TIME GAP for TIMEOUT_STETH_ETH_FEED should be less than 5 mins
So
TIMEOUT_ETH_BTC_FEED = 4800
andTIMEOUT_STETH_ETH_FEED = 90000
are too largeTools Used
VIM
Recommended Mitigation Steps
change
PriceFeed.TIMEOUT_ETH_BTC_FEED
andPriceFeed.TIMEOUT_STETH_ETH_FEED
to a smaller valueAssessed type
Other