Mismanagement of funds
In this page, we cover potential bugs that may occur during the fund management process.
Last updated
In this page, we cover potential bugs that may occur during the fund management process.
Last updated
A mechanism is needed to allow users to withdraw the funds they have deposited.
Example Case:
When a user accidentally sends tokens or ETH to the paymaster, or when there is logic that allows assets to be deposited using the deposit function, the user’s funds may become locked if there’s NO mechanism within the paymaster to withdraw the received tokens/ETH.
Mitigation : Add withdraw
function that is based on onlyOwner
or msg.sender
or
If the user is managing withdrawals through a variable and receives a refund, the value of the variable must be updated to reflect the refunded amount. If this update is not performed correctly, it could potentially lead to a double withdrawal vulnerability.
Example case:
The paymaster is set up to calculate the gas fees during the validation phase and then allow any leftover funds to be withdrawn in advance during the transaction for purposes like swaps or minting. However, in the postOp
function, where the final balance is adjusted and refunded, the _withdrawableETH
variable—which tracks the amount available for withdrawal—was not cleared after refunding. This oversight allows users to call the withdraw
function again, letting them receive the refund a second time.
Example Code:
Mitigation : Update the mapping variable that manages balances when a refund is processed in the postOp function.
Example Case:
Whenever _postOp
is called, the owner’s balance increases by the amount of gas used in addition to the gas processed. If the owner withdraws even a small amount of ETH, inconsistencies can occur between the EP deposit and the balance recorded in the paymaster, potentially preventing some users from accessing their full deposits.
Example Code:
Mitigation : Eliminate code that causes redundant balance updates.