Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: medium
Invalid

The lock `MIN_DURATION` threshold can be bypassed

Summary

When users lock their tokens, a MIN_DURATION is enforced on time of lock, but this can later be bypassed when extending a lock.

Vulnerability Details

When users lock their tokens, a MIN/MAX lock duration is enforced:

function lock(uint256 amount, uint256 duration) external nonReentrant whenNotPaused {
...
if (duration < MIN_LOCK_DURATION || duration > MAX_LOCK_DURATION)
revert InvalidLockDuration();
...

But later when users extend their locks, although the max duration limit is present, there is no min duration enforced:

function extend(uint256 newDuration) external nonReentrant whenNotPaused {
// Extend lock using LockManager
@> uint256 newUnlockTime = _lockState.extendLock(msg.sender, newDuration);
...
}
function extendLock(
LockState storage state,
address user,
uint256 extensionDuration
) internal returns (uint256 newEnd) {
...
// Calculate remaining duration from current lock
uint256 remainingDuration = lock.end - block.timestamp;
// Calculate total new duration (remaining + extension)
uint256 totalNewDuration = remainingDuration + extensionDuration;
// Check if total duration exceeds max lock duration
@> if (totalNewDuration > state.maxLockDuration) revert InvalidLockDuration();
...
}

The extension duration is added to the remaining duration and it's made sure to not surpass the max lock duration limitation, but the min lock duration limitation is missing in this case.

Impact

Locks with less than MIN_LOCK_DURATION can be created by users meanwhile they should not exist.

Tools Used

Manual Review

Recommendations

Enforce the same check when extending a lock as well.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!