Users are unable to revoke migration permits for deprecated or demoted migrators
The Staking contract's setMigrationPermit function requires the target migrator to currently hold the MIGRATOR_ROLE, so once an admin revokes that role from a deprecated migrator, users can no longer clear their existing approval for that address. An attacker cannot directly exploit this, but users are stuck with a stale permission that they cannot revoke.
- Disclosed after under an hour
69717 sc low users are unable to revoke migration permits for deprecated or demoted migrators
Submitted on Mar 16th 2026 at 13:16:19 UTC by @OxAnmol for Audit Comp | Folks Finance: Staking Contracts
- Report ID: #69717
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/Folks-Finance/folks-staking-contracts/blob/main/src/Staking.sol
- Impacts:
Description
Brief/Intro
The Staking contract allows users to approve specific migrator addresses to move their funds via setMigrationPermit(). However, the function enforces that the target address currently holds the MIGRATOR_ROLE. If a migrator is deprecated and has its role revoked by the admin, users are permanently blocked from revoking their approval for that specific migrator.
Vulnerability Details
In Staking.sol, the setMigrationPermit function includes a strict access control check on the target migrator address before updating the user's permit state:
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);
}
If an active migrator is deprecated (maybe, if it experiences a security incident?), the protocol admin will naturally revoke its MIGRATOR_ROLE.
If a user wanted to delist such a migrator by manually clearing their approval (_isMigrationPermitted = false) for the now-defunct migrator, the transaction will revert because hasRole(MIGRATOR_ROLE, _migrator) evaluates to false. This forcibly locks the user's storage state into an approved status for a deprecated address.
Impact Details
While the immediate risk is low because a demoted migrator cannot call migratePositionsFrom() anyway, this breaks the expected allowance flow. Users should always retain their ability to revoke permissions to migrators, regardless of that migrator's current standing with the protocol admin.
Proof of Concept
Add the following to the Staking.t.sol:
function test_Migration_RevertWhen_DemotedMigratorRevokePermit() public {
// 1. Alice grants permission to the active migrator
vm.prank(alice);
staking.setMigrationPermit(migrator, true);
assertEq(staking.migrationPermits(migrator, alice), true);
// 2. Admin revokes the MIGRATOR_ROLE from the migrator due to deprecation/compromise
vm.prank(admin);
staking.revokeRole(keccak256("MIGRATOR"), migrator);
assertEq(staking.hasRole(keccak256("MIGRATOR"), migrator), false);
// 3. Alice tries to practice good hygiene and revoke her permission for the deprecated migrator
// However, the transaction reverts because the target is no longer a migrator!
vm.prank(alice);
vm.expectRevert(abi.encodeWithSelector(IStakingV1.MigratorNotFound.selector, migrator));
staking.setMigrationPermit(migrator, false);
// As a result, the obsolete migrator is still permanently marked as "permitted" by Alice
assertEq(staking.migrationPermits(migrator, alice), true);
}
Recommendation:
Modify the function so that the MIGRATOR_ROLE check is only enforced when a user is granting permission, allowing users to freely revoke permission from any address at any time.
function setMigrationPermit(address _migrator, bool _isMigrationPermitted) external {
- if (!hasRole(MIGRATOR_ROLE, _migrator)) revert MigratorNotFound(_migrator);
+ if (_isMigrationPermitted && !hasRole(MIGRATOR_ROLE, _migrator)) revert MigratorNotFound(_migrator);
migrationPermits[_migrator][msg.sender] = _isMigrationPermitted;
emit MigrationPermitUpdated(_migrator, msg.sender, _isMigrationPermitted);
}
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 target migrator has MIGRATOR_ROLE for both granting and revoking a permit, instead of only checking when granting.
Impact
The immediate risk is low because a demoted migrator cannot call migratePositionsFrom anyway, but users cannot revoke a stale permission, which breaks the expected allowance flow.
What the attacker needed
User has previously granted a migration permit; admin revokes the migrator's role
The fix
The role check should only be enforced when granting permission, so users can always revoke permission from any address.
How it was found
- Alice grants permission to the active migrator.
- Admin revokes the MIGRATOR_ROLE from the migrator.
- Alice tries to revoke her permission for the deprecated migrator.
- The transaction reverts with MigratorNotFound, leaving the permit set to true.
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 staked funds. The contract only lets a user change that permission if the migrator still has a special admin-granted role. If the admin removes that role, the user can no longer turn the permission off, even though they should always be able to say no.
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.