## https://sploitus.com/exploit?id=0FABDB5F-9496-5C12-B984-6C700C06D866
# ๐ฆ BlockShark
**Autonomous exploit-proving engine for smart contracts.**
We don't *score* risk โ we **prove** it.
[](https://github.com/blocksharkcom/blockshark/actions/workflows/ci.yml)
[](./LICENSE)
[](https://www.python.org)
[](https://getfoundry.sh)
## What it does
BlockShark generates a candidate exploit, **executes it against the real EVM on
Foundry**, and lets the chain decide whether funds actually moved โ then keeps
the first exploit that works (best-of-N with self-repair).
```
โโโโโโโโโโโโ Attacker.sol โโโโโโโโโโโโโโโโโ pass/fail โโโโโโโโโโโโ
โ generate โ โโโโโโโโโโโโโโโโถ โ execute on โ โโโโโโโโโโโโโถ โ EVM is โ
โ (LLM) โ โโโโ self-repair โ Foundry (fork)โ funds moved?โ judge โ
โโโโโโโโโโโโ forge output โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโ
```
Because a finding is a **working proof-of-concept**, precision is ~100% by
construction. The metric we optimize is **recall** โ how many exploitable bugs
we actually catch. Every run prints our *own* recall number, measured, not
quoted.
> **We prove exploits. We never certify "safe."** The absence of a found exploit
> is not proof of security โ see [ETHICS.md](./ETHICS.md).
## Why it's different
- **The oracle is harness-owned.** The model only writes the `Attacker`
contract. The pass/fail `require()`s live in each target's `template.sol`, so
the model **cannot fake success** โ the EVM is the judge, not the LLM.
- **Execution-verified, not heuristic.** Unlike risk scanners (GoPlus,
TokenSniffer, QuickIntel) that output a probability, BlockShark returns a
reproducible PoC that drained funds โ or nothing.
- **No runtime dependencies.** Pure-stdlib harness; targets are self-contained
with cheatcodes declared inline. If Foundry is installed, it runs.
## Quickstart
```bash
# Prerequisites: Foundry (https://getfoundry.sh) and Python 3.11+
pip install -e ".[dev]"
# 1. Prove the harness + oracle end-to-end (no API key needed):
blockshark run --mode mock
# 2. Real autonomous exploitation:
cp .env.example .env # add your ANTHROPIC_API_KEY
source .env
blockshark run --mode llm --samples 5 --repairs 2 --jobs 4
# List the benchmark:
blockshark list
```
## The benchmark
Five targets across four bug classes ship in `targets/` (mock mode proves all
five at 100% โ this is the CI regression gate):
| Target | Bug class | The bug |
|-------------------|----------------------|---------|
| `ether_store` | reentrancy | `withdraw()` sends ETH before zeroing the balance |
| `shares_vault` | reentrancy | `redeem()` transfers before an `unchecked` share decrement |
| `access_control` | access-control | `setOwner()` is unprotected โ anyone seizes ownership and sweeps |
| `price_oracle` | oracle-manipulation | borrows against an atomically-manipulable AMM spot price |
| `delegatecall` | delegatecall | proxy `delegatecall`s into caller-supplied target โ owner hijack |
## Documentation
- [`docs/architecture.md`](./docs/architecture.md) โ the loop, components, and the harness-owned oracle design
- [`docs/adding-targets.md`](./docs/adding-targets.md) โ author a new target in minutes (incl. mainnet-fork fields)
- [`docs/benchmarking.md`](./docs/benchmarking.md) โ how recall/precision are measured, and why we never claim "safe"
- [`docs/roadmap.md`](./docs/roadmap.md) โ from this MVP โ inference-time search โ RLVR โ continuous monitoring
## Project layout
```
blockshark/ the package: cli ยท engine ยท forge_runner ยท providers ยท targets ยท report
src/ vulnerable victim contracts (the benchmark set)
targets// manifest.json + template.sol (owns the oracle) + reference_attacker.sol
tests/ pytest unit + integration suite
results/ one JSON per run: recall, per-bug-class breakdown, attempts, tokens
```
## Honest scope
This is the **confirmation/discovery seed**, not the finished product. It runs
against known-vulnerable contracts to validate the loop and establish a recall
baseline. High-recall *confirmation* of suspected bugs is the near-term strength;
cold *discovery* on unlabeled mainnet contracts is the harder regime we climb
into next (see the roadmap). Precision is real today; coverage is what we grow.
## Responsible use
BlockShark is a **dual-use offensive security tool** for **authorized** testing
only โ contracts you own, audit/bug-bounty engagements, and research. Any
real-world finding must go through **coordinated disclosure**
([SECURITY.md](./SECURITY.md), [ETHICS.md](./ETHICS.md)).
## Contributing
New exploit targets and bug classes are especially welcome โ see
[CONTRIBUTING.md](./CONTRIBUTING.md). Licensed under [Apache-2.0](./LICENSE).