Core Contracts

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

Incorrect Modifier Order in executeEmergencyAction Enables Potential Reentrancy

Description

In TimelockController::executeEmergencyAction, the nonReentrant modifier is placed after the onlyRole modifier. This ordering could allow a malicious actor with the EMERGENCY_ROLE to perform a reentrancy attack during the role check, before the reentrancy guard is activated.

function executeEmergencyAction(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata calldatas,
bytes32 predecessor,
bytes32 salt
) external payable onlyRole(EMERGENCY_ROLE) nonReentrant {

The issue arises because:

  1. onlyRole check executes first

  2. During this check, the contract state is unprotected from reentrancy

  3. The nonReentrant guard only activates after role verification

Impact

  1. Reentrancy Window: Creates a small window where reentrancy is possible during role checking

  2. State Manipulation: An attacker with EMERGENCY_ROLE could potentially:

    • Re-enter the contract during role verification

    • Manipulate contract state before reentrancy guard activates

    • Execute emergency actions multiple times in a single transaction

  3. Critical Severity: Given this is an emergency action function, any vulnerability could have severe consequences

  4. Privileged Attack Vector: While this requires EMERGENCY_ROLE access, it still represents a significant risk

Recommendations

Correct Modifier Order

function executeEmergencyAction(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata calldatas,
bytes32 predecessor,
bytes32 salt
- ) external payable onlyRole(EMERGENCY_ROLE) nonReentrant {
+ ) external payable nonReentrant onlyRole(EMERGENCY_ROLE) {
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!