he withdraw function of the VaultDepositController contract contains inadequate error handling, reverting with a generic InsufficientTokensUnbonded error. This lack of specificity makes it difficult for users and developers to understand the underlying issue when a transaction fails, leading to potential misuse or unnecessary confusion.
he withdraw function of the VaultDepositController contract contains inadequate error handling, reverting with a generic InsufficientTokensUnbonded error. This lack of specificity makes it difficult for users and developers to understand the underlying issue when a transaction fails, leading to potential misuse or unnecessary confusion.
PoC:
A user interacts with the withdraw function.
The claim period is inactive (e.g., set to false).
The user attempts to withdraw a certain amount of tokens.
When the withdrawal attempt is made, the user will receive the generic error message InsufficientTokensUnbonded, without clarification on whether the failure was due to the inactive claim period or the requested amount being greater than the available unbonded tokens.
Below is a Hardhat test scenario that proves the vulnerability in the withdraw function:
The impact of inadequate error handling is significant. Users cannot discern whether their transaction failed due to an inactive claim period or an insufficient balance, leading to confusion and potential loss of trust in the contract. Developers may also struggle to diagnose issues without detailed error messages, resulting in increased debugging time and costs.
Manual review.
To mitigate this issue, the error handling in the withdraw function should be enhanced. Instead of reverting with a generic error, it should specify the exact reason for failure, such as:
Additionally, consider emitting events before reverting to provide a log of the attempted actions and reasons for failure.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.