cairo-vulnerability-scanner — Claude Code skill: Cairo contract audit
cairo-vulnerability-scanner — a skill that scans Cairo contracts on StarkNet for 6 vulnerability patterns, from felt252 overflow to replayed signatures. Use it when auditing L1-L2 bridges.
CC-BY-SA-4.0 5,700 installs ★ 8,341 updated 2026-10-24
npx skills add trailofbits/skills --skill cairo-vulnerability-scanner -a claude-codeWhat cairo-vulnerability-scanner does
The skill walks through the .cairo files in a project and checks each contract against 6 StarkNet-specific vulnerability patterns. They include silent felt252 wraparound, replayable signatures, an L1 address never compared with STARKNET_FIELD_PRIME, and L1 to L2 messages with no way to cancel. The worst one, an unchecked from_address in an #[l1_handler], is rated CRITICAL. The others are HIGH or MEDIUM.
It works in steps: identify the Cairo version and contract files, search for felt252 in arithmetic with rg, go through every L1 handler, review nonces and domain separators in signature code, audit the bridge, then run caracal detect src/. Each finding comes with a file location and a suggested fix.
Before the findings, the report shows a coverage table where all 6 patterns get a verdict, even those that turned up nothing. So a quiet pattern never reads as a clean contract. The static analysis step needs Caracal installed first: it is a Rust tool, installed with cargo, not from PyPI.
What it helps with
- find
felt252balances that wrap silently - check that every
#[l1_handler]validatesfrom_address - confirm signatures cannot be replayed
- review an L1-L2 bridge before launch
- get a suggested fix for each finding
Example prompts for the agent
- Scan the Cairo contracts in
src/with cairo-vulnerability-scanner - Audit this StarkNet bridge: check every
#[l1_handler]and the message cancellation path - Check the signature code in my
.cairofiles for nonce and domain separator problems
How to install cairo-vulnerability-scanner
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill cairo-vulnerability-scanner -a claude-code2Manually: put the files in place
~/.claude/skills/cairo-vulnerability-scanner/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cairo-vulnerability-scanner/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill cairo-vulnerability-scanner -a codex2Manually: put the files in place
.agents/skills/cairo-vulnerability-scanner/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill cairo-vulnerability-scanner -a cursor2Manually: put the files in place
.cursor/skills/cairo-vulnerability-scanner/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install trailofbits/skills plugins/building-secure-contracts/skills/cairo-vulnerability-scanner2Manually: put the files in place
.github/skills/cairo-vulnerability-scanner/SKILL.md1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill cairo-vulnerability-scanner -a gemini-cli2Platform CLI
gemini skills install https://github.com/trailofbits/skills --path plugins/building-secure-contracts/skills/cairo-vulnerability-scannerManually: put the files in place
.devin/skills/cairo-vulnerability-scanner/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add trailofbits/skills --skill cairo-vulnerability-scanner -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about cairo-vulnerability-scanner
How do I install cairo-vulnerability-scanner in Claude Code?
Run npx skills add trailofbits/skills --skill cairo-vulnerability-scanner -a claude-code. The skill file should end up at ~/.claude/skills/cairo-vulnerability-scanner/SKILL.md.
What does cairo-vulnerability-scanner do?
It checks .cairo files against 6 StarkNet vulnerability patterns. The report opens with a coverage table, followed by findings and fixes.
Does cairo-vulnerability-scanner need Caracal?
The static analysis step does: it runs caracal detect src/. Caracal is a Rust tool, installed with cargo and not from PyPI.