Blocklisted or paused state in staking token can prevent service owner from unstaking
The staking contract sends accumulated rewards to the service's multisig address during unstaking. If that address is blocklisted by the reward token or the token pauses transfers, the reward transfer fails and the entire unstake transaction reverts, preventing the owner from retrieving the service.
EV_om Follow with ArsenLupin
Originally disclosed on Code4rena
Submitted by EV_om, also found by ArsenLupin
The StakingBase contract allows service owners to stake their service by transferring it to the contract via stake(). The service’s multisig address is set in the ServiceInfo struct at this point and cannot be modified afterward. When the owner wants to unstake the service via unstake(), the contract attempts to transfer any accumulated rewards to this multisig address:
File: StakingBase.sol
862: // Transfer the service back to the owner
863: // Note that the reentrancy is not possible due to the ServiceInfo struct being deleted
864: IService(serviceRegistry).safeTransferFrom(address(this), msg.sender, serviceId);
865:
866: // Transfer accumulated rewards to the service multisig
867: if (reward > 0) {
868: _withdraw(multisig, reward);
869: }
However, the protocol is meant to support reward tokens which may have a blocklist and/or pausable functionality.
If the multisig address gets blocklisted by the reward token at some point after staking or the reward token pauses transfers, the _withdraw() call in unstake() will fail. As a result, the service owner will not be able to unstake their service and retrieve it.
Impact
If a service’s multisig address gets blocklisted by the reward token after the service is staked, the service owner will be permanently unable to unstake the service and retrieve it from the StakingBase contract. The service will be stuck.
If the reward token pauses transfers, the owner will not be able to unstake the service until transfers are unpaused.
Additionally, the owner will not be able to claim rewards either, since these are sent to the multisig.
Proof of Concept
- Owner calls
stake()to stake their service, passing inserviceId. StakingBasecontract transfers the service NFT from owner and stores the service’s multisig address inServiceInfo.- Reward token blocklists the multisig address.
- Owner calls
unstake()to unstake the service and retrieve the NFT. unstake()attempts to transfer accumulated rewards to the now-blocklisted multisig via_withdraw().- The reward transfer fails, reverting the whole
unstake()transaction. - Owner is unable to ever unstake the service. Service is stuck in
StakingBasecontract.
Recommended Mitigation Steps
Consider implementing functionality to update the multisig address. This address should ideally be updated via the service registry to ensure it is properly deployed (seeing as it must match a specific bytecode), after which it can be updated in the staking contract by pulling it from the registry.
Alternatively and to also address the pausing scenario, unstaking could be split into two separate steps - first retrieve the service NFT, then withdraw any available rewards. This way, blocklisting or pausing would not prevent retrieval of the NFT itself.
Assessed type
Token-Transfer
kupermind (Olas) acknowledged and commented:
This is an interesting scenario. In this case
forcedunstake condition addition to the current unstake would be a better approach, as we are not able to change the multisig address.
Fixed.
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
Likely the unstake function combines returning the service NFT and transferring rewards in a single transaction, so a failure in the reward transfer reverts the entire unstake.
Impact
If the multisig is blocklisted, the service owner is permanently unable to unstake and retrieve the service; if the token pauses transfers, unstaking is blocked until transfers resume.
What the attacker needed
Service is staked; reward token blocklists multisig or pauses transfers
The fix
The unstake process should be split into two steps: first return the service NFT, then withdraw rewards separately, so that blocklisting or pausing does not prevent retrieval of the NFT.
How it was found
- Owner calls stake() to stake their service, passing in serviceId.
- StakingBase contract transfers the service NFT from owner and stores the service's multisig address in ServiceInfo.
- Reward token blocklists the multisig address.
- Owner calls unstake() to unstake the service and retrieve the NFT.
- unstake() attempts to transfer accumulated rewards to the now-blocklisted multisig via _withdraw().
- The reward transfer fails, reverting the whole unstake() transaction.
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.
When you stake a service, the contract holds your service and later sends any rewards to a separate wallet address. If that wallet is blocked by the reward token or the token temporarily stops all transfers, the reward payment fails. Because the whole unstake action is one transaction, the failure also stops you from getting your service back.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.