Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

Incorrect Role Assignment Causes Reversion in retrieveAdmin Function in Laundrette Contract

Summary:

In the Deployer.s.sol, the laundrette contract is assigned the role of admin. However the function laundrette::retrieveAdmin will always revert because it attempts to execute a function that can only be called by the Executor.

Vulnerability Details

The function kernel::executeAction in the Kernel contract has an onlyExecutor modifier, which restricts its execution to only the Executor. In Deployer.s.sol, the Laundrette contract is granted the admin role, not the executor role. Therefore, when the Laundrette contract calls kernel::executeAction within its retrieveAdmin function, it will revert due to lack of the necessary Executor role.

Impact

The laundrette::retrieveAdmin function is rendered useless because it cannot successfully call kernel.executeAction without the Executor role. This means that any attempt to change the admin through this function will fail, potentially leaving the system in an undesirable state.

Place the following into laundrette.t.sol.

import {Kernel_OnlyExecutor } from "src/Kernel.sol";
function test_cant_retrieve_admin() public {
vm.expectRevert(abi.encodeWithSelector(Kernel_OnlyExecutor.selector, address(laundrette)));
vm.prank(godFather);
laundrette.retrieveAdmin();
}

Tools Used

Manual Review, Foundry

Recommendations:

To fix this issue, the GodFather account, which has the Executor role, should directly call the kernel contract to retrieve the admin role when needed. This ensures that only the account with the correct permissions attempts to execute the action, preventing the revert error and aligning the function usage with the intended access control logic.

Updates

Lead Judging Commences

n0kto Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

`retrieveAdmin` not working

Support

FAQs

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