/auditsentry:diamond-eip2535from auditsentry
Detects EIP-2535 Diamond Standard vulnerabilities including facet selector collisions, storage namespace collisions, init-vs-upgrade confusion, diamondCut access control issues, facet selfdestruct risks, and missing Loupe support.
Ships in auditsentry. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Two facets implementing the same 4-byte selector (e.g. function foo() and function bar(uint256) that hash to the same selector). Diamond routes to the last-cut facet, but during a cut, the old version may be reachable.
Two facets using the same bytes32 STORAGE_POSITION slot prefix.
library LibA { bytes32 constant POS = keccak256("auditsentry.a"); }
library LibB { bytes32 constant POS = keccak256("auditsentry.a"); } // ← collision
Use unique namespace strings per facet.
Diamond init runs once via delegatecall to an Init contract. Re-running init after diamond-cut → can re-initialize values or run dangerous code. See [[initialization]].
diamondCut access control (CRITICAL)function diamondCut(FacetCut[] calldata cuts, address init, bytes calldata data) external {
// ← no owner check
}
Anyone can add/remove/replace facets.
Facet contract removed from blockchain (selfdestructed pre-6780, or simply deauthorized), but selectors still point to the old address → reverts.
A malicious facet replacement can hijack the entire diamond. Centralization risk depends on diamondCut authority.
Pre-Cancun: a facet calling selfdestruct deletes itself, breaking the diamond.
Post-Cancun (EIP-6780): only delete-in-deploy-tx. Existing facets still risky if deployed before. See [[selfdestruct-eip6780]].
IDiamondLoupe (MEDIUM)Without Loupe, off-chain consumers can't introspect facets. Soft requirement.
Internal functions in a facet aren't callable through the diamond (only externals are routed). Devs sometimes mistake the contracts.
init delegate-call during diamond-cut can reenter. Lock during cut.
If multiple facets share a storage struct, modifying struct fields requires coordinated upgrades. Refactoring one facet's view of the struct breaks others.
| Pattern | Severity |
|---|---|
diamondCut lacks owner check | Critical |
| Selector collision (or missed verification) | Critical |
| Storage namespace collision | Critical |
| Init function callable post-deploy | High |
| Removing facet leaves dangling selectors | High |
| Facet selfdestruct path (pre-6780 deploy) | High |
| Missing Loupe | Medium |
| Internal function mis-exposed | Medium |
diamondCut with a Timelock and a CI check that runs diamondCut --dry-run.keccak256("<unique-app-name>.<facet-name>").LibDiamond.diamondCut, never directly.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub iktok90-design/ai-smart-contract-auditor --plugin auditsentry45 skills in this plugin
/access-controlDetect missing or incorrect access control — missing modifiers, wrong role checks, privileged function exposure, public initializers, and role-escalation paths. Activate on any function that mutates state, transfers funds, mints tokens, sets admin parameters, upgrades implementations, or pauses/unpauses./approval-issuesDetect ERC-20 approval pitfalls — approve race (front-run), missing safeApprove, infinite approvals, approval-without-revoke, Permit2 misuse, max-approval to untrusted contracts. Activate on `approve`, `safeApprove`, `permit`, `forceApprove`, `Permit2`, `IERC20.allowance`./caching-and-incrementalAlways-on meta-skill — cache audit results per file by content hash so unchanged files aren't re-analyzed on subsequent runs. Activate on every /audit, /quick-scan, /audit-changes invocation./centralization-riskDetect centralization and trust-assumption risks — admin powers, single-key risk, missing timelocks, upgrade authority, treasury keys, pause permanence, blacklisting authority, oracle authority. Activate on `onlyOwner`, `onlyRole`, `AccessControl`, upgrade authorizations, pause/unpause functions, mint/burn caps, treasury/fee setters./confidence-scoringAlways-on meta-skill — for every finding produced, attach a confidence level (HIGH/MEDIUM/LOW) and a reasoning trace. Activate on every /audit, /audit-deep, /audit-changes, /audit-live, /quick-scan invocation./cosmwasmDetect bug classes specific to CosmWasm (Rust) contracts — missing info.sender authorization in execute handlers, unbounded map iteration → gas/DoS, reply/submessage reply_id confusion, migrate admin backdoors, addr_validate vs raw string addresses, unchecked info.funds, Uint128 overflow, query reentrancy, and migration/version state. Activate on any `.rs` file with `use cosmwasm_std`, `#[entry_point]`, `ExecuteMsg`, `InstantiateMsg`, `QueryMsg`, `cw_storage_plus`, or `DepsMut`.Other plugins' skills for the same job