Redemption value of synths can be manipulated to drain VaderPool of all native assets
The redemption value of synths could be manipulated because the exchange rate between native assets and synths was derived from pool reserves that an attacker could shift with a flash loan. An attacker could drain native assets from VaderPool by minting synths when the native asset appeared overvalued and burning them after reversing the price move.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain
Impact
Draining of funds from VaderPool
Proof of Concept
See the VaderPool.mintSynth function: https://github.com/code-423n4/2021-11-vader/blob/607d2b9e253d59c782e921bfc2951184d3f65825/contracts/dex-v2/pool/VaderPoolV2.sol#L126-L167
As the pool’s reserves can be manipulated through flashloans similar to on UniswapV2, 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
Prevent minting of synths or at the very least tie the exchange rate to a manipulation resistant oracle.
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
Impact
For the cost of a flash loan and swap fees, an attacker could extract a large amount of native asset from the pool, and the process could be repeated as long as it remained profitable.
What the attacker needed
Ability to take a flash loan; pool has native asset liquidity; pay swap fees
The fix
Minting of synths should be prevented or the exchange rate should be tied to a manipulation-resistant oracle.
How it was found
- The attacker flash loans and sells a huge amount of foreign asset to the pool, making the pool think native asset is extremely valuable.
- The attacker uses a relatively small amount of native asset to mint synths, receiving a huge amount because native asset appears valuable.
- The attacker buys back the foreign asset they sold, bringing native asset back to its normal price or lower.
- The attacker burns all their synths, which now requires a lot more native asset to pay out because native asset is 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 flash loan is a loan that must be borrowed and repaid within one transaction. The pool worked out how many synths you got for your native asset using its current balance, which an attacker could temporarily distort. By making the native asset look expensive, minting synths, then making it look cheap again before burning the synths, the attacker could take more native asset out than they put in.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.