Skip to content
Back to skills

Fuzzing With Echidna And Medusa

ASecurity

Property-based fuzzing of Solidity with Echidna (Trail of Bits) and Medusa (Crytic) as a complement to Foundry invariants. Use when forge invariant handlers are not enough or the repo already has Echidna properties.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 2, 2026
ai-agentsgobashawstestinggit

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 2, 2026

npx -y skills add nuroctane/nur-cli --skill fuzzing-with-echidna-and-medusa --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Fuzzing With Echidna And Medusa?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Fuzzing With Echidna And Medusa
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nuroctane-fuzzing-with-echidna-and-medusa/badge)](https://www.skillsdirectory.com/skills/nuroctane-fuzzing-with-echidna-and-medusa)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: fuzzing-with-echidna-and-medusa
description: "Property-based fuzzing of Solidity with Echidna (Trail of Bits) and Medusa (Crytic) as a complement to Foundry invariants. Use when forge invariant handlers are not enough or the repo already has Echidna properties."
---

# Fuzzing with Echidna and Medusa

Foundry invariants are the default in this pack (`writing-foundry-invariant-handlers`). Use Echidna/Medusa when:

- the repo already has `echidna.yaml` / Medusa config
- you need coverage-guided or assertion-mode fuzz beyond `forge test`
- you are following Trail of Bits [building-secure-contracts](https://github.com/crytic/building-secure-contracts) property templates

In-scope, local, no broadcast. Same conservation laws as the Foundry handler skill.

## Tools

- Echidna: `pip install echidna` or the Crytic binary. Properties are `echidna_*` functions that return `bool` (or assertion mode).
- Medusa: Crytic's Go fuzzer, often faster corpus/coverage. YAML config, assertion or property mode.
- Both read compilation via crytic-compile (Foundry, Hardhat, solc).

## Steps

### 1. State the properties

Reuse the English laws from the handler skill. Prefix:

```solidity
function echidna_solvency() public view returns (bool) {
    return address(vault).balance >= vault.totalDeposits();
}
```

Or assertion mode (`assert` inside the property) if the config says so.

### 2. Constrain like a handler

Unconstrained Echidna will hammer `withdraw` until everything reverts. Use:

- `crytic_constructor` / deploy wrapper that sets up actors
- input bounding inside the property contract
- `filterFunctions` / Medusa `fuzz.testing.onlyFunctions` so you do not fuzz `upgradeTo`

### 3. Run

```bash
echidna . --contract VaultEchidna --config echidna.yaml
medusa fuzz --config medusa.json
```

Start with a short timeout, then lengthen on the hottest properties (solvency, share conservation).

### 4. Turn crashes into Foundry tests

When Echidna prints a shrinking sequence, copy it into `test/Replay_*.t.sol`. Researchers file Foundry tests; corpus traces are not a report.

## Expected output

Config + property contract, a run summary (passes / counterexamples), and any counterexample replayed as a Foundry unit test. Next: `contest-and-bounty-reporting` if a property fails on in-scope code.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.