Skip to content
Smart contracts Audit finding Advanced

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.

TomFrenchBlockchain Follow

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.

  1. The attacker first flashloans and sells a huge amount of foreignAsset to the pool. The pool now thinks nativeAsset is extremely valuable.
  2. The attacker now uses a relatively small amount of nativeAsset to mint synths using VaderPool.mintSynth. As the pool thinks nativeAsset is very valuable the attacker will receive a huge amount of synths.
  3. The attacker can now manipulate the pool in the opposite direction by buying up the foreignAsset they sold to the pool. nativeAsset is now back at its normal price, or perhaps artificially low if the attacker wishes.
  4. The attacker now burns all of their synths. As nativeAsset is considered much less valuable than at the point the synths were minted it takes a lot more of nativeAsset in 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.

The original report as published on Code4rena, by TomFrenchBlockchain. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

  1. The attacker flash loans and sells a huge amount of foreign asset to the pool, making the pool think native asset is extremely valuable.
  2. The attacker uses a relatively small amount of native asset to mint synths, receiving a huge amount because native asset appears valuable.
  3. The attacker buys back the foreign asset they sold, bringing native asset back to its normal price or lower.
  4. 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.

More by TomFrenchBlockchain

View all

28 more disclosed reports, best first.

More from Vader Protocol contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.