reentrancy

Solid

Detect reentrancy vulnerabilities — classic, cross-function, and cross-contract (especially read-only reentrancy). Activate whenever Solidity/Vyper code performs external calls, low-level call/transfer/send, ERC-721 safeTransfer with a receiver hook, or any pattern where control flow leaves the contract before state finalization.

AI & Automation 38 stars 5 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 82/100

Stars 20%
53
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Reentrancy detection ## When this applies Trigger on any of: - External calls via `call`, `delegatecall`, `staticcall`, `transfer`, `send` - `safeTransferFrom` / `onERC721Received` / `onERC1155Received` callbacks - ERC-777 `tokensReceived` / `tokensToSend` hooks - Cross-contract calls preceding state writes - View functions that read state which is mid-update (read-only reentrancy) - Custom token callbacks, governance vote-cast hooks, flash-loan callbacks - Compound/Aave-style accounting that updates user balances after external transfers ## Detection patterns ### Classic reentrancy (CRITICAL / HIGH) ```solidity function withdraw() external { uint256 amt = balance[msg.sender]; (bool ok,) = msg.sender.call{value: amt}(""); // ← external call require(ok); balance[msg.sender] = 0; // ← state update AFTER call } ``` **Signal:** state mutation after external call. CEI (Checks-Effects-Interactions) violated. ### Cross-function reentrancy (HIGH) Two functions sharing state where one calls externally and the other reads/mutates the same state. Attacker re-enters via the second function. ### Cross-contract reentrancy (HIGH) Contract A updates state, calls B; B calls back into a *different* contract C that reads A's stale state. ### Read-only reentrancy (HIGH — frequently missed) Victim contract reads `getReserves()` / `getPrice()` from a pool mid-callback, before the pool finalizes its state. Example: Curve pools, Balancer vaults, Un...

Details

Author
iktok90-design
Repository
iktok90-design/ai-smart-contract-auditor
Created
1 weeks ago
Last Updated
2 days ago
Language
JavaScript
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

cross-contract-state

Detect cross-contract state inconsistency — two or more contracts sharing a token, oracle, or price feed where one mutates and another reads stale, cached state that drifts from source of truth, non-atomic multi-contract updates, accounting that assumes synchronized state, and reads during callbacks. Activate whenever a system spans multiple contracts that must agree on a value but update at different times.

38 Updated 2 days ago
iktok90-design
AI & Automation Solid

v4-hook-reentrancy-via-unlock

Detect reentrancy in Uniswap V4 hooks via the PoolManager unlock/lock callback. V4 uses a singleton PoolManager with transient lock state; all pool mutations happen inside an unlockCallback. A hook that makes external calls during beforeSwap/afterSwap/before*Liquidity (to tokens with hooks, arbitrary routers, or user-controlled contracts) can be re-entered, and because the manager is already unlocked the attacker can recursively swap/modify liquidity against stale hook state. Activate on any V4 hook performing external calls inside a callback, or custom unlockCallback logic.

38 Updated 2 days ago
iktok90-design
AI & Automation Listed

defi-amm-security

Use when writing or auditing Solidity AMMs, LP vaults, or swap/deposit/withdraw flows. Covers vulnerable-vs-hardened pairs for reentrancy/CEI, donation-inflation share math, TWAP oracles, slippage and deadlines, SafeERC20/Ownable2Step/FullMath, and slither/echidna/forge fuzz commands.

1 Updated 2 weeks ago
Mixard