Closed code423n4 closed 1 year ago
JustDravee marked the issue as duplicate of #59
JustDravee changed the severity to QA (Quality Assurance)
This previously downgraded issue has been upgraded by JustDravee
JustDravee marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2023-03-polynomial/blob/aeecafc8aaceab1ebeb94117459946032ccdff1e/src/Exchange.sol#L155-L170 https://github.com/code-423n4/2023-03-polynomial/blob/aeecafc8aaceab1ebeb94117459946032ccdff1e/src/Exchange.sol#L186-L190 https://github.com/code-423n4/2023-03-polynomial/blob/aeecafc8aaceab1ebeb94117459946032ccdff1e/src/Exchange.sol#L409-L410 https://github.com/code-423n4/2023-03-polynomial/blob/aeecafc8aaceab1ebeb94117459946032ccdff1e/src/KangarooVault.sol#L436-L437 https://github.com/code-423n4/2023-03-polynomial/blob/aeecafc8aaceab1ebeb94117459946032ccdff1e/src/KangarooVault.sol#L568
Vulnerability details
Impact
The price returned from pool or market could be invalid, maybe due to stale or malfunction of oracles. However, the checks for validity of price feed is not consistent across the contracts. The outdated/stale/invalid price data could lead to inaccurate price feed for index price, mark price and funding rate, and further influence the operation of the whole protocol.
Proof of Concept
In
getIndexPrice()
,getFundingRate()
andgetMarkPrice()
,isInvalid
is assigned be not checked.In
KangarooVault.sol
, the call togetMarkPrice()
miss validity checks for the following:In many other places across the contracts, the price validity is checked, but the above places just miss the checks.
Tools Used
Manual analysis.
Recommended Mitigation Steps
Add
require(!isInvalid)
in the above places to check the price validity. Just like other price queries in the contracts.