Beginner FriendlyFoundryDeFiOracle
100 EXP
View results
Submission Details
Severity: low
Invalid

lack of protection against self-destruct

Summary

Lack of protection against self-destruct calls in the contract. Implementing a circuit breaker or emergency stop mechanism is what one recommended to mitigate this risk.

Vulnerability Details

The contract does not have a self-destruct protection mechanism. This means that anyone who has the required permissions could trigger the self-destruct function, rendering the contract inoperable. A circuit breaker or an emergency stop mechanism should be implemented to prevent such self-destruct calls.

Impact

The absence of self-destruct protection can lead to the following consequences:

  • Unauthorized users or attackers could intentionally destroy the contract.

  • Funds held in the contract may become inaccessible if self-destruct is accidentally or maliciously invoked.

Tools Used

Manual / VsCode

Recommendations

It is strongly recommended to implement a circuit breaker or an emergency stop mechanism to safeguard the contract against self-destruct actions. This can be achieved by adding a function that allows authorized parties to disable specific functions or pause the entire contract temporarily. Below is an example of an emergency stop mechanism:

contract ThunderLoanUpgraded is Initializable, OwnableUpgradeable, UUPSUpgradeable, OracleUpgradeable {
// Other contract code...
bool public emergencyStopped;
modifier notEmergencyStopped() {
require(!emergencyStopped, "Emergency stop is active");
_;
}
function toggleEmergencyStop() external onlyOwner {
emergencyStopped = !emergencyStopped;
}
// Use the notEmergencyStopped modifier in functions you want to pause during emergencies.
}

The toggleEmergencyStop function allows the owner to enable or disable the emergency stop mechanism. The notEmergencyStopped modifier ensures that certain functions are only callable when the contract is not in emergency stop mode. This provides control and security against potential issues, including self-destruct.

Implementing such an emergency stop mechanism enhances the contract's safety by allowing temporary pauses, thereby preventing unauthorized or accidental self-destruct actions. This helps ensure that the contract remains operable and secure even in challenging situations.

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Admin Input/call validation

Support

FAQs

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