Core Contracts

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

Bypass of Maximum Lock Amount via `veRAACToken::increase` Function

Summary

The veRAACToken contract contains a vulnerability that allows users to bypass the maximum lock amount restriction defined by MAX_LOCK_AMOUNT. While the lock function enforces this limit, the increase function does not check whether the new total locked amount exceeds MAX_LOCK_AMOUNT. This allows users to lock more tokens than intended by first locking a small amount and then repeatedly calling the increase function.

Vulnerability Details

The lock function enforces a maximum lock amount per position via the MAX_LOCK_AMOUNT constant. However, the increase function does not include this check, allowing users to bypass the restriction. This inconsistency in validation creates a loophole where users can exceed the intended maximum lock amount.

  1. lock Function:

    function lock(uint256 amount, uint256 duration) external nonReentrant whenNotPaused {
    if (amount == 0) revert InvalidAmount();
    if (amount > MAX_LOCK_AMOUNT) revert AmountExceedsLimit(); // Enforces MAX_LOCK_AMOUNT
    // Rest of the function...
    }
  2. increase Function:

    function increase(uint256 amount) external nonReentrant whenNotPaused {
    // Increase lock using LockManager
    _lockState.increaseLock(msg.sender, amount); // No check for MAX_LOCK_AMOUNT
    // Rest of the function...
    }
  • The lock function enforces the MAX_LOCK_AMOUNT limit, but the increase function does not.

  • A user can lock a small amount (e.g., 1 token) and then repeatedly call increase to bypass the MAX_LOCK_AMOUNT restriction.

Example:

// Step 1: User locks a small amount
veToken.lock(1, 365 days); // Successfully locks 1 token
// Step 2: User increases the lock amount beyond MAX_LOCK_AMOUNT
veToken.increase(MAX_LOCK_AMOUNT); // Adds MAX_LOCK_AMOUNT tokens
veToken.increase(MAX_LOCK_AMOUNT); // Adds another MAX_LOCK_AMOUNT tokens
// Result: User now has locked more than MAX_LOCK_AMOUNT tokens

Impact

The bypass undermines the protocol's design, which is intended to limit the maximum amount of tokens a single user can lock.

Tools Used

Manual Review

Recommendations

Ensure the increase function checks that the new total locked amount does not exceed MAX_LOCK_AMOUNT.

function increase(uint256 amount) external nonReentrant whenNotPaused {
+ LockManager.Lock memory userLock = _lockState.locks[msg.sender];
+ if (userLock.amount + amount > MAX_LOCK_AMOUNT) revert AmountExceedsLimit(); // Enforce MAX_LOCK_AMOUNT
// Increase lock using LockManager
_lockState.increaseLock(msg.sender, amount);
_updateBoostState(msg.sender, locks[msg.sender].amount);
// Update voting power
LockManager.Lock memory userLock = _lockState.locks[msg.sender];
(int128 newBias, int128 newSlope) = _votingState.calculateAndUpdatePower(
msg.sender,
userLock.amount + amount,
userLock.end
);
// Update checkpoints
uint256 newPower = uint256(uint128(newBias));
_checkpointState.writeCheckpoint(msg.sender, newPower);
//...
Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Validated
Assigned finding tags:

veRAACToken::increase doesn't check the maximum total locked amount

Support

FAQs

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