Critical timing vulnerability in YieldOracle allows manipulation of asset valuations during price updates. Attackers can exploit the price commit delay to generate unlimited profits, potentially draining all protocol assets.
Root Cause
The root cause stems from three main design flaws working in conjunction:
Price Reference Inconsistency:
Deposits use currentPrice
Withdrawals use previousPrice
No price synchronization mechanism
Two-Phase Update Pattern Without Protection:
Update phase sets nextPrice
Commit phase has mandatory delay
No operations lock during transition
Missing Access Controls:
No limits on operation frequency
No checks for rapid deposits/withdrawals
No slippage protection
Contracts & Functions Affected
YieldOracle.sol
contract YieldOracle {
function updatePrice(uint256 price) external onlyOracle
function commitPrice() public
function assetsToShares(uint256 assets) external view returns (uint256)
function sharesToAssets(uint256 shares) external view returns (uint256)
}
InvestToken.sol
contract InvestToken {
function deposit(uint256 assets, address receiver) public returns (uint256)
function withdraw(uint256 assets, address receiver, address owner) public returns (uint256)
function redeem(uint256 shares, address receiver, address owner) public returns (uint256)
}
Vulnerability Details
During code review, I identified a critical vulnerability in the YieldOracle price update mechanism. The core issue lies in how different price references are used for deposits versus withdrawals:
Github username: -- Twitter username: -- Submission hash (on-chain): 0x74c108f64b32998f7c6bcea1958f31b4849a6915fbd0f46a30d9ef23a8cc9bcc Severity: high
Description:
Brief
Critical timing vulnerability in
YieldOracle
allows manipulation of asset valuations during price updates. Attackers can exploit the price commit delay to generate unlimited profits, potentially draining all protocol assets.Root Cause
The root cause stems from three main design flaws working in conjunction:
Price Reference Inconsistency:
currentPrice
previousPrice
Two-Phase Update Pattern Without Protection:
nextPrice
Missing Access Controls:
Contracts & Functions Affected
YieldOracle.sol
InvestToken.sol
Vulnerability Details
During code review, I identified a critical vulnerability in the
YieldOracle
price update mechanism. The core issue lies in how different price references are used for deposits versus withdrawals:This inconsistency is compounded by the two-step price update mechanism:
Attack Vectors
The vulnerability can be exploited through:
Real World Example
Alice (Protocol Manager):
Bob (Attacker):
Impact
Critical severity due to:
Attack Prerequisites
Potential Losses
Proof of Concept
Test Results
Recommendations
Immediate Actions
Short-term Fixes
Long-term Solutions