Skip to content
Access control Audit finding Intermediate

Blacklisted extensions can’t be disabled for rental safes

The protocol's guard contract checks the whitelist when a safe owner tries to disable a module, so if a module is later blacklisted, the owner cannot remove it. This leaves the safe permanently exposed to a vulnerable module, putting its assets at risk.

0xAlix2 Follow with 0xA5DF, ZdravkoHr and 4 others

Originally disclosed on Code4rena

Submitted by 0xAlix2, also found by 0xA5DF, ZdravkoHr, J4X, AkshaySrivastav, oakcobalt, and fnanni

Safe owners can enable modules on their safes only if those modules are whitelisted, this check is also done on disabling modules, which poses a problem. This guarding logic is handled in _checkTransaction in Guard.sol. If a module is whitelisted and a safe owner enables it on his safe, later protocol admins find out that the module has a serious bug and should be blacklisted so no more rental safes are affected, at this point the safe owner has no way of disabling that module as it is blacklisted, and his safe will be vulnerable to exploitation forever, putting all the safe’s possessions at risk.

Proof of Concept

function test_bug_CantDisableBlacklistedExtension() public {
    address EXTENSION_1 = TEST_ADDR_1;
    address EXTENSION_2 = TEST_ADDR_2;
    address bobSafe = address(bob.safe);

    // Extensions 1 and 2 are whitelisted
    vm.startPrank(deployer.addr);
    admin.toggleWhitelistExtension(EXTENSION_1, true);
    admin.toggleWhitelistExtension(EXTENSION_2, true);
    vm.stopPrank();

    assertTrue(STORE.whitelistedExtensions(EXTENSION_1));
    assertTrue(STORE.whitelistedExtensions(EXTENSION_2));

    // Bob enables the extensions on his safe
    vm.startPrank(bob.addr);
    bytes memory transactionSignature = SafeUtils.signTransaction(
        bobSafe,
        bob.privateKey,
        bobSafe,
        abi.encodeWithSelector(ISafe.enableModule.selector, EXTENSION_1)
    );
    SafeUtils.executeTransaction(
        bobSafe,
        bobSafe,
        abi.encodeWithSelector(ISafe.enableModule.selector, EXTENSION_1),
        transactionSignature
    );
    transactionSignature = SafeUtils.signTransaction(
        bobSafe,
        bob.privateKey,
        bobSafe,
        abi.encodeWithSelector(ISafe.enableModule.selector, EXTENSION_2)
    );
    SafeUtils.executeTransaction(
        bobSafe,
        bobSafe,
        abi.encodeWithSelector(ISafe.enableModule.selector, EXTENSION_2),
        transactionSignature
    );
    vm.stopPrank();

    assertTrue(ISafe(bobSafe).isModuleEnabled(EXTENSION_1));
    assertTrue(ISafe(bobSafe).isModuleEnabled(EXTENSION_2));

    // Extensions 1 and 2 are blacklisted
    vm.startPrank(deployer.addr);
    admin.toggleWhitelistExtension(EXTENSION_1, false);
    admin.toggleWhitelistExtension(EXTENSION_2, false);
    vm.stopPrank();

    assertFalse(STORE.whitelistedExtensions(EXTENSION_1));
    assertFalse(STORE.whitelistedExtensions(EXTENSION_2));

    // Bob tries to disable extension 1 on his safe, reverts as it is blacklisted
    vm.startPrank(bob.addr);
    transactionSignature = SafeUtils.signTransaction(
        bobSafe,
        bob.privateKey,
        bobSafe,
        abi.encodeWithSelector(ISafe.disableModule.selector, EXTENSION_2, EXTENSION_1)
    );
    vm.expectRevert();
    SafeUtils.executeTransaction(
        bobSafe,
        bobSafe,
        abi.encodeWithSelector(
            ISafe.disableModule.selector,
            EXTENSION_2,
            EXTENSION_1
        ),
        transactionSignature
    );
    vm.stopPrank();
}

Tools Used

VSCode

Recommended Mitigation Steps

Allow users to disable any module without looking if it’s whitelisted or not but with having a list of modules that can’t be disabled that should contain the stop policy.

Alec1017 (reNFT) confirmed

reNFT mitigated:

The PR here - Introduces more granular controls over whitelist for extensions.

Status: Unmitigated. Full details in report from juancito, and also included in the Mitigation Review section below.


The original report as published on Code4rena, by 0xAlix2. 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 guard contract applies the whitelist check to both enabling and disabling modules, so a module that becomes blacklisted cannot be disabled.

Impact

A safe owner cannot remove a module that has been blacklisted, so the safe remains exposed to any vulnerability in that module and its assets could be at risk.

What the attacker needed

A safe with a whitelisted module enabled; protocol admin blacklists that module

The fix

The protocol should allow users to disable any module regardless of whitelist status, while maintaining a separate list of modules that cannot be disabled (such as the stop policy).

How it was found

  1. Admin whitelists two extensions.
  2. Safe owner enables both extensions on their safe.
  3. Admin blacklists both extensions.
  4. Safe owner tries to disable one extension and the transaction reverts.

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.

A safe is a smart contract wallet that can have extra modules added to it. The protocol only lets you add or remove modules if they are on an approved list. The bug is that the same check is applied when removing a module, so if a module is later removed from the approved list, you can no longer take it off your safe.

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 0xAlix2

View all

39 more disclosed reports, best first.

More from reNFT

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.