User cannot revoke migration permit after migrator role is revoked
The setMigrationPermit function requires the target migrator to hold MIGRATOR_ROLE even when a user is revoking a permit. If an admin revokes the migrator role, users can no longer revoke their previously granted permits, and a stale permit remains that could be used if the role is later re-granted.
Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
The setMigrationPermit function enforces that the target address must currently hold MIGRATOR_ROLE for both granting and revoking permits. This means if an admin revokes a migrator's role, any user who previously granted that migrator a permit is permanently unable to revoke it, breaking the protocol's explicit documentation guarantee.
The migrator must hold the MIGRATOR_ROLE in the staking contract. The permission can be revoked at any time by calling setMigrationPermit(migratorAddress, false).
Vulnerability Details
setMigrationPermit checks the migrator role unconditionally:
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 role check makes sense when granting a permit. You don't want users granting permits to random addresses. But when revoking, the check is unnecessary and harmful. If the admin revokes MIGRATOR_ROLE from a migrator, any user attempting to call setMigrationPermit(migrator, false) will revert with MigratorNotFound.
The protocol documentation explicitly states:
"The permission can be revoked at any time by calling setMigrationPermit(migratorAddress, false)."
Impact Details
The stale true permit persists in migrationPermits[migrator][user] mapping. If the admin ever re-grants MIGRATOR_ROLE to the same migrator address, that migrator can immediately call migratePositionsFrom(user) and migrate the user's positions, without the user's current consent, since they were unable to revoke during the window when the role was inactive.
References
Add any relevant links to documentation or code
Proof of Concept
Paste the following code snippet to staking.t.sol:
The original report as published on Immunefi, by hcrlen. 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.
Generating the AI write-up for this report.
This usually takes about 40 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
The role check in setMigrationPermit is applied unconditionally, including when revoking a permit, so revoking fails if the migrator no longer has the role.
Impact
The stale permit persists and could allow the migrator to migrate the user's positions without current consent if the admin later re-grants the role.
What the attacker needed
User has granted a migration permit; admin revokes migrator role; admin later re-grants role
The fix
The role check should only be enforced when granting a permit, not when revoking it.
How it was found
Alice stakes tokens and grants a migration permit to the migrator.
The admin revokes the MIGRATOR_ROLE from the migrator.
Alice tries to revoke her permit by calling setMigrationPermit with false.
The call reverts with MigratorNotFound, leaving the permit in place.
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.
Generating the AI write-up for this report.
This usually takes about 40 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
A user can give a special contract (a migrator) permission to move their staked positions. The code checks that the migrator is authorised even when the user tries to take that permission away. If an admin removes the migrator's authorisation, the user can no longer cancel their permission, so it stays active in the system.
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.
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.