entry-point-analyzer by trailofbits/skills
npx skills add https://github.com/trailofbits/skills --skill entry-point-analyzer系统性地识别智能合约代码库中所有状态变更入口点,以指导安全审计。
在以下情况下使用此技能:
请勿将此技能用于:
本技能专门关注可以修改状态的函数。排除项:
| 语言 | 排除模式 |
|---|---|
| Solidity | view、pure 函数 |
| Vyper | @view、 函数 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
@pure| Solana | 没有 mut 账户引用的函数 |
| Move | 非入口 public fun(仅模块可调用) |
| TON | get 方法(FunC),只读接收器(Tact) |
| CosmWasm | query 入口点及其处理程序 |
为何排除只读函数? 它们不能直接导致资金损失或状态损坏。虽然它们可能泄露信息,但审计的主要焦点是能够改变状态的函数。
对于 Solidity 代码库,Slither 可以自动提取入口点。在手动分析之前:
which slither
slither . --print entry-points
这将输出包含以下内容的所有状态变更入口点的表格:
如果 which slither 没有返回任何内容,则使用特定语言的参考文件进行手动分析。
| 扩展名 | 语言 | 参考文件 |
|---|---|---|
.sol | Solidity | {baseDir}/references/solidity.md |
.vy | Vyper | {baseDir}/references/vyper.md |
.rs + 带有 solana-program 的 Cargo.toml | Solana (Rust) | {baseDir}/references/solana.md |
.move + 带有 edition 的 Move.toml | {baseDir}/references/move-sui.md | |
.move + 带有 Aptos 的 Move.toml | {baseDir}/references/move-aptos.md | |
.fc、.func、.tact | TON (FunC/Tact) | {baseDir}/references/ton.md |
.rs + 带有 cosmwasm-std 的 Cargo.toml | CosmWasm | {baseDir}/references/cosmwasm.md |
在分析之前,根据检测到的语言加载相应的参考文件。
将每个状态变更入口点分类为以下类别之一:
任何人都可以调用且没有限制的函数。
仅限于特定角色的函数。需要检测的常见模式:
admin、owner、governance、guardian、operator、manager、minter、pauser、keeper、relayer、lender、borroweronlyRole、hasRole、require(msg.sender == X)、assert_owner、#[access_control]只能由其他合约调用,不能由外部账户(EOA)调用的函数。指示器:
onERC721Received、uniswapV3SwapCallback、flashLoanCallbacktx.origin == msg.sender 则回退的函数生成具有以下结构的 Markdown 报告:
# 入口点分析:[项目名称]
**分析时间**:[时间戳]
**范围**:[分析的目录或"完整代码库"]
**语言**:[检测到的语言]
**焦点**:仅限状态变更函数(排除 view/pure)
## 摘要
| 类别 | 数量 |
|----------|-------|
| 公开(无限制) | X |
| 角色限制 | X |
| 限制(需要审查) | X |
| 仅限合约 | X |
| **总计** | **X** |
---
## 公开入口点(无限制)
任何人都可以调用的状态变更函数——优先进行攻击面分析。
| 函数 | 文件 | 备注 |
|----------|------|-------|
| `functionName(params)` | `path/to/file.sol:L42` | 相关简要说明 |
---
## 角色限制入口点
### 管理员 / 所有者
| 函数 | 文件 | 限制 |
|----------|------|-------------|
| `setFee(uint256)` | `Config.sol:L15` | `onlyOwner` |
### 治理
| 函数 | 文件 | 限制 |
|----------|------|-------------|
### 守护者 / 暂停者
| 函数 | 文件 | 限制 |
|----------|------|-------------|
### 其他角色
| 函数 | 文件 | 限制 | 角色 |
|----------|------|-------------|------|
---
## 限制(需要审查)
具有需要手动验证的访问控制模式的函数。
| 函数 | 文件 | 模式 | 审查原因 |
|----------|------|---------|------------|
| `execute(bytes)` | `Executor.sol:L88` | `require(trusted[msg.sender])` | 动态信任列表 |
---
## 仅限合约(内部集成点)
只能由其他合约调用的函数——有助于理解信任边界。
| 函数 | 文件 | 预期调用者 |
|----------|------|-----------------|
| `onFlashLoan(...)` | `Vault.sol:L200` | 闪电贷提供者 |
---
## 已分析文件
- `path/to/file1.sol` (X 个状态变更入口点)
- `path/to/file2.sol` (X 个状态变更入口点)
当用户指定目录过滤器时:
src/core/" → 范围 = src/core/view、pure 及等效的只读函数。| 协议类型 | 常见角色 |
|---|---|
| DEX | owner、feeManager、pairCreator |
| 借贷 | admin、guardian、liquidator、oracle |
| 治理 | proposer、executor、canceller、timelock |
| NFT | minter、admin、royaltyReceiver |
| 桥接 | relayer、guardian、validator、operator |
| 金库/收益 | strategist、keeper、harvester、manager |
分析入口点时,拒绝以下简化理由:
如果文件无法解析:
每周安装量
1.1K
代码仓库
GitHub 星标
3.9K
首次出现
2026年1月19日
安全审计
安装于
claude-code988
opencode978
gemini-cli927
codex925
cursor896
github-copilot867
Systematically identify all state-changing entry points in a smart contract codebase to guide security audits.
Use this skill when:
Do NOT use this skill for:
This skill focuses exclusively on functions that can modify state. Excluded:
| Language | Excluded Patterns |
|---|---|
| Solidity | view, pure functions |
| Vyper | @view, @pure functions |
| Solana | Functions without mut account references |
| Move | Non-entry public fun (module-callable only) |
| TON | get methods (FunC), read-only receivers (Tact) |
| CosmWasm | query entry point and its handlers |
Why exclude read-only functions? They cannot directly cause loss of funds or state corruption. While they may leak information, the primary audit focus is on functions that can change state.
For Solidity codebases, Slither can automatically extract entry points. Before manual analysis:
which slither
slither . --print entry-points
This outputs a table of all state-changing entry points with:
If which slither returns nothing, proceed with manual analysis using the language-specific reference files.
| Extension | Language | Reference |
|---|---|---|
.sol | Solidity | {baseDir}/references/solidity.md |
.vy | Vyper | {baseDir}/references/vyper.md |
.rs + Cargo.toml with solana-program | Solana (Rust) | {baseDir}/references/solana.md |
Load the appropriate reference file(s) based on detected language before analysis.
Classify each state-changing entry point into one of these categories:
Functions callable by anyone without restrictions.
Functions limited to specific roles. Common patterns to detect:
admin, owner, governance, guardian, operator, manager, minter, pauser, keeper, relayer, lender, borrowerFunctions callable only by other contracts, not by EOAs. Indicators:
onERC721Received, uniswapV3SwapCallback, flashLoanCallbacktx.origin == msg.senderGenerate a markdown report with this structure:
# Entry Point Analysis: [Project Name]
**Analyzed**: [timestamp]
**Scope**: [directories analyzed or "full codebase"]
**Languages**: [detected languages]
**Focus**: State-changing functions only (view/pure excluded)
## Summary
| Category | Count |
|----------|-------|
| Public (Unrestricted) | X |
| Role-Restricted | X |
| Restricted (Review Required) | X |
| Contract-Only | X |
| **Total** | **X** |
---
## Public Entry Points (Unrestricted)
State-changing functions callable by anyone—prioritize for attack surface analysis.
| Function | File | Notes |
|----------|------|-------|
| `functionName(params)` | `path/to/file.sol:L42` | Brief note if relevant |
---
## Role-Restricted Entry Points
### Admin / Owner
| Function | File | Restriction |
|----------|------|-------------|
| `setFee(uint256)` | `Config.sol:L15` | `onlyOwner` |
### Governance
| Function | File | Restriction |
|----------|------|-------------|
### Guardian / Pauser
| Function | File | Restriction |
|----------|------|-------------|
### Other Roles
| Function | File | Restriction | Role |
|----------|------|-------------|------|
---
## Restricted (Review Required)
Functions with access control patterns that need manual verification.
| Function | File | Pattern | Why Review |
|----------|------|---------|------------|
| `execute(bytes)` | `Executor.sol:L88` | `require(trusted[msg.sender])` | Dynamic trust list |
---
## Contract-Only (Internal Integration Points)
Functions only callable by other contracts—useful for understanding trust boundaries.
| Function | File | Expected Caller |
|----------|------|-----------------|
| `onFlashLoan(...)` | `Vault.sol:L200` | Flash loan provider |
---
## Files Analyzed
- `path/to/file1.sol` (X state-changing entry points)
- `path/to/file2.sol` (X state-changing entry points)
When user specifies a directory filter:
src/core/" → scope = src/core/view, pure, and equivalent read-only functions.| Protocol Type | Common Roles |
|---|---|
| DEX | owner, feeManager, pairCreator |
| Lending | admin, guardian, liquidator, oracle |
| Governance | proposer, executor, , |
When analyzing entry points, reject these shortcuts:
If a file cannot be parsed:
Weekly Installs
1.1K
Repository
GitHub Stars
3.9K
First Seen
Jan 19, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code988
opencode978
gemini-cli927
codex925
cursor896
github-copilot867
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
NestJS专家服务 | 企业级TypeScript后端开发与架构设计
1,000 周安装
安全代码卫士:AI驱动的安全编码指南与最佳实践,防止SQL注入、XSS攻击
1,000 周安装
ESLint迁移到Oxlint完整指南:JavaScript/TypeScript项目性能优化工具
1,000 周安装
Chrome CDP 命令行工具:轻量级浏览器自动化,支持截图、执行JS、无障碍快照
1,000 周安装
Sanity内容建模最佳实践:结构化内容设计原则与无头CMS指南
1,000 周安装
AI Sprint规划器 - 敏捷团队Scrum迭代计划工具,自动估算故事点与容量管理
1,000 周安装
.move + Move.toml with edition | {baseDir}/references/move-sui.md |
.move + Move.toml with Aptos | {baseDir}/references/move-aptos.md |
.fc, .func, .tact | TON (FunC/Tact) | {baseDir}/references/ton.md |
.rs + Cargo.toml with cosmwasm-std | CosmWasm | {baseDir}/references/cosmwasm.md |
onlyRole, hasRole, require(msg.sender == X), assert_owner, #[access_control]cancellertimelock| NFT | minter, admin, royaltyReceiver |
| Bridge | relayer, guardian, validator, operator |
| Vault/Yield | strategist, keeper, harvester, manager |