Redemption value of synths can be manipulated to drain VaderPoolV2 of all native assets in the associated pair
The redemption value of synths could be manipulated by flashloan-driven changes to the pool's reserves, allowing an attacker to mint synths cheaply and burn them for profit, draining native assets from VaderPoolV2.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain, also found by certora
Draining of funds from VaderPoolV2.
Proof of Concept
See the VaderPool.mintSynth function: https://github.com/code-423n4/2021-12-vader/blob/fd2787013608438beae361ce1bb6d9ffba466c45/contracts/dex-v2/pool/VaderPoolV2.sol#L153-L194
As the pool’s reserves can be manipulated through flashloans similar to on UniswapV2 (the slip mechanism can be mitigated by splitting the manipulation over a number of trades), an attacker may set the exchange rate between nativeAsset and synths (calculated from the reserves). An attacker can exploit this to drain funds from the pool.
- The attacker first flashloans and sells a huge amount of
foreignAssetto the pool. The pool now thinksnativeAssetis extremely valuable. - The attacker now uses a relatively small amount of
nativeAssetto mint synths usingVaderPool.mintSynth. As the pool thinksnativeAssetis very valuable the attacker will receive a huge amount of synths. - The attacker can now manipulate the pool in the opposite direction by buying up the
foreignAssetthey sold to the pool.nativeAssetis now back at its normal price, or perhaps artificially low if the attacker wishes. - The attacker now burns all of their synths. As
nativeAssetis considered much less valuable than at the point the synths were minted it takes a lot more ofnativeAssetin order to pay out for the burned synths.
For the price of a flashloan and some swap fees, the attacker has now managed to extract a large amount of nativeAsset from the pool. This process can be repeated as long as it is profitable.
Recommended Mitigation Steps
Tie the exchange rate use for minting/burning synths to a manipulation resistant oracle.
SamSteinGG (Vader) acknowledged
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the exchange rate for minting and burning synths is derived directly from the pool's reserves, which can be manipulated within a single transaction using flashloans.
Impact
The attacker could drain a large amount of nativeAsset from the pool, and the process can be repeated as long as it is profitable.
What the attacker needed
Access to flashloan capital; ability to trade in the pool
The fix
The exchange rate used for minting and burning synths should be tied to a manipulation-resistant oracle.
How it was found
- The attacker flashloans a huge amount of foreignAsset and sells it to the pool, making nativeAsset appear extremely valuable.
- The attacker uses a small amount of nativeAsset to mint synths via VaderPool.mintSynth, receiving a huge amount of synths due to the inflated nativeAsset value.
- The attacker buys back the foreignAsset they sold, restoring or even lowering the nativeAsset price.
- The attacker burns all their synths, receiving a large amount of nativeAsset because it is now considered less valuable.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A pool holds two types of tokens and sets their exchange rate based on how much of each it holds. An attacker can temporarily flood the pool with one token to distort the rate, mint a large amount of a synthetic token at the distorted rate, then reverse the distortion and burn the synthetic tokens for a profit. This lets them steal the pool's valuable tokens.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.