Reentrancy Patterns Bug Bounty Hunters Miss on First Pass
Everyone flags the obvious reentrancy. The ones that pay out on bug bounties — and drain protocols — are the variants nobody checks on first pass. Cross-function, read-only, cross-contract: here's exactly how they hide.
Duron Epps
Founder, SmartContractAuditor.ai

A reentrancy attack is a vulnerability where an external contract can repeatedly call back into a victim contract before the first execution finishes, draining funds or corrupting state. The DAO hack made this famous — $60M gone in 2016, Ethereum literally forked to fix it. And it never left: on July 30, 2023, a Vyper compiler bug broke the reentrancy locks on several Curve pools, and roughly $70M was drained. Same bug. Different clothes.
Here's what nobody tells you on your first bug bounty run: the basic reentrancy is almost always caught. By the protocol team, by Slither, by the auditors they paid. The bugs that actually pay out are the ones that look safe on the surface — cross-function reentrancy, read-only reentrancy, and cross-contract reentrancy chains. These don't trigger the obvious alarm bells. They require you to think about state across multiple calls, multiple functions, sometimes multiple contracts.
This post is for the bug bounty hunters who've submitted a reentrancy report and gotten back "Known / Won't Fix" or "Informational." You're looking in the wrong place. Let me show you where the real money hides.
What Is a Reentrancy Attack (and Why the Obvious Version Is Already Patched)?
The classic version: a withdraw() function sends ETH before zeroing the user's balance. Attacker deploys a contract with a receive() fallback that calls withdraw() again. The balance check passes every time because it hasn't been updated yet. Funds drain until the contract is empty.
Every junior auditor checks this. Slither flags it. OpenZeppelin's ReentrancyGuard exists specifically to stop it. So most modern protocols have this covered — or think they do.
The problem is that reentrancy is a family of vulnerabilities, not a single pattern. The safe-looking code that gets shipped to mainnet is often vulnerable to a cousin that flew under the radar.
What Is Cross-Function Reentrancy and Why Do Bug Bounty Hunters Miss It?
Cross-function reentrancy happens when a contract makes an external call in function A, and an attacker uses the callback to call function B — which reads or writes the same state that function A hasn't finished updating yet.
The Cream Finance exploit in August 2021 — about $18.8M drained — re-entered the lending pool through the AMP token's transfer hook, a path that ran through more than one function and contract. The individual functions looked fine in isolation. The exploit only worked when you traced the full execution path across the call chain. That's exactly why it survived code review.
Here's what this looks like in a simplified vault contract:
// SPDX-License-Identifier: MIT
// Solidity 0.8.24 — VULNERABLE pattern
pragma solidity ^0.8.24;
contract VulnerableVault {
mapping(address => uint256) public balances;
mapping(address => bool) public hasWithdrawn;
function deposit() external payable {
balances[msg.sender] += msg.value;
}
// Function A: makes external call before full state update
function withdraw(uint256 amount) external {
require(balances[msg.sender] >= amount, "Insufficient");
// External call happens HERE — attacker can reenter claimBonus()
(bool success, ) = msg.sender.call{value: amount}("");
require(success, "Transfer failed");
// State update comes AFTER the external call
balances[msg.sender] -= amount;
}
// Function B: reads balances[] which withdraw() hasn't updated yet
function claimBonus() external {
require(!hasWithdrawn[msg.sender], "Already claimed");
// balances[msg.sender] still shows pre-withdrawal amount during reentry
uint256 bonus = balances[msg.sender] / 10;
hasWithdrawn[msg.sender] = true;
(bool success, ) = msg.sender.call{value: bonus}("");
require(success, "Bonus failed");
}
}
Auditing withdraw() alone? It looks like it just needs a reentrancy guard. Auditing claimBonus() alone? No external call before state update, looks clean. The vulnerability only exists in the interaction between them — the attacker calls withdraw(), reenters into claimBonus() before balances updates, and claims a bonus based on a balance that's already been withdrawn.
Here's the corrected version:
// SPDX-License-Identifier: MIT
// Solidity 0.8.24 — FIXED pattern
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; // OpenZeppelin 5.x
contract SecureVault is ReentrancyGuard {
mapping(address => uint256) public balances;
mapping(address => bool) public hasWithdrawn;
function deposit() external payable {
balances[msg.sender] += msg.value;
}
// nonReentrant blocks reentry into ANY function with this modifier
function withdraw(uint256 amount) external nonReentrant {
require(balances[msg.sender] >= amount, "Insufficient");
// Checks-Effects-Interactions: update state BEFORE external call
balances[msg.sender] -= amount;
(bool success, ) = msg.sender.call{value: amount}("");
require(success, "Transfer failed");
}
function claimBonus() external nonReentrant {
require(!hasWithdrawn[msg.sender], "Already claimed");
// Now reads the already-updated balance
uint256 bonus = balances[msg.sender] / 10;
hasWithdrawn[msg.sender] = true;
(bool success, ) = msg.sender.call{value: bonus}("");
require(success, "Bonus failed");
}
}
Two fixes working together: Checks-Effects-Interactions ordering on the state update, and nonReentrant on both functions. One without the other is still potentially exploitable depending on what other functions share state.
What Is Read-Only Reentrancy and Which Protocols Are at Risk?
This one is brutal because it doesn't drain the vulnerable contract directly — it manipulates the price or state that another contract reads from it.
Read-only reentrancy: an attacker triggers a callback during a view or non-state-modifying code path, and during that callback, reads a value from the victim contract that's temporarily in an inconsistent state. No funds move from the victim. The attacker uses the corrupted read to manipulate a downstream protocol that trusts the victim's state.
In 2022, ChainSecurity disclosed that protocols reading Curve's get_virtual_price() could be fed a wrong value in the middle of a withdrawal, and several integrators, MakerDAO among them, had to patch. In February 2023, dForce lost about $3.6M to exactly this pattern (the attacker later returned the funds). The Curve contracts themselves weren't drained — but protocols reading Curve's virtual price during a reentrant state got manipulated.
The mental model that most hunters use — "does this function move funds before updating state?" — completely misses this. You have to ask: "Does any external call happen during a state transition, and does any other contract read from this contract during that window?"
That's a much harder question. It requires you to map integrations, not just read the function in isolation.
How Do I Catch Cross-Contract Reentrancy as a Bug Bounty Hunter?
Cross-contract reentrancy is the full chain version — attacker exploits contract A's callback, calls into contract B, which calls back into contract A through a different path. The reentrancy guard on contract A doesn't help if the reentrant path goes through contract B first.
Static tools like Slither catch single-contract reentrancy patterns well. They struggle with multi-contract chains. That's not a knock on Slither — it's a genuinely hard static analysis problem. Cross-contract call graphs explode in complexity fast.
Here's my actual first-pass checklist when I'm hunting cross-function and cross-contract reentrancy:
- Map every external call.
call(),transfer()(less common now),delegatecall(), ERC20transferandtransferFromto arbitrary addresses, and any interface call to a user-supplied address. That last one is where most bugs hide today. - For every external call, ask: what state hasn't been written yet? Not just the function's local state — shared storage variables that other functions also read.
- Find every function that reads those same variables. Can any of them be called during the external call window? Even indirectly through another contract?
- Check if
nonReentrantis applied to ALL functions that share vulnerable state — not just the function with the external call. I've seen protocols where the guard is onwithdraw()but not onclaimRewards()that reads the same mapping. - Look at every protocol this contract integrates with. If a Curve pool, Uniswap pool, or lending market makes a callback during your contract's execution, can an attacker read a stale value from your contract through that integration?
How I'd Catch This Before It Ships
When I'm doing a full audit pass — not just first-pass bug bounty hunting — I build a state dependency graph. Every storage variable, every function that reads it, every function that writes it, and every external call that happens between reads and writes.
It sounds tedious. It is. But it's also how you find the eight-figure bugs instead of the ones that get marked "Informational."
Specifically, I look for this anti-pattern: a function that (1) reads state, (2) makes an external call, (3) then writes state — but other functions exist that also read that same state and can be triggered during step 2. The classic Checks-Effects-Interactions pattern solves the basic case, but cross-function reentrancy survives CEI if the guard isn't applied to both functions.
For read-only reentrancy, I look for view functions that return values used as oracle inputs by external protocols, and check whether those values can be read in an inconsistent state during any of the contract's own external call windows.
Static tools like Slither catch the obvious single-function pattern — and you should absolutely run it, it's free and fast. But it misses the economic logic that makes cross-function and read-only variants actually exploitable in context. That's where deeper analysis matters: understanding not just what the code does, but what an attacker can force it to do when two functions interact across a callback.
Run your contract through SmartContractAuditor.ai before you deploy — or before you submit that bug bounty report. It flags cross-function reentrancy patterns and explains in plain English why the specific interaction is dangerous, not just that an external call exists before a state update. That context is what separates a valid High from a "Duplicate / Informational."
Specific Actions to Take Right Now
- Search your codebase for
.call{value:and every ERC20 transfer to a non-hardcoded address. Those are your external call sites. Work backward from each one. - Check that
nonReentrantis on every function sharing state with an external-call function — not just the function that makes the call. OpenZeppelin 5.x'sReentrancyGuarduses a transient storage optimization; make sure you're on a compatible compiler version (0.8.24+) if you use it. - Run Slither with
--detect reentrancy-eth,reentrancy-no-eth,reentrancy-benign— all three detectors, not just the default. The benign variant catches read-only-adjacent patterns. - If your protocol reads price or state from another DeFi protocol, check whether that read can happen during a callback window. Trace the full execution path, not just your function in isolation.
- Paste your contract into SmartContractAuditor.ai for a second set of eyes before you ship or submit. It takes 30 seconds and it catches exactly this class of multi-function interaction bugs.
Frequently Asked Questions
What is cross-function reentrancy in Solidity?
Cross-function reentrancy is a vulnerability where an attacker uses an external call callback in function A to invoke function B on the same contract, exploiting shared storage that function A hasn't finished updating yet. Unlike basic reentrancy, neither function looks vulnerable in isolation — the bug only exists in their interaction. It's significantly harder to catch with automated tools and is responsible for some of the largest DeFi exploits on record.
How does read-only reentrancy work in DeFi?
Read-only reentrancy exploits the fact that a contract's state can be temporarily inconsistent during an external call, even if no funds move from the victim contract directly. An attacker triggers a callback, and during that callback, a downstream protocol reads a corrupted value (like a price or balance) from the victim contract. The dForce exploit in February 2023 is the textbook case: dForce trusted Curve's virtual price mid-callback and lost about $3.6M, even though Curve's own funds weren't touched.
How much has reentrancy cost DeFi protocols in total?
There's no trustworthy running total, so be wary of anyone who quotes one. The documented cases are big enough: The DAO lost about $60M in 2016 and Ethereum hard-forked to undo it, Cream Finance lost about $18.8M in August 2021 through a token-hook reentrancy, and a Vyper compiler bug that broke reentrancy locks cost several Curve pools roughly $70M in July 2023.
Does OpenZeppelin's ReentrancyGuard prevent cross-function reentrancy?
Yes — but only if you apply the nonReentrant modifier to all functions that share the vulnerable state, not just the function that makes the external call. A common mistake is guarding withdraw() but leaving claimRewards() unguarded when both read the same balance mapping. OpenZeppelin 5.x introduced a transient storage version of ReentrancyGuard that's more gas-efficient and requires Solidity 0.8.24 or higher.
Is reentrancy covered in a standard smart contract audit?
Basic single-function reentrancy is always checked in any reputable audit. Cross-function and read-only reentrancy coverage varies significantly by auditor and methodology — these require manual tracing of state dependencies across multiple functions and contracts, which automated tools frequently miss. When evaluating an audit firm, ask specifically whether they check cross-function reentrancy and integration-layer read-only reentrancy as separate line items.
What's the difference between reentrancy and a flash loan attack?
Reentrancy exploits a contract's execution flow — an attacker triggers repeated callbacks before state updates complete, within a single or multi-step call chain. Flash loan attacks use uncollateralized loans to temporarily inflate an attacker's capital for price manipulation or arbitrage, all within one transaction. They're distinct vulnerability classes, though some complex exploits combine both: a flash loan to acquire capital, then reentrancy to drain a target contract.
Further Reading
Written by
Duron Epps
Founder of SmartContractAuditor.ai. Writes about smart contract exploits, audits and the tools that catch them.
About SmartContractAuditor.aiCheck your own contract
Paste Solidity, Vyper or Rust and see what the scanner flags. Three free scans, no sign-up.
Keep reading

Code4rena vs Sherlock vs Immunefi: How the Platform Format Changes Your Research Workflow
The platform you compete on isn't just a venue — it determines what bugs are worth finding, how you structure your time, and whether you walk away with $0 or $50k. Most auditors pick one and never question it. That's leaving money on the table.

Access Control Gaps: The Pattern Bug Bounty Hunters Should Check First
Access control vulnerabilities are responsible for more DeFi losses than reentrancy — and most auditors still check reentrancy first. Here's what bug bounty hunters find fastest, and how to catch it before it costs you everything.

The DAO Hack 2016 Explained: $60M Reentrancy
In June 2016, an attacker drained 3.6 million ETH from The DAO — roughly $60M at the time — using a reentrancy bug so simple it fits in ten lines of code. This wasn't a cryptographic breakthrough or a zero-day in the EVM. It was a function that made an external call before it updated a balance. Eight years later, variants of that same pattern still appear in production contracts.
Written by Duron Epps, Founder · Published December 3, 2026