Closed code423n4 closed 1 year ago
The AMM does not support rebasing tokens. this is a dup of https://github.com/code-423n4/2022-12-Stealth-Project-findings/issues/78
gte620v marked the issue as sponsor disputed
Since this is a fork of Uniswap v3 which clearly states it does not accept FoT or rebasing tokens I'm going to mark this issue as QA. See here for Uniswap docs.
Lines of code
https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/maverick-v1/contracts/models/Pool.sol#L300-L303
Vulnerability details
Impact
In Pool.swap, when the user swaps, the contract saves the current input token balance of the contract to the previousBalance variable after sending the output token to the user, and then the user can send the amountIn amount of input token to the contract in the swapCallback, and the contract will require the current input token balance to be greater than previousBalance + amountIn.
However, if the input token is a rebasing token and anyone can trigger the rebase event for that rebasing token, the user can trigger the rebase event in the swapCallback to increase the total supply of rebasing tokens, so that even if the user does not send rebasing tokens to the contract in the swapCallback, the balance of rebasing tokens in the contract will increase, allowing the user to steal the output tokens in the Pool
Proof of Concept
https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/maverick-v1/contracts/models/Pool.sol#L300-L303
Tools Used
None
Recommended Mitigation Steps
Consider using a blacklist to ban the use of these tokens