The KeeperProxy contract, which serves as the core price validation mechanism for the Perpetual Vault Protocol, has incomplete validation of Chainlink price feed data. The _check()
function fails to properly validate the returned price data, potentially allowing stale or incorrect prices to be used in critical vault operations.
This directly violates the protocol's core invariant of "Depositor Share Value Preservation" as stated in the documentation: "The value of a depositor's shares should never decrease due to the actions of other depositors. Any losses or gains should be distributed proportionally based on share ownership."
When price feeds return unexpected values, the system may incorrectly value positions, leading to:
Improper position valuations affecting depositor share values
Incorrect execution of leveraged trades
Unfair distribution of funding fees
The vulnerability exists in the _check()
function of KeeperProxy.sol:
The function:
Doesn't validate answeredInRound
vs roundId
Ignores potential negative prices
Uses unsafe casting via toUint256()
Here's a proof of concept test demonstrating the issue:
This is particularly concerning because the protocol documentation states: "After all actions completed, nextAction, swapProgressData should be empty. PositionKey is 0 when no position". Invalid prices could lead to incomplete actions or incorrect position keys.
Manual Review
Foundry
Update the _check()
function to include comprehensive price feed validation:
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.