Chainlink oracle lacks proper validation #307
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#L523-L537
Vulnerability details
Impact
Calls to the Chainlink price oracle via
latestRoundData()
inFraxlendPairCore.sol
use the correct functionlatestRoundData()
per Chainlink's documentation, but lack the recommended validations to ensure that the round is complete and does not return stale data.Per the following Halborn audit, page 19, the recommended implementation is:
Halborn audit, page 19:
https://3405344147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bWsvjSvuHlmjaYdDGxA%2Fuploads%2FxvaQXQq7NxRcRQBiGL3J%2FRolla_Finance_Quant_Protocol_Smart_Contract_Security_Audit_Report.pdf?alt=media&token=1d59da93-2e5c-4e53-9de8-a4bb6dba138e
Tools Used
Audit report.
Recommended Mitigation Steps
Add checks for stale data, incomplete round, and 0 price return value. If any of these fail, then the function should revert.
Final Note
Though the Frax documentation lists "outdated answers" as a known issue, I believe that extra validations can alleviate such issue.
The text was updated successfully, but these errors were encountered: