cairo-vulnerability-scanner

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

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/TECH-HY/SKILLS --skill cairo-vulnerability-scanner-tech-hy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cairo-vulnerability-scanner
Source: https://github.com/TECH-HY/SKILLS/tree/main/skills/cairo-vulnerability-scanner
Command: npx skills add https://github.com/TECH-HY/SKILLS --skill cairo-vulnerability-scanner-tech-hy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires caracal, and includes references (resource) components.

What problem does it solve? Auditing Cairo/StarkNet smart contracts requires deep knowledge of platform-specific risks like felt252 arithmetic overflow, L1-L2 messaging failures, and signature replay, which generic Solidity-focused tools do not cover. ## Core Features & Use Cases - Six Vulnerability Patterns: Detects unchecked felt252 arithmetic, storage collision, missing access control, improper felt252 boundaries, unvalidated contract addresses, and unchecked from_address in L1 handlers. - L1-L2 Bridge Auditing: Reviews cross-layer messaging for address conversion issues, missing cancellation mechanisms, and asymmetric validation between layers. - Tool Integration: Works with Caracal static analyzer and provides grep-based scanning workflows, severity-ranked reports, and remediation code examples. - 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 exploits. ## Quick Start Scan the Cairo contracts in my src/ directory for StarkNet vulnerabilities and report findings with severity and 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 scan Cairo smart contracts for vulnerabilities?

Run pattern-based analysis over .cairo files checking for six known StarkNet vulnerability classes, then confirm findings with the Caracal static analyzer using commands like caracal detect src/. Each finding includes severity, location, and remediation code.

What vulnerabilities are unique to StarkNet Cairo contracts?

Key risks include felt252 arithmetic overflow and underflow, unchecked from_address in #[l1_handler] functions, L1-to-L2 address conversion failures, missing message cancellation, and signature replay without nonce or domain separation.

Does Caracal work for Cairo static analysis?

Yes, Caracal is Trail of Bits' static analyzer for Cairo and can be installed with pip install caracal. It supports detectors such as unchecked-felt252-arithmetic, unchecked-l1-handler-from, and missing-nonce-validation.

Why is felt252 dangerous for token balances in Cairo?

felt252 wraps modulo the StarkNet prime, so subtraction can underflow to a huge value and addition can overflow past the field prime. Use u128 or u256 for balances, which have built-in overflow protection, or add explicit bounds checks.

When should I not rely only on automated Cairo scanning?

Automated pattern matching cannot verify business logic, economic incentives, or complex cross-contract interactions. Combine scanning with manual review, unit tests for each vulnerability scenario, and integration tests covering full L1-L2 roundtrip flows.