@trailofbits

创作者 · trailofbits

最近更新 · 2026年8月24日

cairo-vulnerability-scanner

审查 · 69已收录

Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging issues, address conversion problems, and signature replay. Use when auditing StarkNet projects.

OpenAgentSkill 信任评分
69/100

仅限沙盒

质量85/100
审计84/100
Stars6.8K
Verified installs0

安装目标

Codex 安装提示词

Install the "cairo-vulnerability-scanner" agent skill from https://github.com/trailofbits/skills/tree/main/plugins/building-secure-contracts/skills/cairo-vulnerability-scanner. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging issues, address conversion problems, and signature replay. Use when auditing StarkNet projects. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"trailofbits-cairo-vulnerability-scanner","task":"Install cairo-vulnerability-scanner","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.

供给资产档案

编程与开发 Agent

代码审查、仓库分析、测试、CI、GitHub、DevOps 与开发工作流 Skill。

浏览赛道

场景

GitHub automation

I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.

适配 Agent

Claude Code + CLI + Codex

适用于 Codex、Claude Code、Cursor、CLI 或自定义 Agent。

安装

就绪

npx skills add trailofbits/skills --skill cairo-vulnerability-scanner

维护状态

新鲜

今天有推送

风险

高风险

Financial research output is not financial advice; require human review before any live investment decision

GitHub 质量

6.8K

85/100 质量 · 77/100 信任

覆盖标签

编程GitHub automation安全agent-skill

审查说明

Financial research output is not financial advice; require human review before any live investment decision · Potential broker, wallet, exchange, or real-money execution surface; sandbox and explicit approval are required

Agent 采用评分卡

一眼查看信任、审计与安装准备度

这些分数综合公开仓库元数据、OpenAgentSkill 审查信号、维护新鲜度与安装准备度。它用于候选筛选,不替代人工审查。

质量

优秀
85

高置信候选,具有较强的采用度与健康维护信号。

信任

仅限沙盒
69

有用但信任信号不足或混杂的候选项。在结果闭环证明任务匹配前,请保持在隔离工作区内使用。

审计

高风险
84

对安装准备度、安全元数据、维护情况与采用风险的机器可读审查。

OpenAgentSkill 信任评分 v5

仅限沙盒

仅在沙盒中运行,并在用于真实工作前比较接近的替代方案。

CodexClaude CodeCursorOpenAgentSkill CLI

Stars

6.8K 个 GitHub Stars

仓库活跃度

6.8K 个 Star,585 个 Fork

维护状态

今天有推送

许可证

CC-BY-SA-4.0

安装

npx skills add trailofbits/skills --skill cairo-vulnerability-scanner

安装安全性

标准软件包或运行时安装路径

权限范围

shell or command execution, filesystem or document access

Agent 结果

暂未有 Agent 结果数据

文档

README/SKILL.md 上下文充分

风险摘要

生产前审查

  • SKILL.md does not explicitly list its own limitations (e.g., that it focuses on Cairo 1.x and may miss issues outside the six patterns).
  • Financial research output is not financial advice; require human review before any live investment decision.
  • This skill may touch real-money trading, broker, wallet, or exchange operations; use only in a sandbox with explicit approval.
  • Quality score needs review

安装准备度

安装路径可用

  • 安装路径可用
  • 仓库证据可用
  • 已声明许可证
  • 暂无 Agent 验证结果证据

Agent 可读元数据

这个 Skill 的机器可读决策数据。

使用此区块或内嵌 JSON 判断 Agent 是否应安装该 Skill、选择替代方案,或先请求人工审查。

View technical data+

适用任务

  • GitHub automation 工作流
  • Claude Code 团队
  • 重视 GitHub 采用信号的团队
  • Inspect repository metadata

适用 Agent

CodexClaude CodeCursorOpenAgentSkill CLICLI

安装决策

命令
npx skills add trailofbits/skills --skill cairo-vulnerability-scanner
策略
阻止
人工审查

信任与风险

信任
69/100
审计
84/100
风险级别
高风险

结果闭环

端点
/api/agent/outcome
事件 ID
resolve
结果
5

安装命令

npx skills add trailofbits/skills --skill cairo-vulnerability-scanner

不适用场景

  • 需要厂商支持 SLA 的团队
  • production agents without a repository review
  • SKILL.md does not explicitly list its own limitations (e.g., that it focuses on Cairo 1.x and may miss issues outside the six patterns).
  • 暂未有 OpenAgentSkill 使用反馈数据
  • Audit risk risky exceeds max_risk=medium

Agent 安全 v2

56/100 · 避免自动安装

Blocked for auto-install阻止

This skill should not be selected by an agent without explicit human security review.

Do not auto-install. Inspect the source, dependencies, and permission surface first.

通过 API 解析

Shell 或命令执行

Skill 元数据引用了终端、CLI、Shell、子进程或命令执行工作流。

网络访问

Skill 可能访问远程页面、API、仓库或外部服务。

文件系统访问

Skill 可能读取或写入项目文件、文档、生成产物或本地工作区状态。

  • Audit risk risky exceeds max_risk=medium
  • 高风险权限提示:Shell 或命令执行
  • Financial research output is not financial advice; require human review before any live investment decision

Agent 解析计划

让 Agent 在安装前验证匹配度。

Resolve API 返回首选 Skill、替代方案、安全策略、审计说明、安装目标和可直接执行的提示词,无需抓取此页面。

打开文本计划

Agent 应检查

  • 从 Resolve API 检查任务匹配与替代方案。
  • 检查审计评分、信任评分和安全策略警告。
  • 检查 Codex、Claude Code、Cursor 或 CLI 的安装目标兼容性。

复制提示词

Task: Use cairo-vulnerability-scanner in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20cairo-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/trailofbits-cairo-vulnerability-scanner/install
Install command: npx skills add trailofbits/skills --skill cairo-vulnerability-scanner
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.

Agent 交接

把安装路径交给 Agent,而不是再给一个目录页。

通过公开安装端点获取命令、安全清单、目标提示词和该 Skill 的规范链接。

打开安装 API

Agent 提示词

Use cairo-vulnerability-scanner for this task. Review https://www.openagentskill.com/api/skills/trailofbits-cairo-vulnerability-scanner/install, then install with: npx skills add trailofbits/skills --skill cairo-vulnerability-scanner

Registry 元数据

用于自动选择 Skill 的 Agent 可读档案。

本页通过 Registry API 提供相同的决策、信任、审计、场景和安装信号,让 Agent 无需抓取界面即可排序。

打开 Manifest

适配 Agent

96/100

GitHub automation

平台

Claude Code

审计报告

高风险 · 84/100

对安装准备度、安全元数据、维护情况与采用风险的机器可读审查。

查看审计报告查看评估报告

Agent 决策面板

适合 GitHub automation 的首选

将其作为优先候选,再在你的 Agent 环境中验证 README 与安装路径。

96
就绪度
采用
阶段

栈中角色

首选

主要匹配

GitHub automation

信任标签

可用于生产

安装路径

命令已就绪

适用场景

  • GitHub automation 工作流
  • Claude Code 团队
  • 重视 GitHub 采用信号的团队

证据

  • 6,823 个 GitHub Stars
  • 仓库近期活跃
  • 已提供安装命令或 GitHub 仓库
  • 85/100 质量档案

先审查

  • SKILL.md does not explicitly list its own limitations (e.g., that it focuses on Cairo 1.x and may miss issues outside the six patterns).
  • 暂未有 OpenAgentSkill 使用反馈数据

实施路径

  1. 1在沙盒 Agent 中安装它,并端到端完成一次GitHub automation任务。
  2. 2Compare output quality, latency, and failure behavior against at least one alternative.
  3. 3Promote it into production only after reviewing repository permissions, license, and maintenance signals.

信任档案

仅限沙盒

有用但信任信号不足或混杂的候选项。在结果闭环证明任务匹配前,请保持在隔离工作区内使用。

69
OpenAgentSkill 信任评分

GitHub 采用度

通过

6.8K 个 GitHub Stars

Star/Fork 活跃度

通过

6.8K 个 Star,585 个 Fork; 当前元数据中没有议题活跃度信息

近期维护

通过

今天有推送

许可证清晰度

通过

CC-BY-SA-4.0

积极信号

  • AI 审查已通过
  • 安装路径可用
  • 仓库证据可用
  • 近期维护的仓库
  • Large GitHub adoption signal
  • 安装命令未发现明显高风险模式
  • 结果闭环已就绪,但需要首次真实 Agent 运行

安装前审查

  • SKILL.md does not explicitly list its own limitations (e.g., that it focuses on Cairo 1.x and may miss issues outside the six patterns).
  • Financial research output is not financial advice; require human review before any live investment decision.
  • This skill may touch real-money trading, broker, wallet, or exchange operations; use only in a sandbox with explicit approval.
  • Quality score needs review
  • 暂未有真实 Agent 结果报告
  • 无人值守安装前需要人工审查

建议操作

仅在沙盒中运行,并在用于真实工作前比较接近的替代方案。

质量档案

优秀 适用于 Agent 工作流的候选

高置信候选,具有较强的采用度与健康维护信号。

85
GitHub Stars
6.8K
新鲜度
今天
安装就绪
许可证
CC-BY-SA-4.0
安装前审查: SKILL.md does not explicitly list its own limitations (e.g., that it focuses on Cairo 1.x and may miss issues outside the six patterns).

工作流匹配

在这些场景使用此 Skill

工作流匹配

加入完整工作流

替代方案短名单

安装前对比

可能适合该任务的相近 Skill。

对比全部

概览

--- name: cairo-vulnerability-scanner description: Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging issues, address conversion problems, and signature replay. Use when auditing StarkNet projects. ---

# Cairo/StarkNet Vulnerability Scanner

## 1. Purpose

Systematically scan Cairo smart contracts on StarkNet for platform-specific security vulnerabilities related to arithmetic, cross-layer messaging, and cryptographic operations. This skill encodes 6 critical vulnerability patterns unique to Cairo/StarkNet ecosystem.

## 2. When to Use This Skill

- Auditing StarkNet smart contracts (Cairo) - Reviewing L1-L2 bridge implementations - Pre-launch security assessment of StarkNet applications - Validating cross-layer message handling - Reviewing signature verification logic - Assessing L1 handler functions

## 3. Platform Detection

### File Extensions & Indicators - **Cairo files**: `.cairo`

### Language/Framework Markers ```rust // Cairo contract indicators #[contract] mod MyContract { use starknet::ContractAddress;

#[storage] struct Storage { balance: LegacyMap<ContractAddress, felt252>, }

#[external(v0)] fn transfer(ref self: ContractState, to: ContractAddress, amount: felt252) { // Contract logic }

#[l1_handler] fn handle_deposit(ref self: ContractState, from_address: felt252, amount: u256) { // L1 message handler } }

// Common patterns felt252, u128, u256 ContractAddress, EthAddress #[external(v0)], #[l1_handler], #[constructor] get_caller_address(), get_contract_address() send_message_to_l1_syscall ```

### Project Structure - `src/contract.cairo` - Main contract implementation - `src/lib.cairo` - Library modules - `tests/` - Contract tests - `Scarb.toml` - Cairo project configuration

### Tool Support - **Caracal**: Trail of Bits static analyzer for Cairo - Installation: `cargo install --git https://github.com/crytic/caracal --profile release --force` (a Rust tool — not on PyPI) - Usage: `caracal detect src/` - **cairo-test**: Built-in testing framework - **Starknet Foundry**: Testing and development toolkit

---

## 4. How This Skill Works

When invoked, I will:

1. **Search your codebase** for Cairo files 2. **Analyze each contract** for the 6 vulnerability patterns 3. **Report findings** with file references and severity 4. **Provide fixes** for each identified issue 5. **Check L1-L2 interactions** for messaging vulnerabilities

