Description: The getMarkPrice function lacks validation checks for the indexPrice parameter, which could lead to incorrect calculations and unintended behavior by allowing zero or very low values.
Code:
Proof of concept
To demonstrate the absence of input validation, consider the following steps:
Deployment and Initialization:
Deploy PerpMarketBranch.
Initialize a market with marketId set to a non-zero value.
Attack Vector:
Call getMarkPrice with indexPrice set to zero. Example:
Expected Behavior:
Return an accurate mark price reflecting the market situation.
Actual Behavior:
Returns an incorrect mark price, potentially misleading market participants.
Medium.
Incorrect mark price calculations can undermine market integrity and affect participant decisions.
Manual code review
Suggested Remediation: Implement a check to ensure indexPrice is greater than zero:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.