31563 - [SC - Low] Oracle days staleThreshold for priceTimestamp ...
Submitted on May 21st 2024 at 11:15:40 UTC by @SAAJ for Boost | Alchemix
Report ID: #31563
Report type: Smart Contract
Report severity: Low
Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/RewardsDistributor.sol
Impacts:
Protocol insolvency
Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
Brief/Intro
60 days is more than enough for threshold on oracle time updated causes stale price to be accepted
Vulnerability Details
The RewardsDistributor
contract have amountToCompound
function makes call to Chainlink oracle receiving the update price. However, staleThreshold
variable define the priceTimestamp
to be checked every 60 days
which is way more than enough to validate price of any token.
In a high volatile market like predicted for this year the token price greatly fluctuates causing the threshold to have price that are stale. This will impact old prices to be accepted based on the staleThreshold
define for the timelimit.
According to chainlink docs for using price feed the oracle priceTimestamp
is based on heartbeat
which defaults to threshold of 86400
or 1 day
.
The other factor consider for threshold according to each token is deviation from price which is set to 2%
for Alchemix
.
Impact Details
amountToCompound
function is called in claim
method at L#175 where passing alcxAmount
will give value in weth
. Value of weth
is highly dependent on ETH
which is very volatile will result in either depositing amount greater or less than alcxAmount
.
Having a longer point in time till which the oracle price is accepted, will cause to include transactions when prices have completely changed due to market conditions.
Stale prices of asset will be accepted as the current price, causing wrong/stale prices be fetched as if they were the latest causing loss to either protocol or the claimer.
References
https://github.com/alchemix-finance/alchemix-v2-dao/blob/f1007439ad3a32e412468c4c42f62f676822dc1f/src/RewardsDistributor.sol#L123
Proof of Concept
The RewardsDistributor
contract have amountToCompound
function makes call to Chainlink oracle receiving the update price. The staleThreshold
impact is clearly to give out stale price which is accepted and deposited in the claim
function.
Last updated