---

## 5. Example Output

When vulnerabilities are found, you'll get a report like this:

``` === CAIRO/STARKNET VULNERABILITY SCAN RESULTS === ```

---

## 6. Vulnerability Patterns (6 Patterns)

I check for 6 critical vulnerability patterns unique to Cairo/Starknet. For detailed detection patterns, code examples, mitigations, and testing strategies, see [VULNERABILITY_PATTERNS.md](resources/VULNERABILITY_PATTERNS.md).

### Pattern Summary:

1. **Unchecked Arithmetic** ⚠️ CRITICAL - Integer overflow/underflow in felt252 2. **Storage Collision** ⚠️ CRITICAL - Conflicting storage variable hashes 3. **Missing Access Control** ⚠️ CRITICAL - No caller validation on sensitive functions 4. **Improper Felt252 Boundaries** ⚠️ HIGH - Not validating felt252 range 5. **Unvalidated Contract Address** ⚠️ HIGH - Using untrusted contract addresses 6. **Missing Caller Validation** ⚠️ CRITICAL - No get_caller_address() checks

For complete vulnerability patterns with code examples, see [VULNERABILITY_PATTERNS.md](resources/VULNERABILITY_PATTERNS.md).

## 7. Scanning Workflow

### Step 1: Platform Identification 1. Verify Cairo language and StarkNet framework 2. Check Cairo version (Cairo 1.0+ vs legacy Cairo 0) 3. Locate contract files (`src/*.cairo`) 4. Identify L1-L2 bridge contracts (if applicable)

### Step 2: Arithmetic Safety Sweep ```bash # Find felt252 usage in arithmetic rg "felt252" src/ | rg "[-+*/]"

# Find balance/amount storage using felt252 rg "felt252" src/ | rg "balance|amount|total|supply"

# Should prefer u128, u256 instead ```

### Step 3: L1 Handler Analysis For each `#[l1_handler]` function: - [ ] Validates `from_address` parameter - [ ] Checks address != zero - [ ] Has proper access control - [ ] Emits events for monitoring

### Step 4: Signature Verification Review For signature-based functions: - [ ] Includes nonce tracking - [ ] Nonce incremented after use - [ ] Domain separator includes chain ID and contract address - [ ] Cannot replay signatures

### Step 5: L1-L2 Bridge Audit If contract includes bridge functionality: - [ ] L1 validates address < STARKNET_FIELD_PRIME - [ ] L1 implements message cancellation - [ ] L2 validates from_address in handlers - [ ] Symmetric access controls L1 ↔ L2 - [ ] Test full roundtrip flows

### Step 6: Static Analysis with Caracal ```bash # Run Caracal detectors caracal detect src/

# Specific detectors caracal detect src/ --detectors unchecked-felt252-arithmetic caracal detect src/ --detectors unchecked-l1-handler-from caracal detect src/ --detectors missing-nonce-validation ```

---

## 8. Reporting Format

### Finding Template ````markdown ## [CRITICAL] Unchecked from_address in L1 Handler

**Location**: `src/bridge.cairo:145-155` (handle_deposit function)

**Description**: The `handle_deposit` L1 handler function does not validate the `from_address` parameter. Any L1 contract can send messages to this function and mint tokens for arbitrary users, bypassing the intended L1 bridge access controls.

**Vulnerable Code**: ```rust // bridge.cairo, line 145 #[l1_handler] fn handle_deposit( ref self: ContractState, from_address: felt252, // Not validated! user: ContractAddress, amount: u256 ) { let current_balance = self.balances.read(user); self.balances.write(user, current_balance + amount); } ```

**Attack Scenario**: 1. Attacker deploys malicious L1 contract 2. Malicious contract calls `starknetCore.sendMessageToL2(l2Contract, selector, [attacker_address, 1000000])` 3. L2 handler processes message without checking sender 4. Attacker receives 1,000,000 tokens without depositing any funds 5. Protocol suffers infinite mint vulnerability

