How to write an Immunefi-ready bug report: structure, PoC expectations, severity language — template practice only.
Learn how to install Kali Linux dual boot alongside Windows 10/11. Complete step-by-step guide with partitioning, GRUB setup, troubleshooting, and safety warnings to prevent data loss.
13 min read
Transparent vs UUPS, uninitialized implementations, and storage-layout collisions — local forge inspect lab. No live upgrades.
35 min read
How to write an Immunefi bug report is a craft problem: clear impact, correct severity language, and a runnable local PoC — not a three-line guess. This Andrax tutorial — by Syed Zada Abrar — covers ~50% theory, ~50% template practice.
Prerequisites: Foundry + Slither Setup; Solidity Reentrancy Explained; Access Control Bugs; How to Start Web3 Bug Hunting.
Also useful: Hub; ERC-4626 Share Inflation (local vault patterns); DeFi-Specific Patterns: Governance, Bridges & L2 Risks.
Ethics fence: the mock report and PoC below are ILLUSTRATIVE / local. They target a toy vault you deploy in Foundry — not a live Immunefi program. Do not submit this mock to any project. Do not test in-scope mainnet or public-testnet code. Immunefi rules ban that testing and spam / AI spray reports.
Immunefi’s public guide How to Submit Bug Reports That Get Paid is blunt: short empty reports get ignored or worse; PoCs must be runnable (Foundry/Hardhat test or exploit contract), tested on a local network / mainnet fork, not on mainnet or public testnet; impact must be articulated in economic terms that match in-scope impacts on the program page.
Also prohibited (rules + guide): AI-generated spray, out-of-scope impacts, severity inflation, harassment, public disclosure before fix+pay, and testing live deployed in-scope code.
Use the Immunefi Vulnerability Severity Classification System v2.3 (immunefi severity classification). Smart Contracts excerpt (read the live table — programs may narrow it):
| Level | Example impacts (Smart Contracts) |
|---|---|
| Critical | Direct theft of user funds/NFTs; permanent freezing; unauthorized minting; governance manipulation changing outcome; protocol insolvency |
| High | Theft/freezing of unclaimed yield/royalties; temporary freezing of funds/NFTs |
| Medium | Griefing; unbounded gas; contract unable to operate due to lack of token funds; theft of gas |
| Low | Fails to deliver promised returns without losing value |
Downgrade when elevated privileges or uncommon user interaction are required. NIST CVSS is a poor fit for most DeFi reports — prefer IVS, then the program’s listed impacts.
Default out-of-scope themes (IVS page; always re-check the program): already-exploited damage, leaked keys, privileged-address attacks without privilege changes, third-party oracle incorrect data (with stated exceptions for manipulation/flash-loan where in scope), 51%-style governance/economy assumptions, Sybil, pure centralization risk, best-practice nits, phishing.
Align with Immunefi’s published template sections:
setFee leads to fee theft”).Immunefi also publishes Foundry PoC tutorials: Part 1 and Part 2 on the same blog path. Their help-center “Bug Report Submission Checklist” may require login; treat the blog template + rules as the public baseline if the checklist page is gated.
Bad titles hide the bug. Good titles name where and what breaks:
| Weak | Stronger |
|---|---|
| "Bug in vault" | "Missing access control on sweep leads to direct theft of vault ERC20 balance" |
| "Possible reentrancy" | "Reentrancy in withdraw via ERC-777 callback drains pool reserves" |
| "Oracle issue" | "Spot price read in liquidate enables temporary underwater liquidations" |
Immunefi’s guide asks for a title that already implies vulnerability class and impact. If the project cannot guess the rest of the report from the title alone, rewrite it.
Impact is not a vibe. For funds-at-risk reports:
Primacy of Impact (when the program uses it) still does not excuse out-of-scope assets. Read both lists.
Treat the dashboard like a professional disclosure channel. Response SLAs exist in Immunefi’s project agreements (described in their public guide); use mediation paths there when appropriate — not social media pressure.
| Do | Do not |
|---|---|
forge test that fails closed, then shows the bug | Steps-only without code |
| Local Anvil / local deploy / explicit vulnerable CTF | Mainnet or public testnet of in-scope code |
| Assert balances / state change that proves impact | “It looketh vulnerable” screenshots only |
| Optimize attack parameters for max demonstrated loss on the toy | Drain a live protocol “to prove severity” |
| Name compiler, Foundry version, how to run | Paste entire protocol repos without a test entrypoint |
Goal: write a full report in Immunefi section order against a local toy that lets anyone call sweep. Attach a Foundry-shaped PoC. Do not submit this to Immunefi.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/// ILLUSTRATIVE / LOCAL LAB ONLY — not a real program target
interface IERC20Mini {
function balanceOf(address) external view returns (uint256);
function transfer(address, uint256) external returns (bool);
}
contract ToyOpenVault {
IERC20Mini public immutable asset;
address public owner;
constructor(IERC20Mini a, address o) {
asset = a;
owner = o;
}
function deposit() external payable {}
/// BUG (intentional): anyone can sweep ERC20 balance
function sweep(address to) external {
uint256 bal = asset.balanceOf(address(this));
require(asset.transfer(to, bal), "transfer");
}
}
# ILLUSTRATIVE ONLY — DO NOT SUBMIT
## Title
Missing access control on `ToyOpenVault.sweep` leads to direct theft of vault ERC20 balance
## Brief / Intro
`sweep(address)` has no `onlyOwner` (or equivalent) check. Any caller can transfer the vault’s entire ERC20 `asset` balance to an arbitrary address. On this local toy, that is direct theft of funds held by the vault.
## Details
- File: `src/ToyOpenVault.sol` (local lab)
- Function: `sweep(address to)`
- Root cause: missing authorization on a fund-moving function
- `owner` is stored but never consulted in `sweep`
## Impact
An unprivileged attacker can steal the full ERC20 balance of the vault contract in one call. Mapped to Immunefi Smart Contracts **Critical** example impact “Direct theft of any user funds…” **on this toy only**. A real program requires matching an **in-scope** impact on that program’s page.
## Risk Breakdown
- Severity (IVS, illustrative): Critical
- Privileges: none beyond calling `sweep`
- Likelihood on toy: any address once tokens sit in the vault
- Downgrade: none for the toy; on a real program, re-check OOS and privilege assumptions
## Recommendation
Restrict `sweep` to `owner` (or a role), or remove it and use a pull-payment pattern with proper access control. Add tests that `vm.prank(attacker)` reverts.
## References
- Immunefi IVS v2.3 — Smart Contracts Critical impacts
- Andrax access-control tutorial (local learning)
- This report is ILLUSTRATIVE against `ToyOpenVault` only
## Proof of Concept
See `test/ToyOpenVaultSweep.t.sol` below. Run: `forge test --match-test test_anyoneCanSweep -vv`
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "forge-std/Test.sol";
/// ILLUSTRATIVE mock asset — local lab only
contract MockAsset {
mapping(address => uint256) public balanceOf;
function mint(address to, uint256 amount) external {
balanceOf[to] += amount;
}
function transfer(address to, uint256 amount) external returns (bool) {
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
return true;
}
}
/// LOCAL LAB ONLY — ToyOpenVault from the previous snippet must be in project
contract ToyOpenVaultSweepTest is Test {
function test_anyoneCanSweep() public {
MockAsset asset = new MockAsset();
address owner = makeAddr("owner");
address attacker = makeAddr("attacker");
ToyOpenVault vault = new ToyOpenVault(IERC20Mini(address(asset)), owner);
asset.mint(address(vault), 1_000 ether);
vm.prank(attacker);
vault.sweep(attacker);
assertEq(asset.balanceOf(attacker), 1_000 ether);
assertEq(asset.balanceOf(address(vault)), 0);
}
}
Lab write-up (six sentences): title you chose; IVS level and why; whether a real program would list this impact; how you ran forge test locally; what you would change before a real submission (scope check, KYC awareness, no mainnet); confirmation you did not submit the mock.
| Trap | Better habit |
|---|---|
| Three-line “reentrancy maybe” | Full template + runnable PoC |
| Critical on a view-only nit | IVS + program in-scope impacts |
| Mainnet “demo” tx | Local / fork under rules |
| AI paste without understanding | You must explain Details in your own words |
| Severity shopping | Argue impact; accept triage |
| Submitting this mock | Never — ILLUSTRATIVE only |
forge test / Hardhat) and demonstrates impactEducational content by Syed Zada Abrar for Andrax (andraxpentester.in). Authorized research only. Mock report and vault are ILLUSTRATIVE / local lab only — do not submit to Immunefi.
First-depositor donation can round the next mint to zero shares. Local toy vault plus OpenZeppelin virtual-offset discussion.
40 min read
Sign in to leave a comment.