The WithdrawalPool
contract contains a potential underflow vulnerability in the _finalizeWithdrawals
function. Specifically, when indexOfNextWithdrawal
is 0 and sharesRemaining > sharesToWithdraw
, the contract attempts to push a WithdrawalBatch
with a negative index, causing a revert due to underflow.
In the first iteration of _finalizeWithdrawals
function, indexOfNextWithdrawal
is 0, and if in this loop we got sharesRemaining > sharesToWithdraw
, a new withdrawalBatches
will be pushed. But with indexOfLastWithdrawal = i-1
:
And since i
here is equal to 0, the function will revert due to underflow.
The first iteration in _finalizeWithdrawals
will revert if sharesRemaining > sharesToWithdraw
.
Manual Review
I do not have a suitable recommendation for this issue.
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.