DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: high
Invalid

Lack of pause mechanism in StrategyOp contract

Summary

The StrategyOp contract, despite inheriting from BaseStrategy, lacks a crucial pause mechanism. This absence of a pause functionality poses a significant risk to the contract's ability to halt operations in case of emergencies or detected vulnerabilities. While the contract inherits from BaseStrategy, neither contract implements a pause feature, leaving the strategy potentially vulnerable in critical situations.

Vulnerability Details

The StrategyOp contract does not implement any form of pause mechanism.

  1. No boolean state variable to track the paused state.

  2. Absence of pause() and unpause() functions.

  3. No modifiers to check for a paused state before executing critical functions.

  4. The inherited BaseStrategy contract also lacks a pause mechanism.

  5. An _emergencyWithdraw function is present but commented out and unimplemented.

Critical functions like _deployFunds, claimAndSwap, and _freeFunds can be called without any checks for a paused state, potentially allowing operations to continue even in emergency situations.

Impact

Without a pause mechanism there could be severe consequences:

  1. Inability to quickly halt contract operations in case of detected vulnerabilities.

  2. Potential loss of funds if a bug is exploited before manual interventions can be made.

  3. Reduced ability to manage and mitigate risks in real-time.

  4. Complications in performing upgrades or maintenance on the contract.

Tools Used

Manual review.

Recommendations

Implement a pause mechanism in the StrategyOp contract:

  • Add a boolean state variable: bool public paused;

  • Implement pause() and unpause() functions:

    function pause() external onlyManagement {
    paused = true;
    }
    function unpause() external onlyManagement {
    paused = false;
    }
  • Create a modifier to check the paused state:

    modifier whenNotPaused() {
    require(!paused, "Contract is paused");
    _;
    }
  • Apply the whenNotPaused modifier to all critical functions.

Implement the _emergencyWithdraw function to allow for fund withdrawal in emergencies.

Add events to log pause and unpause actions for better transparency and monitoring.

Consider implementing a time-lock mechanism for unpausing to provide a window for users to react to the contract being unpaused.

Ensure that the pause mechanism is thoroughly tested, including its interaction with other contract functionalities.

Updates

Appeal created

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.