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

`Laundrette::retrieveAdmin` doesn't have permission to execute an action directly on the `kernel` causing the function to revert

Summary

According to the Documentation the Laundrette contract has a function that permits the godfather to retrieve the admin role when needed. However when then godfather calls Laundrette::retrieveAdmin, the function reverts with an error Kernel_OnlyExecutor, because the Admin in this case the Laundrette contract is not allowed to perform this action directly.

Vulnerability Details

It's not really a vulnerability but an implementation error, that causes confusion and the function to revert.

Proof of Code

Paste the following code into the Laundrette.t.sol file, then run the test:

Code
function test_retrieveAdmin() public {
vm.prank(godFather);
laundrette.retrieveAdmin();
assertEq(kernel.admin(), godFather);
}
forge test --mt test_retrieveAdmin -vvv

Impact

The function Laundrette::retrieveAdmin is useless and will always fail, making the code harder to read, bloating up the code and makes the usage of the protocol harder because the godfather account might expect that he can call this function to retrieve the admin role.

Tools Used

  • forge test

Recommendations

Remove the function from the Laundrette contract, because the executor (in this case the godfather) should call the Kernel::kernel.executeAction directly. The Laundrette contract acting as the Admin doesn't have any permissions to perform this call.

Optional: The protocol can implement a Script that calls the Kernel::kernel.executeAction with the godfathers private key as signer, to easier handle this action.

- function retrieveAdmin() external {
- kernel.executeAction(Actions.ChangeAdmin, kernel.executor());
- }
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.