cairo-vulnerability-scanner

Scans Cairo/StarkNet smart contracts for six platform-specific vulnerability patterns.

Updated Apr 3, 2026
One-click install
npx skills add https://github.com/Ayoub-ouederni/SENTINEL --skill cairo-vulnerability-scanner-ayoub-ouederni
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cairo-vulnerability-scanner
Source: https://github.com/Ayoub-ouederni/SENTINEL/tree/main/.claude/skills/cairo-vulnerability-scanner
Command: npx skills add https://github.com/Ayoub-ouederni/SENTINEL --skill cairo-vulnerability-scanner-ayoub-ouederni

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Auditing StarkNet contracts requires deep knowledge of Cairo-specific risks like felt252 arithmetic overflow, L1-L2 messaging flaws, and signature replay, which generic Solidity audit checklists miss entirely. ## Core Features & Use Cases - Six Vulnerability Patterns: Detects felt252 arithmetic overflow, unchecked L1 handler from_address, L1-L2 address conversion issues, message failure without cancellation, overconstrained cross-layer validation, and signature replay. - Structured Audit Workflow: Guides a six-step scan covering platform identification, arithmetic safety, L1 handler analysis, signature review, bridge auditing, and Caracal static analysis. - Severity-Ranked Reporting: Produces findings with file locations, vulnerable code, attack scenarios, and remediation code, prioritized as Critical, High, or Medium. - Use Case: Before deploying a StarkNet token bridge, run this scan to verify every #[l1_handler] validates from_address and that L1 deposits implement message cancellation, preventing infinite mint or locked funds. ## Quick Start Scan the Cairo contracts in my src/ directory for StarkNet vulnerabilities and report any critical findings with fixes.

Frequently Asked Questions about cairo-vulnerability-scanner

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit Cairo smart contracts for vulnerabilities?

Scan Cairo contracts for six known StarkNet vulnerability patterns: felt252 arithmetic overflow, unchecked L1 handler from_address, address conversion issues, message failure, overconstrained validation, and signature replay. Use Caracal static analysis plus manual review of each #[l1_handler] function.

What is the unchecked from_address vulnerability in StarkNet L1 handlers?

L1 handler functions marked #[l1_handler] can be invoked by any L1 contract unless from_address is validated against the authorized bridge address. Missing validation lets attackers send forged messages and mint tokens without depositing funds.

Why is felt252 dangerous for balance arithmetic in Cairo?

felt252 wraps around the StarkNet field prime on overflow or underflow, so balances can silently wrap to near-P values. Use u128 or u256 types with built-in overflow protection, or add explicit bounds checks on felt252 arithmetic.

Does Caracal detect StarkNet vulnerabilities automatically?

Caracal, Trail of Bits' static analyzer for Cairo, includes detectors like unchecked-felt252-arithmetic, unchecked-l1-handler-from, and missing-nonce-validation. Run it with caracal detect src/ and integrate it into CI with failure thresholds on high and critical findings.

How do I prevent signature replay attacks in Cairo contracts?

Include a per-signer nonce that increments after each use and a domain separator containing the chain ID and contract address in the signed message hash. This prevents replay on the same chain and across mainnet and testnet.

What are the limitations of static analysis for StarkNet audits?

Static analysis cannot verify cross-layer behavior like L1-L2 message roundtrips or economic attack scenarios. Combine Caracal scans with unit tests for edge cases and integration tests covering full deposit-withdraw flows before mainnet deployment.