The contract does not adequately validate input parameters in various functions, which can lead to unintended consequences, including fund loss or incorrect contract behavior.
In the context of the LSTRewardsSplitter
contract, certain functions accept input parameters that could benefit from additional validation. Here are specific areas of concern
Withdraw Function:
No Balance Check: The function does not check if the _amount
to withdraw exceeds the available balance of the contract. This can lead to a situation where principalDeposits
becomes negative, which is not desirable.
Zero Address Check: The _receiver
address is not checked to ensure it is not the zero address. Transferring tokens to the zero address would result in those tokens being permanently lost.
Add Fee Function
current implementation
Zero Address Check: The _receiver
parameter is not validated to ensure it is a valid address. If a zero address is added as a fee receiver, it could lead to unintended consequences when attempting to transfer fees.
Update Fee Function
Current Implementation:
No Zero Address Check: Similar to the addFee
function, the _receiver
parameter is not checked, potentially allowing for a zero address to be assigned as a fee receiver.
Index Validation: While there is a check to ensure the index is within the bounds of the fees
array, more comprehensive error handling could improve clarity and robustness.
Loss of Funds: If a user attempts to withdraw more tokens than available, the state could become inconsistent, allowing for erroneous behavior that could lead to loss of funds.
Permanent Loss of Tokens: Sending tokens to a zero address results in those tokens being irretrievable, effectively reducing the total balance available to users.
Decreased User Trust: Insufficient validation could lead to user frustration and loss of trust in the contract's reliability.
To mitigate this vulnerability, consider implementing the following checks:
Withdraw Function:
Validate that the _amount
to withdraw does not exceed the current balance of the contract:
Add Fee Function
Check that the _receiver
address is not the zero address:
Update Fee Function:
Similar checks can be added for the _receiver
parameter:
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.