Skip to content
Access control Audit finding Intermediate

DelayedAdmin Cannot PauseAdmin.removePauser

The DelayedAdmin contract lacks a function to call PauseAdmin.removePauser, despite documentation stating it should be able to do so in an emergency. An attacker who controls a pause admin could trigger a malicious pause, and the delayed admin cannot remove that pauser, potentially delaying recovery.

ciphermarco Follow

Originally disclosed on Code4rena

Submitted by ciphermarco

As per the audit repository’s documentation, which is confirmed as up-to-date, there are carefully considered emergency scenarios. Among these scenarios, one is described as follows:

https://github.com/code-423n4/2023-09-centrifuge/blob/main/README.md?plain=1#L74-L77:

**Someone controls 1 pause admin and triggers a malicious `pause()`**

* The delayed admin is a `ward` on the pause admin and can trigger `PauseAdmin.removePauser`.
* It can then trigger `root.unpause()`.

That makes perfect sense from a security perspective. However the provided DelayedAdmin implementation lacks the necessary functionality to execute PauseAdmin.removePauser in the case of an emergency.

Striving to adhere to the documented Severity Categorization, I have categorized this as Medium instead of Low. The reason is that it does not qualify as Low due to representing both a “function incorrect as to spec” issue and a critical feature missing from the project’s security model. Without this emergency action for PauseAdmin, other recovery paths may have to wait for Root’s delay period or, at least temporarily, change the protocol’s security model to make a recovery. In my view, this aligns with the “Assets not at direct risk, but the function of the protocol or its availability could be impacted” requirement for Medium severity. With that said, I realize the sponsors and judges will ultimately evaluate and categorise it based on their final risk analysis, not mine. I’m simply streamlining the process by presenting my perspective in advance.

Proof of Concept

In order to remove a pauser from the PauseAdmin contract, the removePause function must be called:

https://github.com/code-423n4/2023-09-centrifuge/blob/main/src/admins/PauseAdmin.sol#L39-L42:

    function removePauser(address user) external auth {
        pausers[user] = 0;
        emit RemovePauser(user);
    }

Since it is a short contract, here is the whole DelayedAdmin implementation:

https://github.com/code-423n4/2023-09-centrifuge/blob/main/src/admins/DelayedAdmin.sol

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.21;

import {Root} from "../Root.sol";
import {Auth} from "./../util/Auth.sol";

/// @title  Delayed Admin
/// @dev    Any ward on this contract can trigger
///         instantaneous pausing and unpausing
///         on the Root, as well as schedule and cancel
///         new relys through the timelock.
contract DelayedAdmin is Auth {
    Root public immutable root;

    // --- Events ---
    event File(bytes32 indexed what, address indexed data);

    constructor(address root_) {
        root = Root(root_);

        wards[msg.sender] = 1;
        emit Rely(msg.sender);
    }

    // --- Admin actions ---
    function pause() public auth {
        root.pause();
    }

    function unpause() public auth {
        root.unpause();
    }

    function scheduleRely(address target) public auth {
        root.scheduleRely(target);
    }

    function cancelRely(address target) public auth {
        root.cancelRely(target);
    }
}

No implemented functionalities exist to trigger PauseAdmin.removePauser. Additionally, the contract features an unused event File, a and fails to record the PauseAdmin’s address upon initiation or elsewhere.

As anticipated, Auth (inherited) also does not handle this responsibility:

To confirm that I did not misunderstand anything, I thoroughly searched the entire audit repository for occurrences of removePauser. However, I could only find them in PauseAdmin.sol, where the function to remove a pauser is implemented, and in a test case that directly calls the PauseAdmin.

Recommended Mitigation Steps

1. Implement the PauseAdmin.removePauser Functionality in DelayedAdmin.sol with This Diff:

5a6
> import {PauseAdmin} from "./PauseAdmin.sol";
13a15
>     PauseAdmin public immutable pauseAdmin;
18c20
<     constructor(address root_) {
---
>     constructor(address root_, address pauseAdmin_) {
19a22
>         pauseAdmin = PauseAdmin(pauseAdmin_);
41,42c44,48
<     // @audit HM? How can delayed admin call `PauseAdmin.removePauser if not coded here?
<     // @audit According to documentation: "The delayed admin is a ward on the pause admin and can trigger PauseAdmin.removePauser."
---
>
>     // --- Emergency actions --
>     function removePauser(address pauser) public auth {
>         pauseAdmin.removePauser(pauser);
>     }

2. Add This Test Function to AdminTest Contract in test/Admin.t.sol

    function testEmergencyRemovePauser() public {
        address evilPauser = address(0x1337);
        pauseAdmin.addPauser(evilPauser);
        assertEq(pauseAdmin.pausers(evilPauser), 1);

        delayedAdmin.removePauser(evilPauser);
        assertEq(pauseAdmin.pausers(evilPauser), 0);
    }

3. Change the DelayedAdmin Creation in script/Deployer.sol with This diff:

55c55
<         delayedAdmin = new DelayedAdmin(address(root));
---
>         delayedAdmin = new DelayedAdmin(address(root), address(pauseAdmin));

4. Test

$ forge test

RaymondFam (lookout) commented:

The sponsor has highlighted in Discord that these are EOAs capable of triggering to removePauser.

gzeon (judge) commented:

Since the removePauser usecase is explicitly documented in the README and DelayedAdmin.sol is in-scope, I believe this is a valid Medium issue as the warden described.

hieronx (Centrifuge) confirmed and commented:

Mitigated in https://github.com/centrifuge/liquidity-pools/pull/139


The original report as published on Code4rena, by ciphermarco. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The DelayedAdmin contract was not implemented with a function to call PauseAdmin.removePauser, and it does not store the PauseAdmin address, contrary to the documented security model.

Impact

If a malicious pauser is added, the delayed admin cannot remove them, potentially forcing reliance on the Root's delay period or changing the security model to recover, which could impact protocol availability.

What the attacker needed

Attacker controls a pause admin; delayed admin lacks removePauser function

The fix

The issue was mitigated by adding a removePauser function to DelayedAdmin and updating deployment to pass the PauseAdmin address.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In this system, there are special admin contracts that can pause the protocol in an emergency. The documentation says one admin (the delayed admin) should be able to remove a malicious pauser from another admin contract (the pause admin). However, the delayed admin contract does not have the code to do that, so if a bad pauser is added, the delayed admin cannot remove them directly.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by ciphermarco

View all

3 more disclosed reports, best first.

More from Centrifuge

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.