reentrancy
What it does
This playbook guides the search for reentrancy weaknesses in smart contracts. It is for auditors and developers who want to confirm each risky external call is safe.
When to use it
- ✓When a contract makes an external call that sends value or changes state.
- ✓When several functions in a contract share the same storage.
- ✓When a read-only function may return stale values during a call.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/contracts/reentrancy/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Can you check our vault contract for reentrancy bugs and confirm whether the withdraw function is safe?”
5 new skills a week. 1 minute to read.
How it works
The agent finds external calls, checks whether state changes happen before them and whether a reentrancy guard is applied, then tests the result.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Reentrancy Playbook
Variants
- Classic — external call before state update (The DAO)
- Cross-function — A calls out, reentered into B which reads/writes A's state
- Read-only — view function reads stale state during reentrancy, consumed by a second contract making decisions
- Cross-contract — same attack pattern across protocol boundaries
- ERC777 / ERC1155 hook —
onERC*Receivedcallback re-enters
Audit steps
solidity_scan_fileflags every.call{value:...}anddelegatecall- For each hit, check:
- Is there a state write BEFORE the external call?
- Is
ReentrancyGuard'snonReentrantmodifier applied? - Does it follow checks-effects-interactions?
- Trace call graph — if any function the call target can invoke reads or writes the same state slot, that's a reentrancy chain.
PoC via Foundry
foundry_reentrancy_test(target="Vault", function="withdraw", target_path="src/Vault.sol")
Then:
cp generated.t.sol /workspace/foundry/test/
cd /workspace/foundry && forge test -vvv --match-contract Test_withdraw
Success criteria
The attacker contract balance grows by more than its initial deposit after the attack transaction. The Foundry test should assert this.
CVSS
- Direct fund drain:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H= 10.0 - Read-only with downstream impact: 8.1-9.1 depending on impact
Known exemplars
- The DAO (2016)
- Lendf.Me (2020, ERC777 hook reentrancy, $25M)
- Cream Finance (2021)
- Rari Capital (2022)
- Curve pool read-only reentrancy (2023)
FAQ
What is the classic fix?
Update state before the external call, following the checks, effects, then interactions pattern.
What is read-only reentrancy?
A view function can return stale values during a call, and another contract may rely on them.
How is a finding confirmed?
With a Foundry test that checks whether the contract balance grows beyond its deposit.
Details
Original description by the author
Hunt and validate reentrancy bugs — classic cross-function, same-function, read-only, and cross-contract variants.
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #14011
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.