User can bypass Recovery Mode via UniswapHandler to buy Malt
The Malt protocol blocks buying its token while under peg, but a user could bypass this by swapping to the whitelisted UniswapHandler and then adding liquidity, effectively acquiring Malt at a discount. This undermines the protocol's profit mechanism and allows risk-free MEV, though the judge noted that removing liquidity was not possible due to a separate issue.
Submitted by gzeon
One of the innovative feature of Malt is to block buying while under peg. The buy block can be bypassed by swapping to the whitelisted UniswapHandler, and then extract the token by abusing the add and remove liquidity function. This is considered a high severity issue because it undermine to protocol’s ability to generate profit by the privileged role as designed and allow potential risk-free MEV.
Proof of Concept
- User swap dai into malt and send malt directly to uniswapHandler, this is possible becuase uniswapHandler is whitelisted
swapExactTokensForTokens(amountDai, 0, [dai.address, malt.address], uniswapHandler.address, new Date().getTime() + 10000); 2) User send matching amount of dai to uniswapHandler 3) User call addLiquidity() and get back LP token 4) User call removeLiquidity() and get back both dai and malt
Recommended Mitigation Steps
According to documentation in https://github.com/code-423n4/2021-11-malt#high-level-overview-of-the-malt-protocol
Users wanting to remove liquidity can still do so via the UniswapHandler contract that is whitelisted in recovery mode.
, this should be exploitable. Meanwhile the current implementation did not actually allow remove liquidity during recovery mode (refer to issue “Unable to remove liquidity in Recovery Mode”) This exploit can be mitigated by disabling addLiquidity() when the protocol is in recovery mode
Alex the Entreprenerd (judge) commented:
The Malt token is programmed to explicitly prevent buying it when at discount. However, because
addLiquidityandremoveLiquidityare callable by anyone, and theUniswapHandleris whitelisted, through a calculated addition and removal of liquidity anyone can mimick buying Malt for a discount (by providing imbalanced underlying and redeeming them).I believe this sidesteps the majority of the functionality of the protocol, and while the attack is fairly simple, it denies the protocol functionality and as such agree with a High Severity
Alex the Entreprenerd (judge) commented:
After re-review: Addressing each step:
- The swap can be done as the whitelisting is bypassed (so finding is valid on that end)
- User can send more liquidity
- User can add liquidity at discount (as they bought at discount) (notice that this subjects them to potentially more IL so arguably the MEV extraction happened at step 1)
- This cannot be done because of #323 which was found by the same warden. As per #323 you can’t remove liquidity as the
transferwill be from pool to user and as such will be reverted due to the system being in recovery mode.I believe that the warden identified a way to sidestep purchasing malt via purchase -> send to UniswapHandler -> add liquidity which should allow for some MEV extraction (with the user risking IL as they assume malt will go back to peg)
Because of this there’s still some validity to the finding, but it’s not as dire as I originally believed.
I’m going to downgrade the finding to Medium Severity as:
- Value can be extracted
- by bypassing the check for buying malt
But this doesn’t allow the selling of malt, so it’s not a protocol breaking exploit but rather a way to gain MEV.
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
Root cause
Likely the addLiquidity function is callable by anyone and the UniswapHandler is whitelisted, so a user can swap tokens to the handler and then add liquidity to obtain Malt despite the buy block.
Impact
The bypass could allow value extraction through MEV, but the judge noted that removing liquidity was not possible due to a separate issue, so the exploit is limited to acquiring Malt at a discount and does not allow selling Malt.
What the attacker needed
Protocol in recovery mode; UniswapHandler is whitelisted; User has DAI and Malt tokens
The fix
The exploit can be mitigated by disabling addLiquidity() when the protocol is in recovery mode.
How it was found
- User swaps DAI for Malt, sending the Malt directly to the UniswapHandler contract.
- User sends an equal amount of DAI to the UniswapHandler.
- User calls addLiquidity() and receives LP tokens.
- User calls removeLiquidity() to get back both DAI and Malt.
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.
Malt is a cryptocurrency token that tries to keep a stable price. When its price is too low, the system stops people from buying it to help it recover. This report shows a way to get around that block by using a special contract that is allowed to interact with the token, letting someone buy at a discount and potentially make a profit.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.