Skip to content
Access control Audit finding Intermediate

Wrong permissions on reassignGlobalAdmin

The reassignGlobalAdmin function is restricted to the TIMELOCK_ROLE, but it also needs ADMIN_ROLE to revoke roles. If the timelock lacks admin rights, the function reverts, potentially locking out role reassignment.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The Permissions.reassignGlobalAdmin function is supposed to only be run with the TIMELOCK_ROLE role, see onlyRole(TIMELOCK_ROLE, "Only timelock can assign roles").

However, the TIMELOCK_ROLE is not the admin of all the reassigned roles and the revokeRole(role, oldAccount) calls will fail as it requires the ADMIN_ROLE.

Recommended Mitigation Steps

The idea might have been that only the TIMELOCK should be able to call this function, and usually it is also an admin, but the function strictly does not work if the caller only has the TIMELOCK roll and will revert in this case. Maybe governance decided to remove the admin role from the Timelock, which makes it impossible to call reassignGlobalAdmin anymore as both the timelock and admin are locked out.

0xScotch (sponsor) confirmed

Alex the Entreprenerd (judge) commented:

The warden has identified a flaw in the roles implementation, while the system seems to work when the timelock has multiple roles, the name of the roles implies a different functionality than what can actually be done. The sponsor confirms. While I believe the impact in the demo setup to be fairly minor, because the finding shows a flow in the role setup, and the sponsor confirmed, I agree with medium severity

The original report as published on Code4rena, by cmichel. 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

Likely the function's access control only checks for TIMELOCK_ROLE, but the internal revokeRole calls require ADMIN_ROLE, which the timelock may not have.

Impact

If the timelock does not have admin role, reassignGlobalAdmin cannot be called, potentially locking out role reassignment.

What the attacker needed

Timelock lacks admin role

The fix

The function should be designed so that the timelock can perform reassignment without needing admin role, or the timelock should always have admin role.

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.

This is about a smart contract function that is supposed to let a special role (timelock) reassign admin roles. But the function also requires another permission (admin) to actually remove roles, so if the timelock doesn't have that, the function fails and nobody can reassign admins.

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 cmichel

View all

196 more disclosed reports, best first.

More from Malt Protocol - Versus contest

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.