tinmanlabsl/tinman-openclaw-eval
GitHub: tinmanlabsl/tinman-openclaw-eval
针对 OpenClaw AI 代理的自动化安全评估框架,内置 280+ 攻击探针并提供 CI 就绪的多格式输出与基线回归检测能力。
Stars: 10 | Forks: 3
# Tinman OpenClaw 评估
OpenClaw 代理的安全评估工具。由 [Tinman](https://github.com/oliveskin/Agent-Tinman) 提供支持。
## 功能特性
- 跨 12 个类别的 **280+ 个攻击探针**(目前为 288 个)
- 用于隔离测试的 **Synthetic Gateway**
- 通过 SARIF、JUnit 和 JSON 输出实现的 **CI 集成**
- 用于回归测试的 **基线断言**
- 通过 Gateway WebSocket 实现的 **实时监控**
## 攻击类别
运行 `tinman-eval list-attacks` 按类别查看确切计数。
| Category | Description |
|----------|-------------|
| **Prompt Injection** | 越狱、指令覆盖、提示泄漏 |
| **Tool Exfiltration** | 敏感文件/机密窃取尝试 |
| **Context Bleed** | 跨会话泄漏、对话历史提取 |
| **Privilege Escalation** | 沙箱逃逸、提权绕过尝试 |
| **Supply Chain** | 恶意技能、依赖项和更新攻击 |
| **Financial Transaction** | 钱包/助记词盗窃、交易/授权尝试 |
| **Unauthorized Action** | 未经同意/确认的操作 |
| **MCP Attacks** | MCP 工具滥用、服务器注入、跨工具窃取 |
| **Indirect Injection** | 通过文档、URL、Issue、日志、元数据进行的注入 |
| **Evasion Bypass** | Unicode/编码绕过、混淆、注入变体 |
| **Memory Poisoning** | 持久性指令投毒、伪造历史 |
| **Platform Specific** | 特定 OS 和云的 Payload(Windows/macOS/Linux/元数据) |
## 安装说明
```
pip install tinman-openclaw-eval
```
或从源码安装:
```
git clone https://github.com/oliveskin/tinman-openclaw-eval
cd tinman-openclaw-eval
pip install -e ".[dev]"
```
## 快速开始
```
# 运行所有攻击(模拟 gateway)
tinman-eval run
# 运行特定类别
tinman-eval run -c prompt_injection
tinman-eval run -c financial
tinman-eval run -c evasion_bypass
# 仅运行高严重性 (S3+)
tinman-eval run -s S3
# 保存报告
tinman-eval run -o report.md
# 列出所有攻击
tinman-eval list-attacks
# 运行单一攻击
tinman-eval run-single PI-001 -v
```
支持使用类别别名(例如 `financial`、`mcp_attacks`、`supplychain`、`platform`)。
## CI 集成
### GitHub Actions
```
name: Security Eval
on: [push, pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install tinman-openclaw-eval
- name: Run security evaluation
run: |
tinman-eval run \
--output security-report.json \
--format json
- name: Assert baseline
run: |
tinman-eval assert-cmd \
security-report.json \
--baseline expected/baseline.json
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: security-report.sarif
if: always()
- name: Generate SARIF (always)
run: |
tinman-eval run \
--output security-report.sarif \
--format sarif
if: always()
```
### 生成基线
```
# 创建初始 baseline
tinman-eval baseline --output expected/baseline.json
# 在有意更改后更新
tinman-eval run -f json -o new-results.json
# 审查并批准
mv new-results.json expected/baseline.json
```
## 输出格式
| Format | Use Case |
|--------|----------|
| `markdown` | 人类可读报告 |
| `json` | 编程分析 |
| `sarif` | GitHub 代码扫描 |
| `junit` | CI 测试结果 |
## 自定义攻击
在 `src/tinman_openclaw_eval/attacks/` 下添加新的攻击模块:
```
from tinman_openclaw_eval.attacks.base import Attack, AttackCategory, AttackPayload, ExpectedBehavior, Severity
class MyAttacks(Attack):
category = AttackCategory.PROMPT_INJECTION
name = "My Attacks"
def _load_payloads(self) -> None:
self.payloads.append(
AttackPayload(
id="MY-001",
name="My probe",
category=self.category,
severity=Severity.S2,
payload="...",
target="dm_channel",
expected_behavior=ExpectedBehavior.REJECTED_BY_SOUL,
)
)
```
然后从 `src/tinman_openclaw_eval/attacks/__init__.py` 中导出它,并在
`src/tinman_openclaw_eval/harness.py` 中注册它。
## 编程式用法
```
import asyncio
from tinman_openclaw_eval import EvalHarness, AttackCategory
async def main():
harness = EvalHarness()
# Run all attacks
result = await harness.run()
# Check for vulnerabilities
print(f"Vulnerabilities: {result.vulnerabilities}")
# Run specific categories
result = await harness.run(categories=[
AttackCategory.PROMPT_INJECTION,
AttackCategory.FINANCIAL_TRANSACTION,
AttackCategory.EVASION_BYPASS,
])
# Run high severity only
result = await harness.run(min_severity="S3")
asyncio.run(main())
```
## 对真实 Gateway 进行测试
```
# 连接到本地 OpenClaw Gateway
tinman-eval run --no-mock --gateway-url ws://127.0.0.1:18789
# 使用自定义 config
tinman-eval run --no-mock --gateway-url ws://192.168.1.100:18789
```
## 攻击探针 ID
| Prefix | Category |
|--------|----------|
| `PI-*` | Prompt Injection |
| `TE-*` | Tool Exfiltration |
| `CB-*` | Context Bleed |
| `PE-*` | Privilege Escalation |
| `SC-*` | Supply Chain |
| `FT-*` | Financial Transaction |
| `UA-*` | Unauthorized Action |
| `MCP-*` | MCP Attacks |
| `II-*` | Indirect Injection |
| `EB-*` | Evasion Bypass |
| `MP-*` | Memory Poisoning |
| `PS-*` | Platform Specific |
## 严重级别
| Level | Description | Action |
|-------|-------------|--------|
| **S4** | 危急 | 需立即修复 |
| **S3** | 高 | 部署前修复 |
| **S2** | 中 | 建议审查 |
| **S1** | 低 | 监控 |
| **S0** | 信息 | 仅观察 |
## 与 OpenClaw Skill 集成
要在 OpenClaw 中进行持续监控,请使用 [Tinman Skill](https://github.com/oliveskin/openclaw-skill-tinman):
```
# 在 OpenClaw 中
/tinman sweep # Run security sweep
/tinman sweep --category financial
/tinman watch # Real-time monitoring
```
## 链接
- [Tinman](https://github.com/oliveskin/Agent-Tinman) - AI 失效模式研究
- [Tinman Skill](https://github.com/oliveskin/openclaw-skill-tinman) - OpenClaw 集成
- [OpenClaw](https://github.com/openclaw/openclaw) - 个人 AI 助手
## 许可证
Apache-2.0
标签:AI Agent安全, CISA项目, DevSecOps, DNS 反向解析, DNS 解析, JUnit报告, LLM红队评估, MCP攻击, OpenClaw, Prompt注入, SARIF报告, WSL, 上下文泄露, 上游代理, 人工智能安全, 会话隔离逃逸, 供应链攻击, 内存投毒, 加密钱包窃取, 协议分析, 合成网关, 合规性, 回归测试, 大模型安全评估, 安全合规, 安全评估框架, 工具泄露, 平台特定攻击, 提示词泄露, 攻击载荷, 数据渗出, 文档安全, 未授权操作, 权限提升, 沙箱逃逸, 红队攻击, 编码绕过, 网络代理, 网络弹性, 计算机取证, 财务安全, 逃逸绕过, 逆向工具, 间接注入, 零日漏洞检测