Skip to content

Latest commit

 

History

History
45 lines (27 loc) · 1.22 KB

File metadata and controls

45 lines (27 loc) · 1.22 KB

Fast Khaki Raccoon

Medium

Incorrect modifier results in the inability to set a staked user restriction

Summary

Incorrect modifier results in the inability to set a staked user restriction

Root Cause

Upon calling StakingPoolToken.setStakeUserRestriction() to set a user restriction, we use this modifier:

    modifier onlyRestricted() {
        require(_msgSender() == stakeUserRestriction, "R");
        _;
    }

The issue is that if a restriction hasn't been set in the first place or has been removed, then this will always revert as the msg.sender can not be address(0) which is the stakeUserRestriction value if it hasn't been set.

Internal Pre-conditions

No response

External Pre-conditions

No response

Attack Path

  1. The staked user restriction is removed or hasn't been set in the first place
  2. There is no way to ever set it again in the future, resulting in a completely broken functionality

Impact

Broken functionality rendering the staked user restriction mechanism completely useless. If a restriction must be set, then it will be impossible.

PoC

No response

Mitigation

Change the modifier to a different one, possibly add the ability for the owner to set it