0xlayerghost/solidity-agent-kit/solidity-audit

Claude Code and agent skill by 0xlayerghost/solidity-agent-kit

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Security audit and code review checklist. Covers 30+ vulnerability types with real-world exploit cases (2021-2026) and EVMbench Code4rena patterns. Use when conducting security audits, code reviews, or pre-deployment security assessments.

Install

npx vskill@latest install 0xlayerghost/solidity-agent-kit/solidity-audit

SKILL.md

Solidity Security Audit Checklist

Language Rule

  • Always respond in the same language the user is using. If the user asks in Chinese, respond in Chinese. If in English, respond in English.
Usage: This skill is for security audits and code reviews. It is NOT auto-invoked — call /solidity-audit when reviewing contracts for vulnerabilities.

Contract-Level Vulnerabilities

1. Reentrancy
VariantDescriptionCheck
Same-functionAttacker re-enters the same function via fallback/receiveAll external calls after state updates (CEI pattern)?
Cross-functionAttacker re-enters a different function sharing stateAll functions touching shared state protected by nonReentrant?
Cross-contractAttacker re-enters through a different contract that reads stale stateExternal contracts cannot read intermediate state?
Read-onlyView function returns stale data during mid-execution stateNo critical view functions used as oracle during state transitions?

Case: GMX v1 (Jul 2025, $42M) — reentrancy in GLP pool on Arbitrum, attacker looped withdrawals to drain liquidity.

2. Access Control
CheckDetail
Missing modifierEvery state-changing function has explicit access control?
Modifier logicModifier actually reverts on failure (not just empty check)?
State flagAccess-once patterns properly update storage after each user?
Admin privilege scopeOwner powers are minimal and time-limited?

Case: Bybit (Feb 2025, $1.4B) — Safe{Wallet} UI injected with malicious JS, hijacked signing process. Not a contract flaw, but access control at the infrastructure layer.

3. Input Validation
CheckDetail
Zero addressAll address params reject address(0)?
Zero amountFund transfers reject zero amounts?
Array boundsPaired arrays validated for matching length?
Arbitrary callNo unvalidated address.call(data) where attacker controls data?
Numeric boundsInputs bounded to prevent dust attacks or gas griefing?
4. Flash Loan Attacks
VariantMechanismDefense
Price manipulationFlash-borrow → swap to move price → exploit price-dependent logic → repayTWAP oracle with min-liquidity check
GovernanceFlash-borrow governance tokens → vote → repay in same blockSnapshot voting + minimum holding period + timelock ≥ 48h
LiquidationFlash-borrow → manipulate collateral value → trigger liquidationMulti-oracle price verification + circuit breaker
Combo (rounding)Flash-borrow → manipulate pool → micro-withdrawals exploit rounding → repayMinimum withdrawal amount + virtual shares

Cases:

5. Oracle & Price
CheckDetail
Single oracle dependencyUsing multiple independent price sources?
Stale priceChecking updatedAt timestamp and rejecting old data?
Spot price usageNever using raw AMM reserves for pricing?
Minimum liquidityOracle reverts if pool reserves below threshold?
Price deviationCircuit breaker if price moves beyond threshold vs last known?
Chainlink round completenessChecking answeredInRound >= roundId?

Case: Cream Finance (Oct 2021, $130M) — attacker manipulated yUSD vault price by reducing supply, then used inflated collateral to drain all lending pools.

6. Numerical Issues
TypeDescriptionDefense
Primitive overflowuint256 a = uint8(b) + 1 — reverts if b=255 on Solidity ≥0.8Use consistent types, avoid implicit narrowing
Truncationint8(int256Value) — silently overflows even on ≥0.8Use SafeCast library for all type narrowing
Rounding / precision lossusdcAmount / 1e12 always rounds to 0 for small amountsMultiply before divide; check for zero result
Division before multiplication(a / b) * c loses precisionAlways (a * c) / b

Case: Bunni (Sep 2025, $8.4M) — rounding errors in micro-withdrawals exploited via flash loan.