**Recommendation**: Validate `from_address` against authorized L1 bridge: ```rust #[l1_handler] fn handle_deposit( ref self: ContractState, from_address: felt252, user: ContractAddress, amount: u256 ) { // Validate L1 sender let authorized_l1_bridge = self.l1_bridge_address.read(); assert(from_address == authorized_l1_bridge, 'Unauthorized L1 sender');

let current_balance = self.balances.read(user); self.balances.write(user, current_balance + amount); } ```

**References**: - building-secure-contracts/not-so-smart-contracts/cairo/unchecked_l1_handler_from - Caracal detector: `unchecked-l1-handler-from` ````

---

## 9. Priority Guidelines

### Critical (Immediate Fix Required) - Unchecked from_address in L1 handlers (infinite mint) - L1-L2 address conversion issues (funds to zero address)

### High (Fix Before Deployment) - Felt252 arithmetic overflow/underflow (balance manipulation) - Missing signature replay protection (replay attacks) - L1-L2 message failure without cancellation (locked funds)

### Medium (Address in Audit) - Overconstrained L1-L2 interactions (trapped funds)

---

## 10. Testing Recommendations

### Unit Tests ```rust #[cfg(test)] mod tests { use super::*;

#[test] fn test_felt252_overflow() { // Test arithmetic edge cases }

#[test] #[should_panic] fn test_unauthorized_l1_handler() { // Wrong from_address should fail }

#[test] fn test_signature_replay_protection() { // Same signature twice should fail } } ```

### Integration Tests (with L1) ```rust // Test full L1-L2 flow #[test] fn test_deposit_withdraw_roundtrip() { // 1. Deposit on L1 // 2. Wait for L2 processing // 3. Verify L2 balance // 4. Withdraw to L1 // 5. Verify L1 balance restored } ```

### Caracal CI Integration ```yaml # .github/workflows/security.yml - name: Run Caracal run: | # Rebuilds from source each run; cache ~/.cargo or pin a release binary instead. cargo install --git https://github.com/crytic/caracal --profile release --force caracal detect src/ --fail-on high,critical ```

---

## 11. Additional Resources

- **Building Secure Contracts**: `building-secure-contracts/not-so-smart-contracts/cairo/` - **Caracal**: https://github.com/crytic/caracal - **Cairo Documentation**: https://book.cairo-lang.org/ - **StarkNet Documentation**: https://docs.starknet.io/ - **OpenZeppelin Cairo Contracts**: https://github.com/OpenZeppelin/cairo-contracts

---

## 12. Quick Reference Checklist

Before completing Cairo/StarkNet audit:

**Arithmetic Safety (HIGH)**: - [ ] No felt252 used for balances/amounts (use u128/u256) - [ ] OR felt252 arithmetic has explicit bounds checking - [ ] Overflow/underflow scenarios tested

**L1 Handler Security (CRITICAL)**: - [ ] ALL `#[l1_handler]` functions validate `from_address` - [ ] from_address compared against stored L1 contract address - [ ] Cannot bypass by deploying alternate L1 contract

**L1-L2 Messaging (HIGH)**: - [ ] L1 bridge validates addresses < STARKNET_FIELD_PRIME - [ ] L1 bridge implements message cancellation - [ ] L2 handlers check from_address - [ ] Symmetric validation rules L1 ↔ L2 - [ ] Full roundtrip flows tested

**Signature Security (HIGH)**: - [ ] Signatures include nonce tracking - [ ] Nonce incremented after each use - [ ] Domain separator includes chain ID and contract address - [ ] Signature replay tested and prevented - [ ] Cross-chain replay prevented

**Tool Usage**: - [ ] Caracal scan completed with no critical findings - [ ] Unit tests cover all vulnerability scenarios - [ ] Integration tests verify L1-L2 flows - [ ] Testnet deployment tested before mainnet

技术详情

版本
1.0.0
许可证
CC-BY-SA-4.0
最近更新
2026年8月24日
发布时间
2026年8月24日

决策摘要

首选

