The KeeperProxy contract is designed to act as a proxy for executing keeper functions on a PerpetualVault. It includes a price validation mechanism to ensure that market prices are within acceptable bounds before executing actions. However, a logical error exists in the _validatePrice function where the price validation for the longToken incorrectly uses the indexTokenPrice instead of the longTokenPrice. This issue could lead to incorrect price validation, potentially allowing transactions to execute at invalid prices, thereby increasing the risk of financial loss or manipulation.
The vulnerability is located in the _validatePrice function of the KeeperProxy contract:
The _check function is called twice for marketData.longToken, but it incorrectly uses prices.indexTokenPrice.min and prices.indexTokenPrice.max as the price parameters. This is a logical error because the longToken price should be validated against prices.longTokenPrice.min and prices.longTokenPrice.max.
Incorrect Price Validation:
The longToken price is compared against the indexTokenPrice, which may have no correlation with the longToken price. This could result in invalid price validation, allowing transactions to proceed even when the longToken price is outside the acceptable range.
Increased Risk of Financial Loss:
If the indexTokenPrice and longTokenPrice differ significantly, transactions could be executed at unfavorable prices, leading to financial losses for users or the protocol.
Potential for Manipulation:
An attacker could exploit this vulnerability by manipulating the indexTokenPrice to bypass the price validation for the longToken, potentially executing malicious transactions.
The impact is Medium, the likelihood is Medium, so the severity is Medium.
Manual Review
Consider following fix:
Likelihood: None/Very Low, everytime the keeper send a price via run/runNextAction (sent by the Gamma keeper). Impact: Medium/High, does not check the longTokenPrice, it could go out of range. Keep in mind indexToken == longToken, an error from the keeper could be considered informational.
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.