stake.link

stake.link
DeFiHardhatBridge
27,500 USDC
View results
Submission Details
Severity: medium
Invalid

Unlock-Initiated Locks Allow Unrestricted Updates

Summary

The SDLPoolPrimary contract allows unrestricted updates to locks even after their unlock period has been initiated. The contract lacks explicit checks to prevent modifications to locks once the unlock process has started.

Vulnerability Details

The initiateUnlock function initiates the unlock period for a lock. However, the contract does not explicitly restrict further updates to the lock after this point. The relevant code snippet is as follows:

function initiateUnlock(uint256 _lockId) external onlyLockOwner(_lockId, msg.sender) updateRewards(msg.sender) {
// ...
if (locks[_lockId].expiry != 0) revert UnlockAlreadyInitiated();
uint64 halfDuration = locks[_lockId].duration / 2;
if (locks[_lockId].startTime + halfDuration > block.timestamp) revert HalfDurationNotElapsed();
uint64 expiry = uint64(block.timestamp) + halfDuration;
locks[_lockId].expiry = expiry;
// ...
}

The if (locks[_lockId].expiry != 0) check prevents the initiation of the unlock period if it has already started. However, once the unlock period has been initiated, the contract does not include further checks to restrict updates to the lock.

Impact

This vulnerability allows malicious actors to modify locks even after they have been fully unlocked, potentially leading to unexpected behavior or exploitation of the contract's logic.

Tools Used

Manual

Recommendations

Implement a check in relevant functions (e.g., _storeUpdatedLock) to ensure that the lock cannot be updated once its unlock period has started.

Updates

Lead Judging Commences

0kage Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.