Oracle can manipulate asset prices by exploiting the update sequence, bypassing price increase limits and affecting share/asset conversions in the InvestToken vault. #123
Labels
invalid
This doesn't seem right
Github username: @emerald7017
Twitter username: --
Submission hash (on-chain): 0x4a661b58c235109a0e066a6fa4b126b19eb1d4f250de047df462dc8f88c7cf1d
Severity: high
Description:
Summary
The YieldOracle contract has a vulnerability in its price update mechanism that allows the oracle to manipulate asset prices by overriding pending updates before they are committed. This can lead to incorrect asset valuations and financial loss for users interacting with the system.
Finding Description
The issue lies in YieldOracle's two-step price update process. The contract allows the oracle to set a new price without ensuring that the previous price update has been committed. This lack of validation enables the oracle to rapidly update prices, bypassing the intended sequence and potentially manipulating asset valuations. This breaks the security guarantee of accurate and sequential price updates, which is crucial for maintaining fair asset valuations in the InvestToken contract. A malicious oracle can exploit this by setting a favorable price before users interact with the system, leading to incorrect share calculations during deposits or withdrawals.
nextPrice
nextPrice
Referenced code paths: YieldOracle.sol#L69-L85
InvestToken.sol.L212-L213
Impact Explanation
The impact is critical because it directly affects the financial integrity of the system "Affects all ERC4626 operations in InvestToken". By manipulating prices, the oracle can cause users to receive incorrect amounts of shares or assets, leading to potential financial losses. This undermines trust in the system's ability to provide fair and accurate asset valuations, which is a core requirement for any financial protocol.
Likelihood Explanation
The likelihood of this occurring is high if the oracle is controlled by a malicious actor or if there is insufficient oversight on the oracle's actions. Since the oracle has the authority to update prices, any compromise or malicious intent can lead to exploitation of this vulnerability.
Attack Scenario
Proof of Concept
This test shows how the oracle can manipulate prices by:
The impact is visible through:
This proves that the vulnerability affects both the price oracle's integrity and the ERC4626 vault's core functionality.
The Logs Shows:
The attack shows how a malicious oracle can manipulate prices to affect user deposits:
Traces
The exploit breaks two key security guarantees:
Price Integrity: The YieldOracle allows rapid price updates that can be manipulated by the oracle operator. While there is a
maxPriceIncrease
limit (0.5e18 or 50%), the oracle can chain multiple updates within the allowed range to achieve larger price movements.Share Value Stability: The InvestToken's ERC4626 implementation relies on the oracle price for share/asset conversions. When the price is manipulated:
convertToShares()
uses the highercurrentPrice
, giving fewer shares for depositsconvertToAssets()
uses the lowerpreviousPrice
for calculating asset valueThe attack propagates through these steps:
Oracle sets initial fair price (1.0)
Alice deposits at fair price (100 USDE → 100 shares)
Oracle executes manipulation:
Bob deposits at manipulated price (100 USDE → 66.67 shares)
The vulnerability is in YieldOracle.sol's
updatePrice()
function, which allows sequential price updates as long as each step is withinmaxPriceIncrease
. This can be exploited by a malicious oracle to create significant price movements that affect the share/asset conversion rates in InvestToken.sol.The test demonstrates this by showing how Bob receives 33% fewer shares than Alice for the same USDE deposit, and his shares are immediately worth 20% less due to the price manipulation.
Recommendation (Optional)
Enforce a check to ensure that the previous price update is committed before allowing a new update. Additionally, validate price bounds before making state changes to prevent bypassing limits.
Additional recommendations include implementing a price deviation circuit breaker, adding a minimum update interval, and including an emergency pause mechanism to enhance the system's resilience against manipulation.
The text was updated successfully, but these errors were encountered: