DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Valid

Incorrect Price Validation

Summary

The contract KeeperProxy has a vulnerability in the _validatePrice function where it incorrectly validates the price of the longToken using the indexTokenPrice instead of the longTokenPrice.

Vulnerability Details

In the _validatePrice function, the contract performs price validation for various tokens. However, it incorrectly uses the indexTokenPrice for validating the longToken:

_check(marketData.longToken, prices.indexTokenPrice.min);
_check(marketData.longToken, prices.indexTokenPrice.max);

This is incorrect because the longToken should be validated using its own price, longTokenPrice, rather than the indexTokenPrice. Although currently, the longToken and indexToken are the same, this might not be the case in the future, leading to incorrect price validation.

Impact

If the longToken and indexToken become different in the future, the contract will validate the longToken using the wrong price. This can lead to incorrect execution of keeper functions, potentially causing financial losses or incorrect operations within the PerpetualVault.

Tools Used

Manual Review

Recommendations

Update the _validatePrice function to use the correct price for the longToken:

_check(marketData.longToken, prices.longTokenPrice.min);
_check(marketData.longToken, prices.longTokenPrice.max);

This ensures that the longToken is validated using its own price, preventing potential issues if the longToken and indexToken become different in the future.

Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding_validatePrice_no_check_for_longTokenPrice

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.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!