thisishaidee/solana-incident-response-skill
GitHub: thisishaidee/solana-incident-response-skill
兼容 Solana AI Kit 的事件应急响应协调框架,在 Solana 安全事故发生时为团队提供从分诊到复盘的全流程结构化指导。
Stars: 0 | Forks: 0
# Solana 事件响应 Skill
一个兼容 Solana AI Kit 的 Skill,它能将 AI 代理转变为一个结构化的危机协调器,专门应对突发的 Solana 安全事件——包括漏洞利用、金库攻击、密钥泄露以及正在发生的协议紧急状况。
这不是一个安全审计工具。它不会在出事前审查代码。
它的存在是为了应对已经发生事故之后的危急时刻——此时,创始人、值班工程师或社区负责人需要按照正确的顺序快速行动,同时避免让情况恶化。
## 事件生命周期
```
Incident detected
│
▼
exploit-triage (classify type, severity, active/inactive status)
│
▼
containment (pause, freeze, revoke/rotate, frontend shutdown)
│
▼
multisig-coordination (signer paging, quorum, fallback — when authority needs a signature)
│
▼
communications (drafts only — internal, public, partner audiences)
│
▼
forensics (evidence, transaction mapping, attacker tracing)
│
▼
recovery (compensation, relaunch, migration, treasury, trust)
│
▼
postmortem (timeline, root cause, losses, fixes, lessons, follow-ups)
```
该顺序是固定的,并由 `SKILL.md` 的渐进式加载逻辑强制执行——当路由调度需要时,后期阶段可以与早期阶段并行启动(例如,遏制措施与 multisig 协调同时运行,或者在处理跨链桥事件时,取证与分诊同时进行),但任何阶段都不会被跳过,且复盘报告永远不会在做出恢复决策之前运行。具体的并行加载规则请参见 `skill/SKILL.md`。
## 本 Skill 的功能
加载后,此 Skill 会:
- **分类** 事件——在最初的几分钟内,利用 `skill/exploit-triage.md`,跨越五个维度对事件进行分类:漏洞类型、严重程度、协议类型、金库风险敞口和用户影响。
- **协调遏制措施**——根据协议实际可行的操作,精准匹配相应的遏制方案,例如暂停程序、冻结 token 权限、将前端下线等,通过 `skill/containment.md` 实现。
- **并行动员 multisig 签名者** 而非串行处理,并针对法定人数无法及时达成的情况提供明确的备用路径,通过 `skill/multisig-coordination.md` 实现。
- **起草(绝不自动发送)声明** 面向用户、投资者、合作伙伴、签名者和公开渠道,并根据严重程度调整内容规模,通过 `skill/communications.md` 及其针对特定受众的子模块(`communications/internal.md`、`communications/public.md`、`communications/partners.md`)实现。
- **保全证据并追踪漏洞**——包括交易序列、攻击者钱包动向、受影响账户等——通过 `skill/forensics.md` 及其子模块(`forensics/evidence.md`、`forensics/chain-analysis.md`、`forensics/attacker-tracing.md`)实现,并配备专门的 `agents/forensic-agent.md` 用于深度调查工作。
- **规划恢复方案**——包括赔偿选项、重新上线准备、金库重建、迁移等——通过 `skill/recovery.md` 及其子模块(`recovery/compensation.md`、`recovery/relaunch.md`、`recovery/migration.md`)实现。
- **编制完整、诚实的复盘报告**——在事件结束后,通过 `skill/postmortem.md` 和 `commands/generate-postmortem.md` 实现。
- **全程强制执行硬性操作规则**——没有达成真正的 multisig 法定人数绝不执行不可逆操作,绝不捏造数据,绝不过早进行公开披露——通过 `rules/emergency-rules.md` 实现,所有其他文件均需优先遵从该规则。
整个 Skill 围绕着**渐进式加载**构建:`SKILL.md` 仅加载与当前事件分类相关的路由模块——`communications.md`、`forensics.md`、`recovery.md`——然后每个路由仅根据事件类型、严重程度和受众分发其真正需要的子模块(如果集成商实际上并未受到波及,SEV-1 级别的金库耗尽事件就不会加载 `communications/partners.md`)。
一个没有金库风险敞口的 SEV-3 问题可能自始至终只会用到 `exploit-triage.md`。而伴有用户影响的 SEV-1 级别金库耗尽事件则会并行加载遏制措施、multisig 协调和 `communications.md`,并由该路由分发至相关的受众子模块,所有这些都由 `agents/incident-commander.md` 统一进行编排。
## 适用人群
- **Solana 创始人和核心贡献者**:他们需要一套结构化的初步响应方案,尤其是在团队大多数人从未经历过此类事件的情况下——因为在重压之下凭直觉临时发挥往往会导致本可避免的失误。
- **协议工程负责人和值班工程师**:他们需要清晰的遏制决策树,而不是靠猜来判断其特定程序实际能执行哪些操作。
- **Multisig 签名者和金库操作员**:他们需要一套标准的协调流程,避免在凌晨 2 点还要依赖某人凭记忆回想正确的操作顺序。
- **社区/通讯负责人**:他们需要经过审核的消息模板,而不是在重压之下从零开始撰写声明——在这种背景下,不当的语气或过早公布的数据都会造成真实且持久的信任损害。
- **任何基于 Solana AI Kit 进行构建的开发者**:如果希望参考高质量的示例,来学习多文件、渐进式加载且受规则控制的 Skill 架构。
本 Skill 假设读者已对 Solana 程序结构、multisig 设置(如 Squads)以及 SPL/Token-2022 机制有基本了解——它讲解的是事件响应流程,而不是从零开始介绍 Solana 的基础知识。
## 解决的问题
现实中的事件之所以恶化,往往不是因为没人了解漏洞,而更多是因为重压之下的流程失误:
- **串行呼叫签名者** 浪费了最关键的几分钟。
- **针对不可逆操作做出恐慌性决策**——例如永久撤销权限、仓促转移资金——其执行速度往往快于他们本应进行的验证速度。
- **过早发布公开声明** 附带了后来被证明是错误的数据或时间表,这比事件本身造成的信任破坏更大。
- **证据被销毁** 发生在取证团队来得及捕获之前——例如日志被清除、密钥被轮换、账户被关闭。
- **含糊其辞的复盘报告** 只会承诺“我们会做得更好”,却没有任何可检查的实质内容。
- **缺乏统一的协调声音**,导致团队和社区只能在一堆碎片化、前后不一的实时信息中拼凑事件真相。
本 Skill 的结构——即分类、遏制、协调、调查、恢复、报告,且全程由一套固定的硬性规则进行约束——正是为了专门应对上述每一种失败模式而设计的,而不仅仅是提供通用的“安全事件”建议。
## 安装
```
git clone solana-incident-response-skill
cd solana-incident-response-skill
chmod +x install.sh
./install.sh
```
`install.sh` 会将此 Skill 注册到你本地的 Solana AI Kit 配置中,以便系统能够发现 `skill/SKILL.md` 并识别其触发短语。关于其具体的分步操作,请直接查看 `install.sh` 脚本;在拉取本 Skill 的更新后,你可以随时重新运行它。
使用本 Skill 的推理逻辑和模板无需任何额外的依赖。
部分工作流(如取证、multisig 操作)假定你的代理已具备访问 Solana RPC/浏览器工具以及你的 multisig 界面(如 Squads)的权限——本 Skill 的作用是协调这些操作,并不能替代你原本所需的访问权限。
## 如何使用
在最简单的情况下,只需描述正在发生的情况:
这将自动触发 `commands/start-incident.md`,它会执行以下操作:
1. 开启一个事件日志。
2. 运行 Step 0 稳定化操作(不要恐慌性发布公告,保全证据,确保签名者能取得联系)。
3. 跨越五个维度对事件进行分类。
4. 仅加载该分类所需的具体文件——绝不多加。
5. 为你提供清晰的状态报告,并告知你现在需要立即做什么。
你也可以直接调用特定命令或引用特定文件:
- `/start-incident` — 明确启动完整工作流。
- `/generate-postmortem` — 在事件结束后,编制最终报告。
- 如果你已经清楚面对的是什么情况,且只需要遏制决策树,可直接参考 `skill/containment.md`。
对于任何 SEV-1 或 SEV-2 级别的事件,预计 `agents/incident-commander.md` 将接管并成为协调的主导者——它会将任务委托给相关的 Skill 文件,并将其输出协调成一个连贯的处理主线,而不需要你手动安排每一个步骤。
## 示例工作流
### 示例 1 — 活跃金库耗尽,SEV-1
```
You: "Funds are draining from our main vault right now, we don't know how."
→ start-incident.md opens the log, runs Step 0, classifies:
Type: unauthorized fund movement (specific root cause TBD)
Severity: SEV-1 (active, exposure unknown — defaults to SEV-1 per emergency-rules.md)
Treasury exposure: yes
→ incident-commander.md takes over, running in parallel:
- exploit-triage.md to pin down the specific vulnerability class
- containment.md to identify the fastest available stop (pause? freeze?)
- multisig-coordination.md, paging all signers simultaneously
- communications/internal.md drafting signer/investor updates; communications/public.md
drafting a holding statement for users (not yet published)
→ Once containment confirms the path is closed:
forensics/evidence.md preserves state, forensics/chain-analysis.md maps the exploit
transaction, forensics/attacker-tracing.md traces the attacker wallet and confirms
exact exposure
→ Once exposure is confirmed:
recovery/compensation.md plans compensation options; communications/public.md and
communications/internal.md replace placeholder figures with confirmed ones
→ Once recovery decisions are finalized:
/generate-postmortem compiles the full report
```
### 示例 2 — 可疑活动,严重程度不明
```
You: "Something looks off with our lending pool's pricing but I'm not sure it's an attack."
→ start-incident.md classifies:
Type: unclear — likely oracle-related based on symptom match
Severity: SEV-3 (no confirmed loss yet, contained-or-never-active)
Treasury exposure: no
→ Only exploit-triage.md loads, working through the classification questions and
Solana-specific root-cause checklist to determine whether this is a real exploit,
a feed staleness issue, or a false alarm — without escalating prematurely.
```
### 示例 3 — 事件后报告
```
You: "/generate-postmortem"
→ Checks preconditions: containment confirmed, forensics compiled, recovery decided.
→ Compiles timeline, confirmed root cause, losses, fixes, and lessons learned —
every figure sourced from the incident log and upstream files, nothing fabricated.
→ Flags whether a public version needs implementation detail withheld, and produces
both internal and public drafts if so.
```
### 完整场景模拟
若要全面了解在整个事件过程中每个文件和子模块是如何交互的(而不是孤立的示例),请参阅 `examples/`:
- `examples/oracle-manipulation.md` — 单一来源价格源遭到闪电贷式操纵攻击
- `examples/vault-drain.md` — 缺少所有者检查,单笔交易资产被抽取
- `examples/bridge-exploit.md` — 伪造的跨链消息,多资金池受到爆炸性波及
- `examples/compromised-admin.md` — 签名者遭遇社会工程学攻击泄露,无资金损失
每一份文件都追踪了完整的路径:触发 → 分诊 → 遏制 → multisig(如适用) → 声明 → 取证 → 恢复 → 复盘报告,并明确标出了每一步调用的实际文件和锚点。
## 架构参考
```
solana-incident-response-skill/
├── skill/
│ ├── SKILL.md — router: progressive-loading logic, 5-axis routing
│ ├── exploit-triage.md — classification, severity, active/inactive status
│ ├── containment.md — pause/freeze/revoke, escalation tree
│ ├── multisig-coordination.md — signer paging, quorum, fallback (execution only)
│ ├── communications.md — router for the 3 audience submodules below
│ │ ├── communications/internal.md — signers, investors, exchanges, press
│ │ ├── communications/public.md — users, X/Twitter, Discord/Telegram
│ │ └── communications/partners.md — ecosystem partners, integrators
│ ├── forensics.md — router + chain analysis workflow sequencer
│ │ ├── forensics/evidence.md — evidence/log preservation, bytecode snapshots
│ │ ├── forensics/chain-analysis.md — tx mapping, tool workflows, MEV, pattern matching
│ │ └── forensics/attacker-tracing.md — wallet tracing, cross-chain branch, affected accounts
│ ├── recovery.md — router + treasury rebuilding + trust framework
│ │ ├── recovery/compensation.md — reimbursement, insurance, claims, tax flags
│ │ ├── recovery/relaunch.md — readiness, risk tiers, relaunch sequencing
│ │ └── recovery/migration.md — patch vs. migrate, migration mechanics
│ ├── postmortem.md — after-action report structure
│ └── shared-definitions.md — canonical severity/status/role definitions
├── agents/
│ ├── incident-commander.md — orchestrator for SEV-1/SEV-2 incidents
│ └── forensic-agent.md — specialized on-chain investigation persona
├── commands/
│ ├── start-incident.md — opens incident, runs classification
│ └── generate-postmortem.md — compiles closed incident into final report
├── rules/
│ └── emergency-rules.md — always-on constraints every file defers to
├── examples/
│ ├── oracle-manipulation.md — full-lifecycle scenario simulation
│ ├── vault-drain.md — full-lifecycle scenario simulation
│ ├── bridge-exploit.md — full-lifecycle scenario simulation
│ └── compromised-admin.md — full-lifecycle scenario simulation
├── install.sh — registers this skill with your Solana AI Kit setup
└── LICENSE
```
`skill/` 下的每一个根级文件(`communications.md`、`forensics.md`、`recovery.md`)都是一个 **路由器**:它仅包含路由逻辑、横切关注点内容和指引——实际的模板、工作流和决策表都存放在其对应的子模块目录中。加载根文件以决定你需要哪个子模块;然后加载子模块获取实际内容。
完整的路由逻辑和渐进式加载设计,请参见 `skill/SKILL.md`。
## 许可证
MIT — 请参阅 `LICENSE`。
标签:Cutter, Solana, 事件协调, 区块链安全, 危机管理, 库, 应急响应, 防御加固