No slippage protection in VaderPoolV2.mintSynth
#164
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate
This issue or pull request already exists
VaderPoolV2
Handle
cmichel
Vulnerability details
The
VaderPoolV2.mintSynth
implicitly performs a "native -> foreign" swap usingVaderMath.calculateSwap(nativeDeposit,reserveNative,reserveForeign)
, the resulting amount will be minted as synths instead of transferred out as foreign tokens.The
calculateSwap
calculation, therefore, depends on the current reserves and themintSynth
does not allow specifying anyminSynthAmount
for the caller to make sure that they cannot be sandwich attacked.It's basically doing a trade with a slippage check always set to 100%.
Impact
Any
mintSynth
call can be sandwich attacked to make a profit.mintSynth
by performing a standardswap
, trading native assets to foreign assets, leading to a worse synth price for the victimTrades can happen at a bad price and lead to receiving fewer tokens than at a fair market price.
The attacker's profit is the user's loss.
Recommended Mitigation Steps
Add minimum return amount checks.
Accept a function parameter that can be chosen by the transaction sender, then check that the actually received amount is above this parameter.
The text was updated successfully, but these errors were encountered: