Diamond Proxy (EIP-2535) Security Audit

Diamond Proxy Audit — A diamond proxy audit is a security review of a contract system built on EIP-2535 (the Diamond Standard), where one proxy delegates calls to many implementation contracts called facets. It covers the shared storage model between facets, the function-selector routing table, the authority and initialisation logic of diamondCut, and the upgrade history of the diamond — the places where a diamond fails differently from a single-implementation proxy.

What a diamond proxy audit covers

A diamond is a proxy with a routing table. Every external call is matched by its four-byte selector to a facet, and the facet runs with delegatecall in the diamond's storage. That buys modularity and escapes the contract size limit, and it multiplies the ways an upgrade can go wrong: every facet writes to the same storage, every diamondCut can add, replace or remove dozens of selectors at once, and a single initialisation call runs arbitrary code with the diamond's full authority.

Our review starts from the live selector table rather than the repository. We reconstruct which facet answers which selector at the audited commit and on-chain, check every storage struct against every other facet that touches the same slot, and treat each diamondCut in the deployment and upgrade scripts as privileged code that needs its own review. Findings that can be exploited come with a Foundry proof of concept against a fork of the deployed diamond.

Vulnerability classes we look for

Storage collisions between facets

Two facets declaring state variables in normal slots, Diamond Storage structs whose namespace hashes collide or are reused, AppStorage structs reordered or extended in the middle across upgrades — all corrupting live balances silently.

Function selector clashes

Two functions with the same four-byte selector, a facet function shadowing a diamond or loupe function, and replace operations that route a selector to a facet with a different signature or semantics.

diamondCut authority

Who can call diamondCut, whether that role is a single EOA, timelocked or multisig, and whether any facet exposes a path to the cut function or to the ownership slot.

Unsafe initialisation via _init

The _init address and calldata passed with a cut execute by delegatecall with full authority: initialisers callable again later, init contracts that can be redeployed or self-destructed, and init logic that leaves storage half-migrated.

Dangerous facets

Facets containing delegatecall to user-supplied addresses, selfdestruct, or arbitrary call forwarding — any one of which turns into control of the whole diamond.

Loupe and routing correctness

facets(), facetFunctionSelectors(), facetAddresses() and facetAddress() that do not reflect the real routing table, breaking monitoring, verification and every tool that trusts them.

Immutable functions and removal

Functions declared immutable that can still be replaced or removed, and removals that strand assets or leave a facet reachable through an unremoved selector.

Cross-facet reentrancy and shared locks

A reentrancy guard implemented per facet instead of in shared storage, so a call into facet A can re-enter through facet B while state is inconsistent.

In scope

Not in scope unless agreed

How the engagement runs

  1. Scoping and threat modelling

    We fix a commit hash, agree the in-scope contracts and read your architecture docs, then build a threat model: who the actors are, what the trust boundaries are, and which invariants must never break. Nothing is reviewed against assumptions we have not written down.

  2. Manual review

    Line-by-line review by at least two auditors working independently, focused on authorisation, accounting, upgrade paths, external integrations and the gap between what the code does and what the documentation claims it does. Most critical findings come from this phase, not from tooling.

  3. Static and dynamic analysis

    Static analysers appropriate to the language, plus property-based fuzzing and invariant testing to push the system into states no unit test covers. Tooling is used to widen coverage, never to replace the manual pass.

  4. Exploit-path simulation

    Candidate findings are proven on a forked network with a working proof of concept. We report what an attacker can actually do and what it costs them, not a theoretical severity label.

  5. Reporting

    Every finding gets a severity rating, reproduction steps, the affected code, the impact in concrete terms and a specific remediation. You get a draft for discussion before anything is finalised.

  6. Fix review and re-test

    We re-test every remediation against the original proof of concept and check that the fix has not opened a new path. The final report is yours to publish.

What you receive

How we rate severity

SeverityWhat it means
CriticalDirect loss of funds or permanent freezing of assets, exploitable by any actor.
HighLoss of funds or protocol insolvency under realistic conditions, or requiring a privileged actor to misbehave.
MediumBroken protocol behaviour, denial of service, or value leakage that does not directly drain the contract.
LowEdge-case incorrectness with limited impact, or an issue requiring implausible preconditions.
InformationalCode quality, gas efficiency, documentation mismatch and defence-in-depth suggestions.

Pricing

Single token contract: starts from $999, report in 24–48 hours. dApp, GameFi or RWA project: starts from $2,999. DeFi protocol, L2 / rollup, Bridge, ZK circuit, AI agent / MCP: scoped per project after we have seen the code.

Diamond Proxy Audit: frequently asked questions

What is a diamond proxy?

A diamond is an EIP-2535 proxy contract that routes each function selector to one of many implementation contracts (facets) and executes it with delegatecall in the diamond's own storage. Facets can be added, replaced or removed through diamondCut, and loupe functions report the current routing table.

Are diamonds more dangerous than other proxies?

Not inherently, but they have more surface. Shared storage across many facets, a routing table that changes with every cut, and an initialisation call with full authority give more ways for an upgrade to corrupt state or hand over control.

What is the most common critical finding in a diamond?

Storage collisions introduced by an upgrade: a new facet or a reordered AppStorage struct writing over slots another facet relies on. They compile, they pass unit tests, and they corrupt live state the moment the cut executes.

Can you audit an upgrade to an already deployed diamond?

Yes, and it is the most valuable time to do it. We compare the proposed cut against the live selector table and storage layout, simulate it on a fork, and confirm nothing existing breaks before you execute it.

What do you need from us to start an audit?

A repository or contract address, a commit hash to freeze the scope, whatever architecture or spec documentation exists, and a point of contact who can answer design questions. If documentation is thin we will write our understanding of the system back to you and ask you to confirm it — that step alone catches design-level bugs.

How long does an audit take?

A single token contract is 24–48 hours. A typical dApp or mid-sized protocol runs one to two weeks. Large DeFi systems, L2s, bridges and ZK circuits are scoped per project after we have seen the code. We will give you a fixed timeline with the quote, not an estimate that moves.

Is a re-test included after we fix the issues?

Yes. Fix review is part of the engagement, not an upsell. We re-run the original proof of concept against your patched code and confirm the fix has not introduced a new path.

Related security services

Get a fixed quote in 24 hours

Send the repository and a commit hash through the contact form, message @bugtester25 on Telegram, or book a 30-minute scoping call. 200+ protocols audited · $4B+ secured · 0 hacks post-audit. Prefer email? info@safeedges.in.