# solidity-security-audit

> Systematic Solidity/Vyper audit method: invariants first, bug-class checklist, PoC-backed findings.

solidity-security-audit is a paid AI agent skill on Agensi by BanditXBT, in Security. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $4.2 (one-time purchase)
- Creator: [BanditXBT](https://www.agensi.io/creators/banditxbt)
- Category: [Security](https://www.agensi.io/skills/security)
- Version: 1.0
- Last updated: 2026-11-21
- Security: scan passed (2026-11-21); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/solidity-security-audit
- Tags: security, web3-crypto, code-quality-review

## About this skill

Audit for *loss of funds and broken invariants*, not style. Read the code before running tools; tools find shallow bugs, invariants find deep ones.

1. **Scope & intent.** Read specs/docs. Write down: assets held, privileged roles, external dependencies (oracles, routers, tokens, other protocols), and 5-10 **invariants** (e.g. "sum of user collateral == vault balance", "no position can be opened below initial margin", "total OI long == short within skew cap").
2. **Map attack surface.** Every `external`/`public` function, every `delegatecall`/`call`, every callback entry (ERC-777/1155/721 hooks, flash-loan callbacks, `receive`), every privileged function, every storage slot written by more than one path.
3. **Run cheap tools first:** `slither .`, compiler warnings, `forge build --sizes`, `forge inspect <C> storage-layout`. Triage; do not treat output as findings.
4. **Manual pass by bug class** (see checklist). For each function ask: who can call it, in what state, with what inputs, with what external call mid-way, and what breaks if called twice / reordered / with zero / with max?
5. **Prove or discard.** Turn each suspected bug into a failing Foundry test (fork when it depends on live state). Unproven = "unverified".
6. **Report** by severity with PoC, impact (funds at risk, preconditions, attacker cost/profit) and fix.

- **Access control:** missing modifiers; `initialize` callable by anyone/twice; `tx.origin`; role admin overly broad; timelock/multisig bypass; two-step ownership transfer.
- **Reentrancy:** CEI violations, cross-function and **cross-contract/read-only** reentrancy (view functions read mid-update by other protocols), token hooks, ETH `call`. Guards must cover every state-changing entry sharing the state.
- **Accounting:** rounding direction (round *against* the user in the protocol's favor: up for debts, down for shares/withdrawals); first-depositor/share-inflation in ERC-4626; donation attacks via `balanceOf`; mixed decimals; fee-on-transfer/rebasing tokens; `transfer` vs `transferFrom` return values (use SafeERC20; USDT returns nothing); dust and zero-amount paths; `unchecked` blocks and downcasts (explicit `uint128(x)` truncates silently even in 0.8+; use SafeCast).
- **External calls:** unchecked low-level return, arbitrary `call` target/data (approval theft), `delegatecall` to untrusted code, `msg.value` reuse in loops/multicall, gas griefing, return-bomb.
- **Signatures:** EIP-712 domain includes `chainId` + `verifyingContract` (recompute on fork); nonces and deadlines; `ecrecover` returning `address(0)`; malleability (use OZ ECDSA); Permit front-run griefing; replay across chains/deployments.
- **Upgradeability:** storage layout collisions, uninitialized implementation (`_disableInitializers`), UUPS `_authorizeUpgrade`, selfdestruct/delegatecall in implementation, immutable vs proxy state, upgrade-and-call atomicity.
- **Oracles & pricing:** spot-price reads, stale/zero/negative answers, decimals mismatch (see `oracle-risk-review`).
- **Economic/MEV:** sandwichable swaps without slippage/deadline, JIT liquidity, flash-loan-funded governance or price moves, griefing via dust positions, front-running of `initialize`/liquidation/first deposit.
- **DoS:** unbounded loops over user arrays, one failing callee blocking batch (pull over push), forced ETH via `selfdestruct`/coinbase breaking `balance ==` checks.
- **Compiler/EVM:** pragma floating; version-specific bugs (Vyper 0.2.15-0.3.0 shipped a broken reentrancy-lock codegen that was exploited in Curve-related pools, July 2023: check the compiler version of every dependency, not just your own code); `evm_version` mismatch across target chains (see `evm-chain-differences`); `block.timestamp`/`block.number` assumptions.
- **Transient storage (EIP-1153) & `selfdestruct` (EIP-6780):** transient reentrancy locks must be set and cleared on every path, and transient state persists across calls within the *whole transaction* (multicall/batch contexts); post-Cancun `selfdestruct` no longer deletes code except in the creating tx, so "destroy to reset" and metamorphic-contract assumptions are stale.
- **Meta-transactions & forwarders (ERC-2771, multicall):** a trusted forwarder appends the sender to calldata; `delegatecall`-based multicall plus `_msgSender()` has produced spoofable-sender bugs. Check every `msg.sender` use under forwarding and batching.
- **Approvals:** unlimited approvals to routers/aggregators, `Permit2` allowance scope and expiry, and arbitrary-call functions that let a user make the contract spend *its own* approvals.

`[SEV] Title — contract:line` · Preconditions · Attack steps · Impact (quantified) · PoC test name · Fix. End with invariants checked, tools run, and areas not reviewed. Never claim "no vulnerabilities"; state coverage.

## Requires

- Optional: Foundry
- Optional: Slither

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the solidity-security-audit skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What does solidity-security-audit do?

Systematic Solidity/Vyper audit method: invariants first, bug-class checklist, PoC-backed findings.

### Which AI agents support solidity-security-audit?

This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

### How do I use solidity-security-audit?

Connect your AI agent to Agensi through MCP, then ask it to use solidity-security-audit on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