96
就绪
采用
阶段

6,823 个 GitHub Stars

审计

安装审查

安装与采用审查

84
高风险
安全性
78/100
维护状态
100/100
安装
92/100
打开完整审计查看评估报告

Agent 验证证据

Agent 验证证据

来自解析、审查、安装和一次小范围运行后的结果报告。

0
已验证
Needs first agent run自动安装: 先审查最近: 未知
成功率
近期失败
结果
0
输出质量
失败
0
不相关
0
安装次数
0
风险拦截
0
需要配置
0
生产环境
0

暂时没有 Agent 结果数据。首次 Agent 执行可以通过 /api/agent/outcome 报告成功、需要设置、风险拦截、失败或不相关。

安装

加入 Agent 工作流

免费且开源. 在生产 Agent 中安装前请先审查报告。

增长闭环

分享工具包

X

为 cairo-vulnerability-scanner 准备的场景化草稿,可手动发布到 X。

策展说明
cairo-vulnerability-scanner: Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithme...

6.8K stars

https://www.openagentskill.com/skills/trailofbits-cairo-vulnerability-scanner?ref=x
打开 X 草稿
可选:带安装命令的回复
Listing + install path for cairo-vulnerability-scanner:
https://www.openagentskill.com/skills/trailofbits-cairo-vulnerability-scanner?ref=x

Install: npx skills add trailofbits/skills --skill cairo-vulnerability-scanner
打开回复草稿

收录来源

Registry 收录

可认领

此列表来自公开来源,维护者认领获批前不会标记为官方。

创作者
trailofbits
收录方
OpenAgentSkill 社区索引

归属链接指向公开仓库或创作者主页。创作者可认领列表以更新所有权信号。

认领此 Skill

所有者认领

认领此 Skill 页面

这条 Registry 收录 列表归属于 trailofbits,但尚未标记为官方。认领后可增加已验证所有者信号,使后续发布、安装和审计更新更值得信赖。

创作者外链工具包

将证据徽章加入你的 README

在开发者评估仓库的位置展示规范页面、当前信任与审计信号,以及真实的 Agent 验证证据。

[![Listed on OpenAgentSkill](https://www.openagentskill.com/api/badge/trailofbits-cairo-vulnerability-scanner?metric=listed&label=Listed)](https://www.openagentskill.com/skills/trailofbits-cairo-vulnerability-scanner)
[![OpenAgentSkill Trust](https://www.openagentskill.com/api/badge/trailofbits-cairo-vulnerability-scanner?metric=trust&label=Trust)](https://www.openagentskill.com/skills/trailofbits-cairo-vulnerability-scanner)
[![OpenAgentSkill Audit](https://www.openagentskill.com/api/badge/trailofbits-cairo-vulnerability-scanner?metric=audit&label=Audit)](https://www.openagentskill.com/skills/trailofbits-cairo-vulnerability-scanner/audit)
[![Agent Proven](https://www.openagentskill.com/api/badge/trailofbits-cairo-vulnerability-scanner?metric=proven&label=Agent%20Proven)](https://www.openagentskill.com/skills/trailofbits-cairo-vulnerability-scanner)

作者

T

trailofbits

@trailofbits

平台适配

健康信号

GitHub Stars
6.8K
质量评分
50/100
最近 GitHub 推送
2026年8月24日
框架提示
未知
OpenAgentSkill 浏览量
0
复制安装命令
0
跳转点击
0

社区信号

告诉我们这个 Skill 是否对你的 Agent 工作流有帮助。汇总反馈会持续改善排序。

信任与安全

仅限沙盒

69
  • GitHub 采用度6.8K 个 GitHub Stars通过
  • Star/Fork 活跃度6.8K 个 Star,585 个 Fork; 当前元数据中没有议题活跃度信息通过
  • 近期维护今天有推送通过
  • 许可证清晰度CC-BY-SA-4.0通过
  • README/SKILL.md 完整度元数据包含足够的用法与工作流上下文通过
  • 依赖与运行时风险命令执行范围信息