The update_price
function does not validate the _ts
parameter (timestamp) against the current block timestamp. This means that outdated or future timestamps can be used to update the price, which could lead to incorrect price calculations. Specifically:
Outdated timestamps: Using a timestamp from the past could result in stale price data.
Future timestamps: Using a timestamp from the future could manipulate the price in an unrealistic way.
This lack of validation undermines the reliability of the oracle and opens the door to potential manipulation.
The current block timestamp is 1000
.
The current price of scrvUSD
is 1.0
(normalized to 10**18
).
Bob is a malicious actor with the PRICE_PARAMETERS_VERIFIER
role.
Alice is a liquidity provider who relies on the oracle for accurate price data.
Bob calls the update_price
function with the following parameters:
_parameters
: Valid price parameters.
_ts
: 2000
(a timestamp in the future).
_block_number
: The current block number.
The function does not validate the _ts
parameter, so it accepts the future timestamp.
The update_price
function calculates the new price based on the future timestamp (_ts = 2000
).
Since the future timestamp is used, the price calculation assumes that the system has progressed to that point in time, leading to an artificially inflated or deflated price.
For example, if the price is expected to increase over time, the future timestamp could result in a much higher price than the current market price.
Bob uses the manipulated price to his advantage:
If the price is artificially inflated, Bob could sell his scrvUSD
holdings at the inflated price, making a profit.
If the price is artificially deflated, Bob could buy scrvUSD
at the deflated price, again making a profit.
Bob’s actions are at the expense of other users, including Alice.
Alice, as a liquidity provider, relies on the oracle for accurate price data.
Due to the manipulated price, Alice’s holdings are incorrectly valued:
If the price is inflated, Alice may overvalue her holdings and make poor financial decisions.
If the price is deflated, Alice may undervalue her holdings and suffer losses when trading or withdrawing funds.
Incorrect timestamps could result in stale or manipulated price data, undermining the oracle's reliability.
Manual Code Revieqw
To fix this issue, the update_price
function should validate the _ts
parameter to ensure it is within a reasonable range relative to the current block timestamp. For example:
Prevent Future Timestamps: Ensure that _ts
is not greater than the current block timestamp.
Prevent Outdated Timestamps: Ensure that _ts
is not too far in the past (e.g., within a few blocks or a predefined time window).
I believe this to be at best informational severity as - The moment sequencer is up again, the price updates that retrieve storage values from mainnet will be pushed. To note, price updates are retrieved from storage proofs are retrieved from Ethereum scrvUSD contract, so the concept of the next updated price being outdated is not possible, given mainnet does not utilize sequencers. - There are no problems with small lags if used in liquidity pools due to fees. Fees generate spread within which price can be lagged. - All price updates are subjected to smoothing, and as you can see from the historical price movements as seen [here](https://coinmarketcap.com/currencies/savings-crvusd/), there is never a large discrepancy in prices (absolute terms), and even more unlikely given sequencer downtimes will unlikely be long. This small price changes can be safely arbitrage aligning with [protocol design](https://github.com/CodeHawks-Contests/2025-03-curve?tab=readme-ov-file#parameters) , along with the above mentioned fees - Combined with the above, the max price increments can be temporarily increased to more effectively match the most updated price.
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.