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

CipherHawk - Pauser cannot halt contract operations during emergencies #233

Open
sherlock-admin4 opened this issue Nov 13, 2024 · 0 comments

Comments

@sherlock-admin4
Copy link

sherlock-admin4 commented Nov 13, 2024

CipherHawk

High

Pauser cannot halt contract operations during emergencies

Summary

The Stablecoin.sol contract does not implement an emergency stop (circuit breaker) mechanism. This will prevent administrators from halting critical functionalities in case of a discovered vulnerability or unforeseen issue, allowing potential exploits to persist and cause damage.

Root Cause: In Stablecoin.sol, while the contract includes role-based access controls, it lacks integration with OpenZeppelin's Pausable contract or a similar emergency stop mechanism to allow pausing of sensitive functions.

https://github.com/sherlock-audit/2024-11-telcoin/blob/main/telcoin-audit/contracts/stablecoin/Stablecoin.sol#L19
Internal pre-conditions:

  1. A vulnerability is discovered post-deployment.

  2. The contract's critical functions are under attack or behaving unexpectedly.

External pre-conditions:

  1. An admin needs to activate the emergency stop.

  2. The contract's state is in a compromised or unstable condition.

Attack Path:

  1. A vulnerability is exploited, allowing unauthorized actions like minting or transferring tokens.

  2. Without an emergency stop, administrators cannot halt operations to prevent further exploitation.

  3. The attacker continues exploiting the vulnerability, leading to significant financial losses.

Impact:

Unmitigated Exploits: Vulnerabilities can be exploited continuously without administrative intervention.

Financial Losses: Ongoing attacks can drain funds, manipulate token supply, or disrupt the contract's intended functionalities.

Loss of User Trust: Inability to respond to emergencies can erode user confidence and deter participation in the ecosystem.

Mitigation:

Implement Pausable Mechanism: Integrate OpenZeppelin's PausableUpgradeable into the contract, allowing authorized roles to pause and unpause critical functions during emergencies.

import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

contract Stablecoin is ERC20PermitUpgradeable, Blacklist, PausableUpgradeable {
// Initialize Pausable in the initializer
function initialize(...) external initializer {
...
__Pausable_init();
}

// Add `whenNotPaused` and `whenPaused` modifiers to sensitive functions
function transfer(...) public whenNotPaused returns (bool) {
    ...
}

// Define pause and unpause functions
function pause() external onlyRole(PAUSER_ROLE) {
    _pause();
}

function unpause() external onlyRole(PAUSER_ROLE) {
    _unpause();
}

}

Define Clear Protocols: Establish and document procedures for activating and deactivating the emergency stop, ensuring rapid response to critical issues.

Regular Drills: Conduct simulated emergency scenarios to ensure that the pause mechanism functions correctly and that administrators are prepared to act swiftly.

Root Cause

.

Internal pre-conditions

.

External pre-conditions

.

Attack Path

.

Impact

.

PoC

No response

Mitigation

No response

@sherlock-admin3 sherlock-admin3 changed the title Handsome Sandstone Cottonmouth - Pauser cannot halt contract operations during emergencies CipherHawk - Pauser cannot halt contract operations during emergencies Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant