Core Contracts

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

Excessive delay in emergency situations

Summary

The emergency withdrawal mechanism in the veRAACToken contract unintentionally applies the EMERGENCY_DELAY of 3 days twice, resulting in a total delay of 6 days before users can withdraw funds in emergencies.

Vulnerability Details

The scheduleEmergencyAction must be called before an emergency unlock because of the scheduleTime check in the withEmergencyDelay modifier:

function scheduleEmergencyAction(bytes32 actionId) external onlyOwner {
> _emergencyTimelock[actionId] = block.timestamp;
emit EmergencyActionScheduled(actionId, block.timestamp + EMERGENCY_DELAY);
}

In the withEmergencyDelay modifier, _emergencyTimelock (cannot be 0) is used to create the first delay by adding EMERGENCY_DELAY to it:

modifier withEmergencyDelay(bytes32 actionId) {
uint256 scheduleTime = _emergencyTimelock[actionId];
if (scheduleTime == 0) revert EmergencyActionNotScheduled();
if (block.timestamp < scheduleTime + EMERGENCY_DELAY) revert EmergencyDelayNotMet();
_;
delete _emergencyTimelock[actionId];
}

Since the enableEmergencyWithdraw function has the withEmergencyDelay modifier, it can only be called after the first delay has passed. enableEmergencyWithdraw adds another EMERGENCY_DELAY:

function enableEmergencyWithdraw() external onlyOwner withEmergencyDelay(EMERGENCY_WITHDRAW_ACTION) {
> emergencyWithdrawDelay = block.timestamp + EMERGENCY_DELAY;
emit EmergencyWithdrawEnabled(emergencyWithdrawDelay);
}

The emergencyWithdraw function can be executed successfully only after the second delay:

function emergencyWithdraw() external nonReentrant {
if (emergencyWithdrawDelay == 0 || block.timestamp < emergencyWithdrawDelay)
revert EmergencyWithdrawNotEnabled();
// ...
}

Impact

Users are locked out of withdrawals for double the intended time, which would be critical in emergency situations.

Recommendations

Apply the emergency delay only once. Even 3 days is considerable, and EMERGENCY_DELAY could be reduced.

Updates

Lead Judging Commences

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

veRAACToken implements two consecutive 3-day emergency delays (totaling 6 days), hindering timely emergency response when funds need to be withdrawn quickly

Support

FAQs

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