# Decoupling Reentrancy Protection from Smart Contract Implementation Logic

Crypto.world

> Reentrancy is a smart contract flaw where a contract makes an external call before finishing its own state updates, letting an attacker call back in and exploit the inconsistent state.

**arXiv**: 2605.25207

**Published**: 2026-05-24

**Authors**: Shashank Joshi, Wojciech Golab

## AI summary

## Overview

**Research area:** Blockchain security — smart contract vulnerability mitigation, specifically reentrancy attacks on Ethereum/EVM-based DApps, with a focus on proxy-pattern architecture.

**Technical level:** Advanced. The paper assumes familiarity with EVM opcodes (`call`, `delegatecall`, `staticcall`), Solidity, proxy/upgradeable contract patterns, storage slot layout, and formal state-transition notation.

**Scope (one sentence):** The paper proposes "Sentinel," a proxy-layer reentrancy guard that intercepts all calls to an implementation contract and defends against single-function, cross-function, cross-contract, and read-only reentrancy without modifying application logic.

## What This Paper Is About

Reentrancy is a smart contract flaw where a contract makes an external call before finishing its own state updates, letting an attacker call back in and exploit the inconsistent state. The authors report that such attacks siphoned around 80M USD from the DApp ecosystem last year. Existing work mostly *detects* these bugs or relies on narrow, hand-placed guards inside application code, so the paper's goal is to move protection out of the business logic and into the proxy layer, where every call can be checked before execution.

## Key Contributions

1. **A mathematical formalization of reentrancy.** The authors define contract state spaces, functions as state-transition systems, and give separate definitions for Single Function Reentrancy (SFR), Cross Function Reentrancy (CFR), Cross Contract Reentrancy (CCR), and Read Only Reentrancy (ROR), plus three requirements a guard must satisfy (Atomicity Preservation, Static Protection for Inconsistent State Exposure, and Scope-Aware State Coupling).
2. **A dual-mode proxy-based guard ("Sentinel").** An *optimized mode* using a cheap internal storage lock for single-contract protection, and a *high-security mode* using an external `LockRegistry` contract that provides a global, shared mutex spanning multiple proxy instances or logical domains.
3. **Static-call awareness for read-only reentrancy.** The proxy detects whether an incoming call is a `staticcall` by attempting a minimal state-changing assembly instruction (`log0(0, 0)`) inside a try-catch; a static context causes a revert, which reveals the call type. Gas lost on that revert is capped at a small predefined amount (1000 gas) rather than refunded.
4. **An upgrade-proof placement of security logic.** Because the guard lives in the proxy and upgrades are confined to the implementation, reentrancy protection survives contract upgrades, and the proxy stores its configuration in hash-derived dedicated storage slots to avoid storage collisions with the implementation.

## Main Findings

- **Coverage claim:** Evaluated against a dataset of 70 known vulnerable smart contracts, Sentinel achieves a **40% higher success rate** than existing methods, with superior coverage across **four major reentrancy attack categories** compared to existing solutions.
- **Traditional guards fall short:** Simple lock-based guards are described as limited in scope and static in application, and are vulnerable if an attack path bypasses the localized protections. The paper also analyzes why other reentrancy guards proved ineffective against sophisticated attacks.
- **Static calls need separate treatment:** Allowing view functions through while locked would leave the door open to ROR attacks, so both modes set `STATIC_CALL_ALLOWED_SLOT` to false while the lock is active, and reset it to true after the `delegatecall` returns.
- **Trade-off between the two modes:** The optimized mode's lock is local to the proxy's storage, so it does not inherently prevent re-entry from other, unproxied contracts in a wider execution domain; the high-security mode addresses this through the external `LockRegistry` (`isLocked`, `lock`, `unlock` on a `domainId`).
- **Gas detection overhead is bounded:** Static-call probing costs at most a capped, predefined 1000 gas on revert, and skipping the lock machinery for static calls avoids `SSTORE` and external registry calls.
- **Not reported in the supplied content:** The paper references a gas cost assessment and per-category success rates, but the experimental section (Section 5) is truncated in the provided text, so specific gas figures and per-category results are not available here.

