Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Selfdestruct Eip6780

ASecurity

Detect selfdestruct misuse and EIP-6780 implications post-Cancun — bricked contracts, broken `assert(balance == X)` invariants, factory patterns relying on redeploy, deployment-tx-only selfdestruct corner cases. Activate on `selfdestruct`, `suicide`, `CREATE2` factories, contracts asserting on `address(this).balance`.

36 stars
0 votes
0 copies
0 views
Added 10/4/2026
blockchaingitsecurity

Security Analysis

A100/100

Scanned 10/4/2026

$npx -y skills add iktok90-design/ai-smart-contract-auditor --skill selfdestruct-eip6780 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Selfdestruct Eip6780?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Selfdestruct Eip6780
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/iktok90-design-selfdestruct-eip6780/badge)](https://www.skillsdirectory.com/skills/iktok90-design-selfdestruct-eip6780)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: selfdestruct-eip6780
description: Detect selfdestruct misuse and EIP-6780 implications post-Cancun — bricked contracts, broken `assert(balance == X)` invariants, factory patterns relying on redeploy, deployment-tx-only selfdestruct corner cases. Activate on `selfdestruct`, `suicide`, `CREATE2` factories, contracts asserting on `address(this).balance`.
---

# selfdestruct / EIP-6780 detection

## EIP-6780 background

After Cancun (March 2024), `selfdestruct` no longer deletes the contract's code or storage *unless* called in the same transaction as the contract's deployment. It does still transfer all ether to the recipient. This changes the security model substantially:

- Pre-6780: any `selfdestruct` could brick a contract → many DoS attacks.
- Post-6780: `selfdestruct` outside the deploy-tx only forwards ether. Code/storage survives.

## When this applies

- Any `selfdestruct` call
- Contracts that assert `address(this).balance == X` (someone can force-add ether via `selfdestruct`)
- `CREATE2` factories relying on redeploy at same address (now broken — code persists)
- Diamonds / proxies with implementation-side selfdestruct
- Pre-Cancun deployed contracts (legacy semantics still apply at runtime)

## Detection patterns

### Forced-ether DoS on balance-equality assumption (HIGH — still relevant)
```solidity
require(address(this).balance == expected);   // ← attacker can `selfdestruct` ether to break this
```
Track expected balance in a state variable, not via `address(this).balance`.

### CREATE2 redeploy pattern broken (HIGH)
```solidity
// Pattern: deploy logic to deterministic addr, selfdestruct to "upgrade", redeploy.
// ← Post-6780, code persists. Redeploy at same address fails or reverts.
```
Migrate to true proxy patterns.

### selfdestruct in deploy-tx (still has full power) (HIGH)
A constructor that selfdestructs in the deploy tx truly deletes code+storage. Some "metamorphic" tricks abuse this.

### Library / facet with selfdestruct path reachable (HIGH)
Pre-6780-deployed diamond facets with selfdestruct paths remain dangerous. Even post-6780, a facet selfdestruct that orphans ether still costs.

### selfdestruct sending ether to known-revert recipient (LOW)
Selfdestruct still forwards ether — recipient cannot revert on receive (selfdestruct bypasses fallback). So this isn't a DoS for the destructor, but can leave the recipient with unexpected balance.

### Recovery via selfdestruct on stuck-fund contract (LOW-MEDIUM)
Sometimes a useful pattern — note intent.

## Severity rubric

| Pattern | Severity |
|---|---|
| `address(this).balance == X` invariant | **High** |
| Public `selfdestruct` path on deployed contract | **High** |
| CREATE2 redeploy/upgrade pattern (post-Cancun broken) | **High** |
| Diamond facet selfdestruct reachable | **High** |
| Constructor metamorphic selfdestruct | **High** *(may be intentional, document)* |
| `selfdestruct` to known revert-on-receive recipient | **Low** |
| `selfdestruct` as legitimate recovery, properly guarded | **Info** |

## Remediation patterns

- Don't use `address(this).balance` as part of any invariant. Track received ether explicitly.
- Migrate metamorphic / CREATE2-redeploy patterns to standard proxies (UUPS / Transparent).
- Remove `selfdestruct` from production contracts unless absolutely needed.
- If retained, guard heavily (multi-sig + timelock).

## False-positive notes

- A contract using `selfdestruct` only in a test-helper or migration script → not deployable, ignore.
- `selfdestruct` whose recipient is the contract's own address — does nothing useful, comment as code smell.

## Related

- [[delegatecall-risks]]
- [[dos-vectors]]
- [[access-control]]

Attribution

iktok90-designiktok90-design
View sourceSee grades on GitHubMore from iktok90-design →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Nft Standards

Implement NFT standards (ERC-721, ERC-1155) with proper metadata handling, minting strategies, and marketplace integration. Use when creating NFT contracts, building NFT marketplaces, or implementing digital asset systems.

458250 votes

Nft Standards

Implement NFT standards (ERC-721, ERC-1155) with proper metadata handling, minting strategies, and marketplace integration. Use when creating NFT contracts, building NFT marketplaces, or implementing digital asset systems.

401990 votes

vyper-compiler

Vyper smart contract compiler internals. Use when working on the Vyper compiler codebase — compilation pipeline, Venom IR, semantic analysis, code generation, testing, or contributing. Triggers on vyper compiler development, Venom passes, AST/semantics changes, codegen work, or test writing.

51840 votes

Flash Loan Simulator

Simulate flash loan arbitrage strategies and profitability across DeFi protocols. Use when performing crypto analysis. Trigger with phrases like "analyze crypto", "check blockchain", or "monitor market".

27190 votes

On Chain Analytics

Perform on-chain analysis including whale tracking, token flows, and network activity. Use when performing crypto analysis. Trigger with phrases like "analyze crypto", "check blockchain", or "monitor market".

27190 votes
View all in blockchain →