Description:
Staking and withdrawal functions are critical components of a contract’s security, especially in emergency scenarios. If the contract is compromised (e.g., hacked or exploited), it is crucial to immediately halt staking and withdrawal to prevent further loss of funds.
While BaseGauge.sol includes an setEmergencyPaused function to toggle the emergency pause state, this modifier is not applied to the stake and withdraw functions. As a result, even if an emergency pause is triggered, users—including attackers—can still stake or withdraw funds, rendering the emergency mechanism ineffective.
Impact:
In the event of an exploit or malicious activity, the protocol's administrators may attempt to activate setEmergencyPaused to stop unauthorized fund movements. However, since stake and withdraw do not respect the paused state, attackers can continue withdrawing or moving assets, potentially leading to significant financial losses.
A hacker gains unauthorized access and begins withdrawing large amounts of protocol funds.
The EMERGENCY_ADMIN detects the exploit and activates setEmergencyPaused.
Despite this, the hacker continues withdrawing or staking funds, since these functions lack the emergency pause restriction.
Proof of Concept:
The stake and withdraw functions lack the emergency pause modifier, allowing them to function even when the contract is paused:
Meanwhile, the pause function exists but is not enforced in stake/withdraw:
Recommended Mitigation:
To ensure proper security in emergency scenarios, apply the whenNotPaused modifier to both stake and withdraw functions. This will prevent users—including potential attackers—from performing these actions when the contract is paused.
Tools Used:
Manual Review
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.