7. Signature Issues
TypeDescriptionDefense
ecrecover returns address(0)Invalid sig returns address(0), not revertAlways check recovered != address(0)
Replay attackSame signature reused across txs/chainsInclude chainId + nonce + deadline in signed data
Signature malleabilityECDSA has two valid (s, v) pairs per signatureUse OpenZeppelin ECDSA.recover (enforces low-s)
Empty loop bypassSignature verification in for-loop, attacker sends empty arrayCheck signatures.length >= requiredCount before loop
Missing msg.sender bindingProof/signature not bound to callerAlways include msg.sender in signed/proven data
8. ERC20 Compatibility
IssueDescriptionDefense
Fee-on-transfertransfer(100) may deliver <100 tokensCheck balance before/after, use actual received amount
Rebase tokensToken balances change without transfersNever cache external balances; always read live
No bool returnSome tokens (USDT) don't return bool on transferUse SafeERC20.safeTransfer
ERC777 hooksTransfer hooks can trigger reentrancyUse ReentrancyGuard on all token-receiving functions
Zero-amount transfertransferFrom(A, B, 0) — address poisoningReject zero-amount transfers
Approval raceChanging allowance from N to M allows spending N+MUse safeIncreaseAllowance / safeDecreaseAllowance
9. MEV / Front-Running
TypeDescriptionDefense
Sandwich attackAttacker front-runs buy + back-runs sell around victimSlippage protection + deadline parameter
ERC4626 inflationFirst depositor donates to inflate share price, rounding out later depositorsMinimum first deposit or virtual shares (ERC4626 with offset)
Approval front-runAttacker spends old allowance before new allowance tx confirmsUse increaseAllowance not approve
Unrestricted withdrawalAttacker monitors mempool for withdraw tx, front-runs with ownRequire commit-reveal or auth binding
10. Storage & Low-Level
IssueDescription
Storage pointerFoo storage foo = arr[0]; foo = arr[1]; — does NOT update arr[0]
Nested deletedelete structWithMapping — inner mapping data persists
Private variablesAll contract storage is publicly readable via eth_getStorageAt
Unsafe delegatecallDelegatecall to untrusted contract can selfdestruct the caller
Proxy storage collisionUpgrade changes parent order → variables overwrite each other (use storage gaps)
msg.value in loopmsg.value doesn't decrease in loop — enables double-spend
11. Contract Detection Bypass
MethodHow it works
Constructor callAttack from constructor — extcodesize == 0 during deployment
CREATE2 pre-computePre-calculate contract address, use as EOA before deploying
12. Proxy & Upgrade Vulnerabilities
CheckDetail
_authorizeUpgrade access controlUUPS _authorizeUpgrade must have onlyOwner modifier?
Permissionless factory/registryCan attacker use permissionless factory (e.g. Aquifer boreWell) to satisfy upgrade checks?
upgradeTo modifierOverridden upgradeTo/upgradeToAndCall retains onlyProxy modifier?
Initializer protectioninitializer modifier prevents re-initialization? Implementation calls _disableInitializers()?
Storage layout compatibilityUpgrade-safe storage layout (storage gaps or ERC-7201 namespace)?

Case: Code4rena 2024-07-basin H-01 (via EVMbench Paper Fig.12, p.19) — _authorizeUpgrade only checked delegatecall and Aquifer registration but lacked onlyOwner, allowing anyone to upgrade a Well proxy to a malicious implementation and drain funds. Oracle patch: add a single onlyOwner modifier.

13. Trust Boundary & Protocol Composability
CheckDetail
Cross-vault trust isolationRegistry/Router relay calls verify vault-level authorization?
Trusted sender abuseFunctions like sendTokensToTrustedAddress verify source vault, not just router identity?
Flash loan + routing comboCan attacker use flash loan callback to make router impersonate arbitrary vault?
Collateral ownership verificationLiquidation/staking operations verify actual NFT/collateral owner?
Cross-contract state dependencyMulti-contract interactions free from intermediate state dependencies?

Cases:

14. State Ordering & Counter Manipulation
CheckDetail
Counter/ID increment ordercredIdCounter++ or similar ID increments happen before external calls?
Auto-buy in createcreate() functions with auto buy() calls execute only after ID/state fully initialized?
Refund timingETH refund (excess) happens after all state updates complete?
Bonding curve metadata overwriteCan attacker reenter to modify bonding curve/pricing params — buy cheap, switch to expensive curve, sell high?

Case: Code4rena 2024-08-phi H-06 (via EVMbench Paper Appendix H.1, p.25-28) — _createCredInternal called buyShareCred before incrementing credIdCounter; _handleTrade refunded excess ETH before updating lastTradeTimestamp. Attacker reentered to accumulate shares on cheap curve, overwrote metadata to expensive curve, sold to drain all contract ETH. Fix: add nonReentrant to buyShareCred/sellShareCred.

15. Per-Address State Bypass
Any restriction based on mapping(address => ...) can be circumvented by multi-address splitting or intermediate transfer.

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
2
Repository forks
1
7-day trend score
5

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 9 May 2026, 6 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/0xlayerghost/solidity-agent-kit/solidity-audit/badge)](https://verified-skill.com/skills/0xlayerghost/solidity-agent-kit/solidity-audit)

Something wrong with this skill or its page? Tell us.