StabilityPool contract's fixed 1:1 exchange rate between DEToken
and RToken
creates an arbitrage opportunity where users can receive disproportionate amounts of DETokens during deposits. The fixed exchange rate of 1e18
in StabilityPool.sol doesn't account for potential supply/demand imbalances: StabilityPool.sol#getExchangeRate
This fails to account for the actual ratio between DEToken supply and RToken reserves.
This breaks the deposit/withdrawal parity in the Stability Pool. An attacker could:
Deposit when exchange rate is favorable
Receive more DETokens than intended
Withdraw later for a profit
The StabilityPool implements a simplified exchange rate mechanism that doesn't reflect the true ratio between DEToken
supply and RToken
reserves. This creates arbitrage opportunities during supply/demand imbalances.
The vulnerability flows through calculateDeCRVUSDAmount() which uses the fixed exchange rate. This function should be calculating amounts based on current pool reserves and total DEToken
supply to maintain economic alignment.
Imagine a bank that always exchanges foreign currency at yesterday's rate, regardless of market changes. That's exactly what's happening in the StabilityPool contract. The fixed exchange rate mechanism creates a predictable arbitrage opportunity that savvy users can exploit.
When users deposit RTokens into the StabilityPool, they receive DETokens based on a static 1:1 exchange rate. This seemingly simple approach ignores the fundamental principle of supply and demand. The real danger emerges during market stress scenarios when the pool's RToken
reserves don't match the DEToken
supply.
Let's walk through a real exploit scenario: An attacker monitors the StabilityPool's reserves. They notice the RToken
balance has dropped to 500,000 tokens while 1,000,000 DETokens are in circulation. Despite this 2:1 imbalance, the contract's getExchangeRate()
function blindly returns 1e18
, treating every RToken
as equal to one DEToken
.
The attacker deposits 100,000 RTokens and receives 100,000 DETokens, even though the true economic value should be 50,000 DETokens based on current reserves. When the pool's reserves later increase, they can withdraw more value than initially deposited.
This vulnerability stems from a single line in StabilityPool
Breaks deposit/withdrawal parity
Enables profitable arbitrage through timing deposits
Undermines stability mechanism effectiveness
We handles both empty pool and zero supply edge cases
Maintains precision by scaling with 1e18 before division
Matches the token naming conventions in the StabilityPool contract (DeCRVUSD and RcrvUSD)
Aligns with the existing decimal handling in the protocol
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.