The KeeperProxy contract contains hardcoded assumptions about token and price feed decimals that could lead to incorrect price validations. This issue affects price comparison logic and could potentially allow invalid transactions with incorrect pricing or block valid transactions.
The issue is located in the _check function in KeeperProxy.sol (lines 208-209):
The code makes two specific assumptions:
Chainlink price feeds always have 8 decimals (as noted in the comment)
The total normalization calculation assumes token decimals are less than 30
While these assumptions might be valid for many current assets, there's no guarantee they will hold for all tokens that might be added to the system in the future. If a token with different decimal places or a price feed with non-standard decimals is used, the validation could produce incorrect results.
Additionally, there's no handle for potential errors when calling the external decimals() function on the token contract.
Incorrect decimal handling could lead to:
Allowing transactions to proceed with incorrect price validation, potentially enabling trades at unfavorable prices
Blocking legitimate transactions that should pass validation
Integer underflow if a token with more than the expected decimals is used
System malfunction if a price feed with non-standard decimals is integrated
This could impact the reliability of the price validation system, which is a critical security component of the perpetual vault system.
Manual code review
Query the decimals directly from the Chainlink price feed instead of assuming it's always 8:
Add validation for token and price feed decimals to ensure they are within expected ranges before performing calculations.
Document the expected decimal ranges for both tokens and price feeds that can be safely used with the system.
Consider adding configuration options to manually set decimals for special cases if necessary.
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.
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
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.