Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiquidityExtension Is Vulnerable To Sandwich Attacks #181

Closed
code423n4 opened this issue Nov 30, 2021 · 2 comments
Closed

LiquidityExtension Is Vulnerable To Sandwich Attacks #181

code423n4 opened this issue Nov 30, 2021 · 2 comments
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

Comments

@code423n4
Copy link
Contributor

Handle

leastwood

Vulnerability details

Vulnerability details

Impact

The purchaseAndBurn function in LiquidityExtension is called by the Auction 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:

  • An attacker buys Malt tokens from the uniswap pool.
  • They frontrun a user calling purchaseArbitrageTokens.
  • The user buys Malt tokens at an inflated price.
  • The attacker sells their Malt tokens and profits.

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 the purchaseAndBurn function in LiquidityExtension.

@code423n4 code423n4 added 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 labels Nov 30, 2021
code423n4 added a commit that referenced this issue Nov 30, 2021
@0xScotch 0xScotch added the duplicate This issue or pull request already exists label Dec 10, 2021
@0xScotch
Copy link
Collaborator

#219

@GalloDaSballo
Copy link
Collaborator

Duplicate of #219

@GalloDaSballo GalloDaSballo marked this as a duplicate of #219 Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants