Skip to content
Access control Audit finding Beginner

User cannot revoke migration approval if migrator loses migrator role

The setMigrationPermit function checks that the migrator still has MIGRATOR_ROLE even when a user is trying to revoke a previously granted approval. If the admin revokes that role, users can no longer clear their stale migration approvals.

CarlosMB Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

69794 sc low user cannot revoke migration approval if migrator loses migrator role

Submitted on Mar 16th 2026 at 21:29:50 UTC by @CarlosMB for Audit Comp | Folks Finance: Staking Contracts

Description

Intro

The function setMigrationPermit requires the target address to currently have MIGRATOR_ROLE. If the role is revoked from a migrator, users can no longer call setMigrationPermit(migrator, false) to revoke their previously granted approval. This leaves stale migration approvals that users cannot clear themselves.

Vulnerability Details

The function setMigrationPermit performs the following check:

Solidity
if (!hasRole(MIGRATOR_ROLE, _migrator))
    revert MigratorNotFound(_migrator);

This check is executed regardless of whether the user is granting or revoking permission.

If a migrator previously had MIGRATOR_ROLE and users granted permission via setMigrationPermit(migrator, true);

and the admin later revokes the role: revokeRole(MIGRATOR_ROLE, migrator);

users are unable to revoke the permission because calling setMigrationPermit(migrator, false); will revert due to the role check.

As a result, the contract can contain stale approvals that users cannot clear.

Impact Details

Users cannot revoke migration approvals once a migrator loses MIGRATOR_ROLE, leaving stale permissions stored in migrationPermits.

This does not directly lead to loss of funds because migration requires the caller to have MIGRATOR_ROLE. However, it creates a situation where users cannot clean up previously granted permissions.

Category: Insight → Code Optimizations and Enhancements

Proof of Concept

  1. User authorizes a migrator:

    setMigrationPermit(migrator, true);

  2. Admin revokes the migrator role:

    revokeRole(MIGRATOR_ROLE, migrator);

  3. User attempts to revoke approval:

    setMigrationPermit(migrator, false);

  4. Transaction reverts due to:

    Solidity
    if (!hasRole(MIGRATOR_ROLE, _migrator))
        revert MigratorNotFound(_migrator);
    

Result:

migrationPermits[migrator][user] remains true and cannot be cleared by the user.

Recommendation

Allow users to revoke permissions even if the address no longer has MIGRATOR_ROLE. For example:

Solidity
if (_isMigrationPermitted && !hasRole(MIGRATOR_ROLE, _migrator))
    revert MigratorNotFound(_migrator);

The original report as published on Immunefi, by CarlosMB. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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 role check in setMigrationPermit is applied to both granting and revoking, so revoking fails once the migrator no longer holds MIGRATOR_ROLE.

Impact

Users cannot clear stale migration approvals, but this does not directly lead to loss of funds because migration still requires MIGRATOR_ROLE.

What the attacker needed

User previously granted migration approval; admin revokes migrator role

The fix

The role check should only apply when granting permission, so users can always revoke their own approval.

How it was found

  1. The user grants migration permission to a migrator.
  2. The admin revokes the migrator role from that address.
  3. The user tries to revoke the permission.
  4. The transaction reverts because the role check fails, leaving the permission set.

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 user can give a special helper account (a migrator) permission to move their staked funds later. The contract only lets a user change that permission if the helper still has an official migrator badge. If an admin removes the badge, the user can no longer cancel the permission, so an old approval stays on record even though it cannot currently be used.

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 CarlosMB

View all

13 more disclosed reports, best first.

More from Folks Finance: Staking Contracts

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.