## Methodology in Plain English

The authors first read the existing attack landscape and sort reentrancy into four categories, then write down each category as a precise mathematical condition involving contract states and execution times. From those definitions they derive what any effective guard must guarantee: state changes must not happen after an external call, outside observers must never see a half-finished state, and this must hold across a group of related contracts rather than a single one.

They then design the guard as a proxy — a contract that sits in front of the real application contract and forwards calls to it. Because every user interaction passes through the proxy's `fallback()` function, the proxy can check a lock *before* forwarding the call and release it *after* the call returns. Two locking strategies are offered: a cheap internal flag stored in a dedicated storage slot, and a shared external registry contract for protection spanning several contracts. A small assembly trick distinguishes read-only calls from state-changing ones so that view functions are not pointlessly blocked, but are blocked while a lock is held. Finally, they test the design against a collection of 70 real vulnerable contracts and compare it to existing mitigation techniques.

## Why This Matters

**Impact on research:** The paper shifts the mitigation conversation from *detecting* reentrancy to *structurally preventing* it, and supplies a formal vocabulary (SFR, CFR, CCR, ROR plus the three requirements) that other guard designs can be measured against. Placing the guard in the proxy rather than in application code is the distinctive move.

**Real-world applications:**

- **DeFi lending and vault protocols**, where the paper's motivating incidents (C.R.E.A.M. Finance, the DAO, Fei-Rari, Parity Wallet) caused losses in the millions.
- **Upgradeable DApps** that need security guarantees to persist across implementation upgrades.
- **Multi-contract protocol suites** (e.g., a vault plus a token plus a reward pool) that need cross-contract reentrancy protection rather than isolated per-contract locks.
- **Oracle and pricing contracts** that read other contracts' state and are exposed to read-only reentrancy inflating rewards or mispricing collateral.

**Industry relevance:** Because the approach requires no changes to business logic, it can be dropped in front of existing contracts as a proxy, which lowers adoption friction for teams that cannot easily rewrite audited implementation code.

## Future Directions

- **Full empirical disclosure:** The paper's own evaluation section would need to report per-category success rates, gas measurements, and the composition of the 70-contract dataset for the 40% coverage claim to be independently checkable.
- **Cost of the high-security mode:** Coordinating locks through an external `LockRegistry` introduces cross-contract calls and shared-state dependencies; whether its gas overhead is acceptable for high-frequency functions is an open question not resolved in the supplied content.
- **Trust and liveness of the registry:** A global mutex contract becomes a shared point of failure — how it resists griefing, stale locks, or unauthorized domain registration is a natural extension.
- **Beyond the four categories:** The taxonomy covers SFR, CFR, CCR, and ROR; whether the formal model and the proxy generalize to newer or composite attack patterns (and to non-EVM execution environments) is left for future work.

## Target Audience

Smart contract security researchers and auditors, protocol engineers evaluating upgradeable proxy architectures, and graduate-level readers comfortable with EVM internals and formal specification. Developers looking for an off-the-shelf guard will find the architectural reasoning useful, but the paper presumes working knowledge of Solidity assembly and proxy storage semantics.

## Authors’ abstract

Reentrancy attacks remain a persistent threat to decentralized applications (DApps), with malicious actors siphoning around 80M USD from the DApp ecosystem last year by exploiting EVM's inter-contract message-passing semantics. Existing research focuses primarily on detection, relying on known attack patterns, and fails to provide deployable solutions that eliminate the vulnerability. Traditional reentrancy guards are similarly limited, offering incomplete coverage across…

[The full abstract on arXiv](https://arxiv.org/abs/2605.25207)

[Read the original paper](https://arxiv.org/abs/2605.25207)

---

Canonical: https://crypto.world/paper/decoupling-reentrancy-protection-from-smart-contract-implementation-2605.25207
