DOS would happen in some instances of minting or burning an ITM option #415
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-435
grade-a
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_415_group
AI based duplicate group recommendation
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/SemiFungiblePositionManager.sol#L435-L458
https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/README.md#L256-L257
Vulnerability details
Proof of Concept
First would be key to note that from the contest's readMe, protocol has stated that tokens that revert on zero value transfers are in scope, i.e https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/README.md#L256-L257
Now take a look at https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/SemiFungiblePositionManager.sol#L435-L458
We can see that this is the function that is used and called by the pool during an ITM option mint/burn, however from this line in Uniswap's native implementation we can see that if no swaps were to occur and this function gets called, then both
amount0Delta
andamount1Delta
will be 0, due to this checkuint256 amountToPay = amount0Delta > 0 ? uint256(amount0Delta) : uint256(amount1Delta);
theamount1Delta
ends being attempted to be sent which itself is0
now since not all instances of mints/burns would include swaps, this would occur, and considering the first paragraph in this report proving that protocol supports tokens that revert on zero token transfers, then this attempt of minting and burning is effectively DOS'd.
Impact
DOS to attempts of minting/burning options, cause if
amount0Delta
andamount1Delta
is0
the query by Uniswap touniswapV3SwapCallback()
function would fail.Recommended Mitigation Steps
Consider checking both
amount0Delta
andamount1Delta
before attempting to transfer, after checkingif amount0Delta > 0
don't just blindly sendamount1Delta
if it can be0
, consider applying changing https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/SemiFungiblePositionManager.sol#L435-L458Alternatively, consider outrightly documenting that these tokens are not supported.
Assessed type
DoS
The text was updated successfully, but these errors were encountered: