agentleFS
mtarcuremtarcure/claude-vibe-squad/.agents/skills/read-only-reentrancy-check/SKILL.md

read-only-reentrancy-check

Skill220 starsChanged 20 days agoMITView on GitHub

Use when a composable DeFi integration exposes a pricing or share-value view that can be read while the owning protocol is mid-operation behind only a write-side non-reentrant guard, so an attacker re-enters through an ERC-721/1155 receiver or ETH-transfer hook and feeds a second consumer a skewed valuation to over-borrow, mint, or liquidate.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add a medusa/echidna property spanning both protocols: "consumer valuation reads are never served from an inconsistent mid-operation state."

    line 34

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Read-Only Reentrancy Check

Audit composable DeFi integrations for read-only reentrancy: while a protocol is mid-operation (its state temporarily inconsistent and its non-reentrant write guard held), an attacker re-enters through an ERC-721/1155/777 receiver hook or a native-transfer callback and reads a view function (price, share value, collateral ratio) that returns a skewed value, which a second consuming protocol trusts to over-borrow, mint, or liquidate.

Source: corpus A §III.3 (OWASP SC08 read-only reentrancy) — strategy-to-vault state mismatches in composable lending/AMM stacks. Impact class: funds theft / vault drain via mispriced valuation (intrinsic). Governing method: Phase-3a hypothesis lane of systematic-attacking; leads only into the verification spine.

Method

  1. Identify every externally-callable view function used by other protocols for pricing/valuation (get_virtual_price, getReserves-derived quotes, share-to-asset conversions). slither + manual mapping of cross-protocol consumers.
  2. For each, check whether it can be read while the owning protocol holds only a write-side nonReentrant guard (no read guard) during an operation that hands control to the caller (token callbacks, ETH transfers, remove_liquidity).
  3. Map the consumer: a second protocol that reads that view mid-callback and acts on it (borrow, mint, liquidate).
  4. PoC on anvil --fork: trigger the owning op, re-enter via the receiver hook, read the skewed view, and execute the over-borrow/mint on the consumer in the same transaction. Link-level negative control = the same read outside the reentrant window returns the correct value and the consumer action reverts/nets zero.
  5. Add a medusa/echidna property spanning both protocols: "consumer valuation reads are never served from an inconsistent mid-operation state."

Acceptance

  • Cross-protocol valuation views are enumerated with their reentrancy-window exposure classified.
  • The PoC realizes a fund loss on a real fork by reading a skewed view mid-callback; the outside-window negative control does not.
  • Finding names the view, the reentrancy window, and the consuming protocol; deduped before submission.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.