The WIthdrawalPool.sol::withdraw function assumes that each batchId is valid and references a valid batch in the withdrawalBatches mapping. However, there is no check to ensure that _batchIds[i] corresponds to an existing batch. If an invalid batchId is provided, the function will still proceed, which could result in faulty calculations or potential unintended behavior.
Invalid batchId: If an invalid batchId is passed, the contract may reference non-existent or incorrect data, leading to faulty withdrawal calculations or erroneous batch processing.
Potential Funds Loss: Users may end up withdrawing incorrect amounts due to invalid or incorrect batchId references, leading to under-withdrawal or over-withdrawal. This can result in unfair distribution of funds or even a loss of user trust.
Manual Review
The contract should validate that the batchId provided by the user corresponds to a valid batch in the withdrawalBatches mapping. Specifically, we need to confirm that the batchId exists and contains valid data.
This line ensures that the batchId corresponds to a valid batch in the withdrawalBatches mapping. If the batch.indexOfLastWithdrawal is zero, it means that the batch does not exist or is not initialized, and the transaction will revert with the error message "Invalid batchId".
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.