Description
The Laundrette Policy acts with the admin
role within the framework however the function retrieveAdmin attempts to call a kernel function which requires the executor role.
The documentation states:
A function permit the godfather to retrieve the admin role when needed.
This function cannot be called successfully by the godFather.
Impact
The Laundrette:retrieveAdmin
function cannot be called successfully to change the admin to the kernel executor.
Proof of Concept
vm.prank(kernel.executor());
laundrette.retrieveAdmin();
├─ [393] Kernel::executor() [staticcall]
│ └─ ← [Return] God Father: [0xe166Ae83c3384a19498Ae0674706988DD2797489]
├─ [0] VM::prank(God Father: [0xe166Ae83c3384a19498Ae0674706988DD2797489])
│ └─ ← [Return]
├─ [2235] Laundrette::retrieveAdmin()
│ ├─ [393] Kernel::executor() [staticcall]
│ │ └─ ← [Return] God Father: [0xe166Ae83c3384a19498Ae0674706988DD2797489]
│ ├─ [649] Kernel::executeAction(5, God Father: [0xe166Ae83c3384a19498Ae0674706988DD2797489])
│ │ └─ ← [Revert] Kernel_OnlyExecutor(0xD76ffbd1eFF76C510C3a509fE22864688aC3A588)
│ └─ ← [Revert] Kernel_OnlyExecutor(0xD76ffbd1eFF76C510C3a509fE22864688aC3A588)
└─ ← [Revert] Kernel_OnlyExecutor(0xD76ffbd1eFF76C510C3a509fE22864688aC3A588)
vm.prank(godFather);
laundrette.retrieveAdmin();
├─ [0] VM::prank(God Father: [0xe166Ae83c3384a19498Ae0674706988DD2797489])
│ └─ ← [Return]
├─ [2235] Laundrette::retrieveAdmin()
│ ├─ [393] Kernel::executor() [staticcall]
│ │ └─ ← [Return] God Father: [0xe166Ae83c3384a19498Ae0674706988DD2797489]
│ ├─ [649] Kernel::executeAction(5, God Father: [0xe166Ae83c3384a19498Ae0674706988DD2797489])
│ │ └─ ← [Revert] Kernel_OnlyExecutor(0xD76ffbd1eFF76C510C3a509fE22864688aC3A588)
│ └─ ← [Revert] Kernel_OnlyExecutor(0xD76ffbd1eFF76C510C3a509fE22864688aC3A588)
└─ ← [Revert] Kernel_OnlyExecutor(0xD76ffbd1eFF76C510C3a509fE22864688aC3A588)
Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 6.64ms (1.79ms CPU time)
Recommended mitigation
Review the need to perform this operation and consider creating separate Policy contracts and roles to keep the separation of concerns clean. Eg:
Create a GodFather Policy
Create a Admin Policy
Create a GangMember Policy
Create a PublicUser Policy
Use individual roles for each of the different types of users
References
Review the documentation for the Framework:
Tools Used