You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zero-amount deposits will cause an underflow on withdrawal
Summary
Users can make zero-amount deposits, leading to an arithmetic underflow in the withdrawal logic. When a withdrawal is attempted, the function calculates amount_to_transfer by subtracting withdraw_params.fee from withdraw_params.token_amount. With token_amount set to zero, this results in a negative outcome, which causes an underflow.
Root Cause
There is no validation to ensure that the deposit amount is greater than zero, nor is there a check to prevent withdrawal if the amount is insufficient to cover fees, which can cause an underflow. When the amount_to_transfer is calculated, withdraw_params.token_amount (which may be zero) has withdraw_params.fee subtracted from it. This subtraction leads to an underflow if token_amount is zero.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
Due to the underflow, an attacker can get more tokens than they deposited.
PoC
No response
Mitigation
No response
The text was updated successfully, but these errors were encountered:
sherlock-admin4
changed the title
Orbiting Tweed Shell - Zero-amount deposits will cause an underflow on withdrawal
Silvermist - Zero-amount deposits will cause an underflow on withdrawal
Nov 6, 2024
Silvermist
High
Zero-amount deposits will cause an underflow on withdrawal
Summary
Users can make zero-amount deposits, leading to an arithmetic underflow in the withdrawal logic. When a withdrawal is attempted, the function calculates
amount_to_transfer
bysubtracting withdraw_params.fee
fromwithdraw_params.token_amount
. Withtoken_amount
set to zero, this results in a negative outcome, which causes an underflow.Root Cause
There is no validation to ensure that the deposit amount is greater than zero, nor is there a check to prevent withdrawal if the amount is insufficient to cover fees, which can cause an underflow. When the amount_to_transfer is calculated,
withdraw_params.token_amount
(which may be zero) haswithdraw_params.fee
subtracted from it. This subtraction leads to an underflow iftoken_amount
is zero.Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
Due to the underflow, an attacker can get more tokens than they deposited.
PoC
No response
Mitigation
No response
The text was updated successfully, but these errors were encountered: