When minting or increasing liquidity through NonfungiblePositionManager, excess ETH sent to the contract is not refunded #98
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
🤖_74_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/ronin-chain/katana-v3-contracts/blob/03c80179e04f40d96f06c451ea494bb18f2a58fc/src/periphery/NonfungiblePositionManager.sol#L246
https://github.com/ronin-chain/katana-v3-contracts/blob/03c80179e04f40d96f06c451ea494bb18f2a58fc/src/periphery/NonfungiblePositionManager.sol#L181
Vulnerability details
When minting or increasing liquidity through
NonfungiblePositionManager
, excess ETH sent to the contract is not refunded to the caller and stays in the contract. This results in a permanent loss for the user.Proof of Concept
The
NonfungiblePositionManager
serves as the primary entry point for users interacting with pools in the protocol. Users can mint new positions or increase liquidity in existing ones .When either the functions mint or increaseLiquidity is called, these functions trigger addLiquidity, which in turn invokes the mint function on the respective pool. This interaction triggers katanaV3MintCallback, which executes the pay function for each token in the pool to initiate the token transfers
If one of the tokens in the pool is WETH
(WETH9)
and the user send ETH with his call to be used for deposit, theNonfungiblePositionManager
will wrap the exact amount of required ETH to WETH and transfer it to the pool.It is nearly impossible to send in the exact amount of ETH to be exchanged to WETH since the current price in the pool at the moment the transaction will be executed might have changed since the submission of the transaction. This means, to ensure the transaction passes, users will be sending some additional ETH as a buffer. The problem arises from the fact that this additional ETH is not refunded to the user but stays in the
NonfungiblePositionManager
and anybody can claim it by calling refundETH which normal users will never do in the same transaction.Recommended Mitigation Steps
Ensure that excess Eth is refunded to the caller .
Assessed type
ETH-Transfer
The text was updated successfully, but these errors were encountered: