69673 sc low users cannot revoke a migration permit after role removal

Submitted on Mar 16th 2026 at 07:47:51 UTC by @Athenea for Audit Comp | Folks Finance: Staking Contracts

  • Report ID: #69673

  • Report Type: Smart Contract

  • Report severity: Low

  • Target: https://github.com/Folks-Finance/folks-staking-contracts/blob/main/src/Staking.sol

Description

Brief/Intro

This insight highlights a user-control issue in the migration permission system. Once a migrator loses MIGRATOR_ROLE, users who had previously approved it can no longer explicitly revoke that approval, leaving stale permissions in storage.

Vulnerability Details

setMigrationPermit() requires the target address to currently hold MIGRATOR_ROLE for both enabling and disabling a permit:

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);
}

As a result, once a migrator loses MIGRATOR_ROLE, users who previously approved it can no longer explicitly revoke that approval.

Impact Details

This is not an immediate exploit, because a role-revoked migrator cannot call migratePositionsFrom() while the role is absent. Still, the behavior weakens user control and leaves stale approvals in place until role configuration changes again.

References

https://github.com/Folks-Finance/folks-staking-contracts/blob/3131a2d46b5afa76f606bf08adfd85452a47e2d8/src/Staking.sol#L166-L210

Recommendation

Require MIGRATOR_ROLE only when enabling a permit, not when disabling one:

Proof of Concept

Steps

  1. Deploy Staking.

  2. Grant MIGRATOR_ROLE to migrator.

  3. User enables migration permit for migrator.

  4. Admin revokes MIGRATOR_ROLE from migrator.

  5. User tries to disable the permit.

Code

Git Url: https://github.com/breakAIDev/fork-staking-poc.git

Result

Script ran successfully.

Gas used: 5623713

Was this helpful?