
"这个 CVE 真的影响到我了吗?" — 几秒钟内得到答案,而不是几小时。
Sentinel 接收一个 CVE ID,从 NVD、OSV.dev 和 MITRE 获取数据,然后使用 Claude 生成一份清晰可操作的 5 部分漏洞简报。
cd sentinel/
pip install -e .
# 必需:Anthropic API 密钥
sentinel config set api-key sk-ant-...
# 可选:NVD API 密钥(更高速率限制)
sentinel config set nvd-key xxxxxxxx-xxxx-...
# 或者使用环境变量
export ANTHROPIC_API_KEY=sk-ant-...
export NVD_API_KEY=xxxxxxxx-xxxx-...
# 解释一个 CVE(带彩色终端输出的 5 部分报告)
sentinel cve CVE-2024-3094
# 选择输出角色(参见下面的角色)
sentinel cve CVE-2024-3094 --format exec # 高管 / CISO 摘要
sentinel cve CVE-2024-3094 -f engineer # 深度技术建议
sentinel cve CVE-2024-3094 -f devops # 基础设施聚焦
sentinel cve CVE-2024-3094 -f security # 默认 5 部分报告
# 也可与 scan 结合使用
sentinel scan . --cve CVE-2024-3094 --format exec
# JSON 输出
sentinel cve CVE-2024-3094 --json
# Markdown 输出
sentinel cve CVE-2024-3094 --markdown
# 简要一段总结
sentinel cve CVE-2024-3094 --brief
# 跳过缓存,获取最新数据
sentinel cve CVE-2024-3094 --no-cache
# 详细模式(显示计时和来源详情)
sentinel cve CVE-2024-3094 -v
--format / -f)security(默认)— 安全分析师经典的 5 部分漏洞简报:
| 部分 | 回答内容 |
|---|---|
| 🔍 它是什么 | 通俗易懂的解释 |
| 💥 如何利用 | 攻击向量、PoC 摘要、难度 |
| 🚨 谁该紧张 | 受影响的软件、版本、生态系统 |
| 🛡️ 如何安全修补 | 修复步骤、补丁链接 |
| ✅ 要测试什么 | 修补后的验证步骤 |
exec — 高管 / CISO帮助繁忙高管快速阅读的 10 秒版。红绿灯严重性、业务影响、一个行动项。无专业术语。
🔴 严重 — CVE-2024-3094(XZ 后门)
一个后门被植入到大多数服务器使用的核心 Linux 压缩库中。
攻击者可以拦截并修改任何运行 xz 5.6.0-5.6.1 版本的系统上的数据。
需要立即降级 — 预计每台服务器 15-30 分钟,无需停机。
风险:供应链攻陷 — 高严重性,正在被利用
影响:所有运行受影响版本的 Linux 基础设施
所需操作:将 xz 降级到 5.4.6。使用 `xz --version` 验证。
engineer — 软件工程师深度技术细节,包含精确版本、升级命令、grep 模式及测试步骤:
| 部分 | 重点 |
|---|---|
| 📦 受影响的库和版本 | 精确版本范围、依赖链 |
| 🔧 代码级修复 | 特定升级命令、配置变更 |
| 🔍 需要 grep 什么 | 在代码库中搜索的模式 |
| 🧪 如何测试修复 | 验证命令、回归测试 |
| ⚠️ 重大变更 | 弃用、行为差异 |
devops — DevOps / SRE聚焦基础设施,包含容器、K8s、CI/CD 和监控:
| 部分 | 重点 |
|---|---|
| 🏗️ 受影响的基础设施 | 基础镜像、容器、云服务 |
| 🚀 部署影响 | 滚动更新策略、停机评估 |
| 🔄 回滚计划 | 如果补丁引发问题如何回退 |
| 📊 监控与检测 | 日志、告警、利用检测 |
| 🚨 事件响应步骤 | 若正在被利用时的逐步操作 |
Sentinel 能够检测标准扫描器遗漏的移动应用构建配置中的依赖:
| 生态系统 | 解析的文件 | 锁定文件(首选) |
|---|---|---|
| Android (Gradle) | build.gradle, build.gradle.kts, gradle/libs.versions.toml | — |
| iOS (CocoaPods) | Podfile | Podfile.lock |
| iOS (Swift PM) | Package.swift | Package.resolved |
| Flutter (Dart) | pubspec.yaml | pubspec.lock |
# 扫描 Android 项目
sentinel scan ./my-android-app --cve CVE-2024-XXXX
# 扫描 iOS 项目
sentinel scan ./my-ios-app --cve CVE-2024-XXXX
# 扫描 Flutter 项目
sentinel scan ./my-flutter-app
特性:
gradle.properties 和 ext {} 块解析 Gradle 变量引用($firebaseBomVersion)libs.versions.toml)Firebase/Analytics)扫描你的 Kubernetes 集群以发现易受攻击的容器镜像:
# 扫描所有命名空间
sentinel scan --k8s
# 扫描特定命名空间
sentinel scan --k8s --namespace production
# 跨集群检查特定 CVE
sentinel scan --k8s --cve CVE-2024-3094
# 为所有正在运行的镜像生成 SBOM
sentinel scan --k8s --sbom
# 扫描特定镜像(无需连接集群)
sentinel scan --k8s --image nginx:1.25
Sentinel 需要只读访问权限。应用最小 RBAC 配置清单:
kubectl apply -f config/k8s-rbac.yaml
这将创建一个 sentinel-readonly 服务账户,仅具有对 pods、namespaces、deployments、replicasets、daemonsets 和 statefulsets 的 get 和 list 权限。无写权限。
通过追踪易受攻击的函数是否可从入口点触及,判断 CVE 是否真的影响你的代码:
# 完整分析(含 Claude 解读)
sentinel scan . --cve CVE-2024-22195 --execution-path
# 仅本地分析(不发送数据到外部)
sentinel scan . --cve CVE-2024-22195 --execution-path --local-only
判定结果:
| 模式 | 发送到外部的数据 |
|---|---|
--local-only | 无 — 纯本地 AST 分析 |
| 默认 | 仅经过净化的元数据:函数名、导入名、调用图边(节点/边列表)、CVE 描述。从不发送源代码。 |
所有发送到 Claude 的数据都会记录到 ~/.sentinel/audit.log 供审查。
sentinel cache clear # 清除所有缓存数据
配置存储在 ~/.sentinel/config.json。缓存位于 ~/.sentinel/cache.db。
sentinel config set api-key <key>
sentinel config set nvd-key <key>
sentinel config set model <model-name>
sentinel config get api-key
Sentinel 包含一个 FastAPI 服务器,可接收 Slack、Microsoft Teams、Telegram 以及通用 REST API 的命令。
sentinel server start # 默认端口 8080
sentinel server start --port 9090 # 自定义端口
sentinel server start --workers 4 # 多个工作进程
sentinel server status # 检查是否正在运行
# 解释一个 CVE
curl -X POST http://localhost:8080/api/cve \
-H "Content-Type: application/json" \
-d '{"cve_id": "CVE-2024-3094"}'
# 扫描一个仓库
curl -X POST http://localhost:8080/api/scan \
-H "Content-Type: application/json" \
-d '{"repo_url": "https://github.com/user/repo", "cve_id": "CVE-2024-3094"}'
# 健康检查
curl http://localhost:8080/health
sentinel setup slack # 交互式设置指南
config/slack-manifest.yml 创建一个 Slack 应用export SLACK_SIGNING_SECRET=<signing-secret>
export SLACK_BOT_TOKEN=xoxb-<bot-token>
https://<your-domain>/slack/commandshttps://<your-domain>/slack/events/sentinel cve CVE-2024-3094 或 @Sentinel cve CVE-2024-3094sentinel setup teams # 交互式设置指南
https://<your-domain>/teams/webhookexport TEAMS_WEBHOOK_SECRET=<base64-hmac-secret>
@Sentinel cve CVE-2024-3094sentinel setup telegram # 交互式设置指南
export TELEGRAM_BOT_TOKEN=<bot-token>
curl -X POST "https://api.telegram.org/bot<TOKEN>/setWebhook" -d '{"url":"https://<YOUR_DOMAIN>/telegram/webhook"}'/cve CVE-2024-3094,/scan <repo> --cve CVE-XXXXcd docker/
# 在 .env 文件中设置环境变量,或导出它们
docker compose up -d
# 使用 nginx 反向代理:
docker compose --profile with-nginx up -d
| 端点 | 方法 | 描述 |
|---|---|---|
/health | GET | 健康检查 |
/api/cve | POST | REST API — 解释一个 CVE |
/api/scan | POST | REST API — 扫描一个仓库 |
/slack/commands | POST | Slack 斜杠命令 |
/slack/events | POST | Slack 事件 API |
/teams/webhook | POST | Teams 出站 webhook |
/telegram/webhook | POST | Telegram 机器人 webhook |