In the BaseGauge contract, the functions stake and withdraw allow users to deposit and remove tokens from the gauge, respectively. These functions play a crucial role in updating user balances, total staked amounts, and reward calculations. However, both functions are missing the whenNotPaused modifier. The absence of this modifier means that even if the contract is paused—a state used to halt operations during emergencies—users can continue to stake and withdraw tokens. This oversight bypasses an important security control, potentially enabling uncontrolled token movements during critical conditions and undermining the protocol’s emergency safeguards.
Intended Behavior:
In a pausable contract, operations that modify critical state (e.g., staking and withdrawal) must be disabled when the system is paused to prevent undesired interactions during emergencies. The whenNotPaused modifier is used to enforce this behavior.
Current Implementation:
The stake and withdraw functions in the BaseGauge contract use the nonReentrant and updateReward modifiers but omit the whenNotPaused modifier. As a result, these functions remain callable even when the contract is paused.
Stake Function:
Issue:
The function does not include whenNotPaused. Therefore, staking can occur regardless of the contract’s paused state.
Withdraw Function:
Issue:
Similarly, the withdrawal function does not include whenNotPaused, enabling token withdrawals even when operations should be halted.
Bypassing Emergency Controls:
Without the whenNotPaused modifier, the contract’s pause mechanism is rendered ineffective for these functions. This permits users to move tokens even in emergency situations when the protocol should be in a secure, halted state.
Risk of Exploitation:
Attackers might exploit this flaw during periods of instability or emergency to manipulate token balances, potentially draining the system or interfering with reward and governance calculations.
Protocol Integrity:
Uncontrolled staking and withdrawal operations during a pause can lead to unexpected changes in user balances and the overall state of the gauge, potentially destabilizing reward distribution and governance mechanisms.
Uncontrolled Token Movements:
Staking and withdrawal operations can occur during emergency conditions, leading to unanticipated asset flows.
Security Risk:
Attackers might exploit this oversight to manipulate token balances, bypassing emergency protocols intended to protect the system.
Governance and Economic Distortion:
Unrestricted token movements during a pause could affect reward calculations and governance weight, destabilizing the protocol's economic incentives.
Loss of Trust:
The inability to enforce pause conditions on critical functions can undermine confidence in the protocol’s emergency mechanisms and overall security.
Manual Review
To secure the BaseGauge contract during emergency pauses, add the whenNotPaused modifier to both the stake and withdraw functions.
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.