29744 - [SC - Insight] Projects can pay rewards at up to below market...
Submitted on Apr 1st 2024 at 20:45:03 UTC by @marchev for Boost | Immunefi Arbitration
Report ID: #29744
Report type: Smart Contract
Report severity: Insight
Target: https://github.com/immunefi-team/vaults/blob/main/src/RewardTimelock.sol
Impacts:
Theft of unclaimed royalties
Description
Brief/Intro
Due to a hardcoded setting in the protocol (PRICE_DEVIATION_TOLERANCE_BPS
) allowing for a 1% price deviation of whitehat awards when paid in non-native tokens and the potential 2% deviation for Chainlink's price feeds for some tokens (e.g. ARB, ENS, FXS, etc.), there's a risk that whitehat hackers could be underpaid by up to 2.97%. This issue arises when the actual market price of an asset falls slightly, such as by 1.99%, which doesn't trigger an oracle update. This results in a temporarily inflated asset price reported by the Chainlink price oracle. This combined with the ability to pay a reward with a deviation of 1% could be exploited by projects to underpay whitehats.
Vulnerability Details
The vulnerability centers around the RewardTimelock
smart contract, which handles reward payouts to whitehats during arbitration. Projects specify the dollar value of the award, and after a cooldown period, they can pay in tokens. The smart contract checks if the token amount matches the dollar value, allowing a 1% deviation. However, some tokens have a 2% price deviation in their Chainlink price feeds. If the token's market price drops just below 2%, a project can pay the whitehat less than the full market value, exploiting the gap up to 2.97%:
Furthermore, projects have the capability to exploit the vulnerability even when the price drops more than 2% below the oracle price. They can do this by frontrunning the transaction meant to update the Oracle price feed. This maneuver provides a significant safety margin.
Example:
A project owes a whitehat $100,000, paid in ARB tokens.
After the cooldown, the ARB/USD price by the oracle is $1.60, but the market price is $1.5688.
The project pays 61,785 ARB instead of the 63,742.99 ARB due at market rates.
While the price oracle price deviation cannot be avoided, adjusting the hardcoded PRICE_DEVIATION_TOLERANCE_BPS
to be more flexible and specific to token's price feed could mitigate this issue to a certain extent. This is especially important for feeds that update less frequently as indicated by a 2% deviation and a 86400s heartbeat. It should be noted that all Chainlink price feeds on mainnet with a deviation of 2% have a hearbeat of 86400s which implies they are meant to update less frequently which reduces the need for a favorable price deviation tolerance as high as 1%.
Impact Details
The hardcoded deviation combined with Chainlink's deviation can lead to significant losses for whitehats. This risk is medium, as it depends on specific price feed deviations (2%) and market conditions. The severity is also considered medium due to the financial impact on whitehats. A more adaptable configuration for the reward value deviation could mitigate the issue.
Proof of Concept
To illustrate the vulnerability, I provide a coded PoC which demonstrates its impact. Add the following test case to RewardTimelock.t.sol
:
Run the PoC via the following command:
Last updated