Skip to content
Access control Audit finding Intermediate

Users cannot revoke migration permits after migrator role is removed

The setMigrationPermit function requires the target migrator to currently hold MIGRATOR_ROLE even when a user wants to revoke their permit. If the admin removes the role, users can no longer revoke their authorization, and the permit remains true, so if the role is later re-granted, the migrator can move the user's positions without fresh consent.

godwinudo Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

68994 sc low users cannot revoke migration permits after migrator role is removed

Submitted on Mar 12th 2026 at 09:24:35 UTC by @godwinudo for Audit Comp | Folks Finance: Staking Contracts

Description

Brief/Intro

The setMigrationPermit function validates that the target address currently holds the MIGRATOR_ROLE before allowing any change to the permit, including revocation. This means that if an admin removes the MIGRATOR_ROLE from a migrator address, users who previously granted that migrator permission can no longer revoke their own authorization. The permit remains true in storage permanently, and if the role is ever re-granted to the same address, the old permit becomes active again without the user's re-consent.

Vulnerability Details

The Staking.sol contract implements a migration system where users must explicitly authorize specific migrator contracts to move their staking positions. This authorization is managed through the setMigrationPermit function, which writes to the migrationPermits mapping:

Solidity
mapping(address migrator => mapping(address user => bool isAuthorized)) public migrationPermits;

When a user calls setMigrationPermit, the function first checks whether the target address currently holds the MIGRATOR_ROLE:

Solidity
function setMigrationPermit(address _migrator, bool _isMigrationPermitted) external {
    if (!hasRole(MIGRATOR_ROLE, _migrator)) revert MigratorNotFound(_migrator);

    migrationPermits[_migrator][msg.sender] = _isMigrationPermitted;
    emit MigrationPermitUpdated(_migrator, msg.sender, _isMigrationPermitted);
}

The problem is that this role check applies to both granting (true) and revoking (false) the permit.

{% stepper %} {% step %}

The admin grants MIGRATOR_ROLE to address MigratorA.

A user calls setMigrationPermit(MigratorA, true), setting migrationPermits[MigratorA][user] = true. {% endstep %}

{% step %}

The admin later revokes MIGRATOR_ROLE from MigratorA.

This may happen because the migrator contract was found to have a flaw, or because the migration window has closed. {% endstep %}

{% step %}

The user now wants to clean up their authorization and calls setMigrationPermit(MigratorA, false).

The function executes hasRole(MIGRATOR_ROLE, MigratorA), which returns false because the role was revoked. {% endstep %}

{% step %}

The function reverts with MigratorNotFound(MigratorA).

At this point, the storage value migrationPermits[MigratorA][user] is permanently stuck at true. {% endstep %} {% endstepper %}

The migrator can call migratePositionsFrom(user) and the permit check at line 173 passes:

Solidity
if (!migrationPermits[msg.sender][user]) revert MigratorNotPermitted(msg.sender, user);

The user never re-consented to this authorization. They may not even be aware that their old permit is active.

Impact Details

A user permanently loses the ability to revoke their migration authorization for a specific migrator address once that address's MIGRATOR_ROLE is removed. The permit remains true in storage with no way for anyone to clear it. If the same address later regains MIGRATOR_ROLE, it can migrate the user's positions without fresh consent.

Proof of Concept

{% stepper %} {% step %}

The protocol admin calls grantRole(MIGRATOR_ROLE, MigratorA) to authorize a migrator contract.

{% endstep %}

{% step %}

Alice has active staking positions.

She calls setMigrationPermit(MigratorA, true). The function checks hasRole(MIGRATOR_ROLE, MigratorA) which returns true, so the transaction succeeds. Storage now holds migrationPermits[MigratorA][Alice] = true. {% endstep %}

{% step %}

The admin calls revokeRole(MIGRATOR_ROLE, MigratorA) to disable it.

MigratorA can no longer call migratePositionsFrom because the onlyRole(MIGRATOR_ROLE) modifier blocks it. {% endstep %}

{% step %}

Alice, being prudent, wants to revoke her permit.

She calls setMigrationPermit(MigratorA, false). The function hits hasRole(MIGRATOR_ROLE, MigratorA) returns false. The transaction reverts with MigratorNotFound(MigratorA). Alice cannot revoke her permit. {% endstep %} {% endstepper %}

The original report as published on Immunefi, by godwinudo. 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 setMigrationPermit function checks that the migrator has MIGRATOR_ROLE for both granting and revoking a permit, so revocation fails once the role is removed.

Impact

A user permanently loses the ability to revoke their migration authorization for a specific migrator address once that address's MIGRATOR_ROLE is removed, and if the role is later re-granted, the migrator could migrate the user's positions without fresh consent.

What the attacker needed

User previously granted a migration permit; admin removes MIGRATOR_ROLE from that migrator

How it was found

  1. Admin grants MIGRATOR_ROLE to a migrator address.
  2. User calls setMigrationPermit with true for that migrator, which succeeds because the role check passes.
  3. Admin revokes MIGRATOR_ROLE from the migrator.
  4. User tries to revoke their permit by calling setMigrationPermit with false, but the transaction reverts because the role check fails.

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 migrator contract permission to move their staking position. The contract only lets a user change that permission if the migrator currently has a special admin role. If the admin removes that role, the user can no longer cancel their permission, and it stays active in case the role is given back later.

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 godwinudo

View all

14 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.