Chainlink's latestRoundData might return stale price in FraxlendPairCore.sol #244
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
invalid
This doesn't seem right
out of scope
Lines of code
https://github.com/code-423n4/2022-08-frax/blob/c4189a3a98b38c8c962c5ea72f1a322fbc2ae45f/src/contracts/FraxlendPairCore.sol#L524
https://github.com/code-423n4/2022-08-frax/blob/c4189a3a98b38c8c962c5ea72f1a322fbc2ae45f/src/contracts/FraxlendPairCore.sol#L532
Vulnerability details
Proof of Concept
When calling
latestRoundData
the code does check if the price is not less than or equal to zero, but it doesn’t check if the round is incomplete or the price is stale. The issue is for bothoracleMultiply
andoracleDivide
.Impact
The
exchangeRate
is a core part of the protocol and using a stale price can result in the protocol not allowing a liquidator to liquidate a position yet, even though the price is crashing and a borrower is insolvent, which will result in a loss of capital.Recommendation
Change the
latestRoundData
logic to the following (you can use custom errors instead require statements as well):Change the code exactly the same way for the
oracleDivide
latestRoundData()
call.The text was updated successfully, but these errors were encountered: