LiquidityExtension
Is Vulnerable To Sandwich Attacks
#181
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
Handle
leastwood
Vulnerability details
Vulnerability details
Impact
The
purchaseAndBurn
function inLiquidityExtension
is called by theAuction
contract when users purchase arbitrage tokens. An attacker can monitor the blockchain for calls to this function and launch a sandwich attack to steal funds, assuming the attacker is a well-funded actor.A malicious user is potentially able to steal rewards from users. As such, this issue should be considered medium risk as this results in loss of funds, but requires the attacker to be well-funded.
Proof of Concept
Consider the following scenario:
purchaseArbitrageTokens
.As shown above, attackers are able to siphon funds from users overtime.
https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/Auction.sol#L184
https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/LiquidityExtension.sol#L124
https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/DexHandlers/UniswapHandler.sol#L131-L158
Tools Used
Manual code review
Referenced Mochi review.
Recommended Mitigation Steps
Consider performing slippage checks when users purchase arbitrage tokens by calling
purchaseArbitrageTokens
. This can be done by simply performing a lower bounds check on the output amount received when exchanging rewards tokens for Malt tokens. This change would need to be added into thepurchaseAndBurn
function inLiquidityExtension
.The text was updated successfully, but these errors were encountered: