Skip to content
Access control Audit finding Beginner

pause/unpause functionalities not implemented in many pausable contracts

Several contracts inherit from a pausable base but never expose external pause and unpause functions, so the emergency stop can never be triggered. An attacker cannot directly exploit this, but the intended safety mechanism is unavailable when needed.

Aymen0909 Follow with LaScaloneta, tallo and 13 others

Originally disclosed on Code4rena

Submitted by Aymen0909, also found by LaScaloneta, tallo, martin, bin2chen, jaraxxus, josephdara, djxploit, SovaSlava, SovaSlava, SovaSlava, ChrisTina, T1MOH, NoamYakov, NoamYakov, and Deps

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/SocializingPool.sol#L21 https://github.com/code-423n4/2023-06-stader/blob/main/contracts/Auction.sol#L14 https://github.com/code-423n4/2023-06-stader/blob/main/contracts/StaderOracle.sol#L17 https://github.com/code-423n4/2023-06-stader/blob/main/contracts/OperatorRewardsCollector.sol#L16

The following contracts: SocializingPool, StaderOracle, OperatorRewardsCollector and Auction are supposed to be pausable (as they all inherit from PausableUpgradeable), but they don’t implement the external pause/unpause functionalities which means it will never be possible to pause them.

Proof of Concept

All the following contracts SocializingPool, StaderOracle, OperatorRewardsCollector and Auction inherit from the openzeppelin PausableUpgradeable extension which means that they contain internal functions _pause and _unpause.

Because those functions are internal, the contract must implement two other public/external pause and unpause functions to allow the manager to pause and unpause the contracts when necessary. None of the aforementioned contracts implement those functions, which means even if those contracts are supposed to be pausable (and have the pause/unpause functionalities), none of them can be paused.

Recommended Mitigation Steps

Add public/external pause and unpause functions in the aforementioned contracts to allow them to be pausable, this can be done as in the UserWithdrawalManager contract. For example:

/**
 * @dev Triggers stopped state.
 * Contract must not be paused
 */
function pause() external {
    UtilLib.onlyManagerRole(msg.sender, staderConfig);
    _pause();
}

/**
 * @dev Returns to normal state.
 * Contract must be paused
 */
function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {
    _unpause();
}

Picodes (judge) decreased severity to Medium

manoj9april (Stader) confirmed and commented:

Thanks! We will fix this.

sanjay-staderlabs (Stader) commented:

This is fixed.


The original report as published on Code4rena, by Aymen0909. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 contracts inherit internal pause and unpause functions but never add public wrappers with access control to call them.

Impact

The contracts cannot be paused in an emergency, so the intended safety mechanism is unavailable; the text does not claim direct loss of funds.

What the attacker needed

None

The fix

Public or external pause and unpause functions with proper role checks should be added, as done in another contract in the same project; the project later said this was fixed.

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 pausable contract is meant to have a switch that lets the owner stop it in an emergency. Here the switch exists inside the code but no button was wired to it, so nobody can actually flip it. This is a missing safety feature rather than a direct way for an attacker to steal funds.

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.

More by Aymen0909

View all

22 more disclosed reports, best first.

More from Stader Labs

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.