Due to lack of checks for numUpdates
variable , a malicious lock owner can cause DOS of protocol by using out-of-bounds error in SDLPoolSecondary.sol#_executeQueuedLockUpdates
.
Let's understand the vulnerability. Checkout this executeQueuedOperations
function at :
https://github.com/Cyfrin/2023-12-stake-link/blob/main/contracts/core/sdlPool/SDLPoolSecondary.sol#L247C1-L250C6
it can be called by any User as it doesn't have a modifier. It then calls _executeQueuedLockUpdates
function which calls a _onlyLockOwner(lockId, _owner);
function to prevents call from anyone other than Lock Owner.
https://github.com/Cyfrin/2023-12-stake-link/blob/main/contracts/core/sdlPool/SDLPoolSecondary.sol#L456C13-L456C44
But if we look closely into this function, we see numUpdates
value is never checked . As we know there can be cases where queuedLockUpdates[lockId].length
could be 0 . In such cases where queuedLockUpdates[lockId].length=numUpdates=0
and j=0(as in the first iteration) , we might skip the while loop to directly enter the k-variable-for-loop where numUpdates=j=0
and we know executing a pop() on zero length array would cause unexpected DOS condition like out-of-bound error for protocol. :
https://github.com/Cyfrin/2023-12-stake-link/blob/main/contracts/core/sdlPool/SDLPoolSecondary.sol#L451C2-L510C6
Malicious Lock Owner can cause DOS of protocol by using out-of-bounds error for multiple times
Manual Review
Add this check before while loop :
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.