Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of Circuit Breaker in the smart contracts #14

Closed
0xM3R opened this issue Dec 11, 2024 · 1 comment · Fixed by #27 or #6
Closed

Lack of Circuit Breaker in the smart contracts #14

0xM3R opened this issue Dec 11, 2024 · 1 comment · Fixed by #27 or #6
Assignees
Labels

Comments

@0xM3R
Copy link

0xM3R commented Dec 11, 2024

Vulnerability Details

The contract lacks a mechanism to pause operations during emergencies or detected exploits. This limits the ability to respond to incidents and mitigate damage.

Analysis

How It Can Be Harmful

  • Uncontrolled Exploits: Attackers can continue exploiting vulnerabilities until the contract is manually upgraded.
  • Loss of Funds: Without the ability to pause operations, damage can quickly escalate.

How to Mitigate the Issue

  1. Integrate OpenZeppelin’s Pausable Contract:
    Use the Pausable library to add pause and unpause functions:
    import "@openzeppelin/contracts/security/Pausable.sol";
    
    contract UniversalNFT is Pausable {
        function transferCrossChain(...) external whenNotPaused {
            ...
        }
    
        function pause() external onlyOwner {
            _pause();
        }
    
        function unpause() external onlyOwner {
            _unpause();
        }
    }
  2. Restrict Access to Pause Functions:
    Ensure only authorized accounts (e.g., owner or admin) can pause or unpause the contract.

References:

  • SWC-112: Missing Emergency Stop: Highlights the risks of not having an emergency stop mechanism in smart contracts.
  • OpenZeppelin Pausable Contract Documentation: Provides details on implementing a circuit breaker using the Pausable modifier.
  • Parity Multisig Wallet Hack (2017): Demonstrates the need for circuit breakers to quickly mitigate damage during exploits.
@0xM3R
Copy link
Author

0xM3R commented Dec 11, 2024

@0xM3R 0xM3R added the Security label Dec 11, 2024
@0xM3R 0xM3R transferred this issue from another repository Dec 17, 2024
@0xM3R 0xM3R transferred this issue from zeta-chain/smart-contract-vulns Dec 17, 2024
@fadeev fadeev closed this as completed in #6 Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants