StakingRewards.sol#stake is intended to be pausable but isn’t
The StakingRewards contract inherits a pausable base but never exposes any external function to pause or unpause it, so the whenNotPaused modifier on stake has no effect. An attacker could continue staking even when the owner intends to pause the contract.
Submitted by 0x52
Staking is unable to be paused as intended.
Proof of Concept
StakingRewards.sol inherits pausable and implements the whenNotPaused modifier on stake, but doesn’t implement any method to actually pause or unpause the contract. Pausable.sol only implements internal functions, which requires external or public functions to be implemented to wrap them. Since nothing like this has been implemented, the entire pausing system is rendered useless and staking cannot be paused as is intended.
Recommended Mitigation Steps
Create simple external pause and unpause functions that can be called by owner.
MiguelBits (Y2K Finance) disputed
Great catch!
While the contract is taken from Synthetix’s StakingRewards; note that they use a different version of Pausable that comes with a
setPaused()function. This is notably absent from OZ’s implementation; one has to have the pause and unpause function explicitly created.
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 contract uses a pausable base that only provides internal pause/unpause functions, and no external wrapper functions were added to expose them.
Impact
Staking cannot be paused as intended, so the owner cannot stop staking when needed.
What the attacker needed
Owner intends to pause staking
The fix
Add external pause and unpause functions callable by the owner.
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 contract is meant to have a pause button so the owner can stop staking in an emergency. The code includes a check that should block staking when paused, but there is no actual button to set the paused state. So the check never triggers and staking can never be stopped.
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.