iktok90-design/ai-smart-contract-auditor/selfdestruct-eip6780

Claude Code and agent skill by iktok90-design/ai-smart-contract-auditor

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

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`.

Install

npx vskill@latest install iktok90-design/ai-smart-contract-auditor/selfdestruct-eip6780

SKILL.md

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

PatternSeverity
address(this).balance == X invariantHigh
Public selfdestruct path on deployed contractHigh
CREATE2 redeploy/upgrade pattern (post-Cancun broken)High
Diamond facet selfdestruct reachableHigh
Constructor metamorphic selfdestructHigh (may be intentional, document)
selfdestruct to known revert-on-receive recipientLow
selfdestruct as legitimate recovery, properly guardedInfo

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]]

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
37
Repository forks
5
7-day trend score
18

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/iktok90-design/ai-smart-contract-auditor/selfdestruct-eip6780/badge)](https://verified-skill.com/skills/iktok90-design/ai-smart-contract-auditor/selfdestruct-eip6780)

Something wrong with this skill or its page? Tell us.