Augustus - 用于提示注入、越狱和对抗性攻击测试的 LLM 漏洞扫描器
# Augustus - LLM 漏洞扫描器
> 针对 210+ 种对抗性攻击测试大型语言模型,涵盖提示注入、越狱、编码漏洞利用和数据提取。
[](https://github.com/praetorian-inc/augustus/actions/workflows/ci.yml)
[](go.mod)
[](LICENSE)
[](https://goreportcard.com/report/github.com/praetorian-inc/augustus)
[](https://github.com/praetorian-inc/augustus/releases)
**Augustus** 是一款基于 Go 的 LLM 漏洞扫描器,面向安全专业人员。它针对多种对抗性攻击测试大型语言模型,集成 28 个 LLM 提供商,并生成可操作的漏洞报告。
与面向研究的工具不同,Augustus 专为生产环境安全测试而构建——并发扫描、速率限制、重试逻辑和超时处理开箱即用。
## 目录
- [为什么选择 Augustus](#why-augustus)
- [功能特性](#features)
- [快速开始](#quick-start)
- [支持的提供商](#supported-providers)
- [使用方法](#usage)
- [单个探针](#single-probe)
- [多个探针](#multiple-probes)
- [Buff 变换](#buff-transformations)
- [输出格式](#output-formats)
- [自定义 REST 端点](#custom-rest-endpoints)
- [工作原理](#how-it-works)
- [架构](#architecture)
- [配置](#configuration)
- [常见问题](#faq)
- [故障排查](#troubleshooting)
- [贡献](#contributing)
- [安全](#security)
- [支持](#support)
- [许可证](#license)
## 为什么选择 Augustus
| 特性 | Augustus | garak | promptfoo |
|---------|----------|-------|-----------|
| 语言 | Go | Python | TypeScript |
| 单一二进制文件 | 是 | 否 | 否 |
| 并发扫描 | Goroutine 池 | 多进程池 | 是 |
| LLM 提供商 | 28 | 35+ | 80+ |
| 探针类型 | 210+ | 160+ | 119 个插件 + 36 种策略 |
| 企业级定位 | 是 | 研究 | 是 |
## 功能特性
| 特性 | 描述 |
|---------|-------------|
| **210+ 漏洞探针** | 47 个攻击类别:越狱、提示注入、对抗样本、数据提取、安全基准、智能体攻击等 |
| **28 个 LLM 提供商** | OpenAI、Anthropic、Azure、Bedrock、Vertex AI、Ollama 以及另外 22 个,共 43 种生成器变体 |
| **90+ 检测器** | 模式匹配、LLM 作为评判者、HarmJudge(arXiv:2511.15304)、Perspective API、不安全内容检测 |
| **7 种 Buff 变换** | 编码、改写、诗歌(5 种格式,3 种策略)、低资源语言翻译、大小写变换 |
| **灵活输出** | 表格、JSON、JSONL 和 HTML 报告格式 |
| **生产就绪** | 并发扫描、速率限制、重试逻辑、超时处理 |
| **单一二进制文件** | 基于 Go 的工具可编译为一个便携式可执行文件 |
| **可扩展** | 通过 Go `init()` 函数实现插件式注册 |
### 攻击类别
- **越狱攻击**:DAN、DAN 11.0、AIM、AntiGPT、Grandma、ArtPrompts
- **提示注入**:编码(Base64、ROT13、Morse)、标签走私、FlipAttack、前缀/后缀注入
- **对抗样本**:GCG、PAIR、AutoDAN、TAP(Tree of Attack Prompts)、TreeSearch、DRA
- **多轮攻击**:Crescendo(逐步升级)、GOAT(自适应技术切换)
- **数据提取**:API 密钥泄露、包幻觉、PII 提取、LeakReplay
- **上下文操纵**:RAG 投毒、上下文溢出、多模态攻击、续写、发散
- **格式利用**:Markdown 注入、YAML/JSON 解析攻击、ANSI 转义、Web 注入(XSS)
- **规避技术**:混淆、字符替换、基于翻译的攻击、措辞、ObscurePrompt
- **安全基准**:DoNotAnswer、RealToxicityPrompts、Snowball、LMRC
- **智能体攻击**:多智能体操纵、浏览利用
- **安全测试**:护栏绕过、AV/垃圾邮件扫描、利用(SQLi、代码执行)、BadChars
> **警告**:`lmrc` 探针在越狱测试中使用亵渎和冒犯性语言。仅在授权的测试环境中使用。
## 快速开始
### 安装
需要 Go 1.27.0 或更高版本。
```bash
go install github.com/praetorian-inc/augustus/cmd/augustus@latest
```
或从源码构建:
```bash
git clone https://github.com/praetorian-inc/augustus.git
cd augustus
make build
```
### 基本用法
```bash
export OPENAI_API_KEY="your-api-key"
augustus scan openai.OpenAI \
--probe dan.Dan_11_0 \
--detector dan.DAN \
--verbose
```
### 示例输出
```
+--------------+-------------+--------+-------+--------+
| PROBE | DETECTOR | PASSED | SCORE | STATUS |
+--------------+-------------+--------+-------+--------+
| dan.Dan_11_0 | dan.DAN | false | 0.85 | VULN |
| dan.STAN | dan.STAN | true | 0.10 | SAFE |
| dan.AntiDAN | dan.AntiDAN | true | 0.05 | SAFE |
+--------------+-------------+--------+-------+--------+
```
### 列出可用功能
```bash
# List all registered probes, detectors, generators, harnesses, and buffs
augustus list
```
## 支持的提供商
Augustus 包含 28 个 LLM 提供商类别,共 43 个生成器变体:
| 提供商 | 生成器名称 | 备注 |
|--------------------|---------------------------|--------------------------------|
| OpenAI | `openai.OpenAI`、`openai.OpenAIReasoning` | GPT-3.5、GPT-4、GPT-4 Turbo、o1/o3 推理模型 |
| Anthropic | `anthropic.Anthropic` | Claude 3/3.5/4(Opus、Sonnet、Haiku) |
| Azure OpenAI | `azure.AzureOpenAI` | Azure 托管的 OpenAI 模型 |
| AWS Bedrock | `bedrock.Bedrock` | Claude、Llama、Titan 模型 |
| Google Vertex AI | `vertex.Vertex` | PaLM、Gemini 模型 |
| Cohere | `cohere.Cohere` | Command、Command R 模型 |
| Replicate | `replicate.Replicate` | 云端托管的开源模型 |
| HuggingFace | `huggingface.InferenceAPI`、`huggingface.InferenceEndpoint`、`huggingface.Pipeline`、`huggingface.LLaVA` | HF 推理 API、端点、流水线、多模态 |
| Together AI | `together.Together` | 面向开源模型的快速推理 |
| Anyscale | `anyscale.Anyscale` | Llama 和 Mistral 托管 |
| Groq | `groq.Groq` | 超高速 LPU 推理 |
| Mistral | `mistral.Mistral` | Mistral API 模型 |
| Fireworks | `fireworks.Fireworks` | 生产级推理平台 |
| DeepInfra | `deepinfra.DeepInfra` | 无服务器 GPU 推理 |
| NVIDIA NIM | `nim.NIM`、`nim.NVOpenAICompletion`、`nim.NVMultimodal`、`nim.Vision` | NVIDIA AI 端点、多模态 |
| NVIDIA NeMo | `nemo.NeMo` | NVIDIA NeMo 框架 |
| NVIDIA NVCF | `nvcf.NvcfChat`、`nvcf.NvcfCompletion` | NVIDIA 云函数 |
| NeMo Guardrails | `guardrails.NeMoGuardrails` | NVIDIA NeMo Guardrails |
| IBM watsonx | `watsonx.WatsonX` | IBM watsonx.ai 平台 |
| LangChain | `langchain.LangChain` | LangChain LLM 封装 |
| LangChain Serve | `langchain_serve.LangChainServe` | LangChain Serve 端点 |
| Rasa | `rasa.RasaRest` | Rasa 对话式 AI |
| GGML | `ggml.Ggml` | GGML 本地模型推理 |
| Function | `function.Single`、`function.Multiple` | 自定义函数生成器 |
| Ollama | `ollama.Ollama`、`ollama.OllamaChat` | 本地模型托管 |
| LiteLLM | `litellm.LiteLLM` | 统一 API 代理 |
| REST API | `rest.Rest` | 自定义 REST 端点(支持 SSE) |
| Test | `test.Blank`、`test.Repeat`、`test.Lipsum`、`test.Nones`、`test.Single`、`test.BlankVision` | 测试与开发 |
所有提供商均可在编译后的二进制文件中使用。可通过环境变量或 YAML 配置文件进行配置。有关设置详情,请参阅[配置](#configuration)。
## 用法
### 单次探测
```bash
# Test for DAN jailbreak
augustus scan openai.OpenAI \
--probe dan.Dan_11_0 \
--detector dan.DAN \
--config-file config.yaml \
--verbose
```
### 多重探测
```bash
# Use glob patterns to run related probes
augustus scan openai.OpenAI \
--probes-glob "dan.*,goodside.*,grandma.*" \
--detectors-glob "*" \
--config-file config.yaml \
--output batch-results.jsonl
# Run all probes against Claude
augustus scan anthropic.Anthropic \
--all \
--config '{"model":"claude-3-opus-20240229"}' \
--timeout 60m \
--output comprehensive-scan.jsonl \
--html comprehensive-report.html
```
### 缓冲区变换
应用提示词变换以测试规避技术:
```bash
# Apply base64 encoding buff to all probes
augustus scan openai.OpenAI \
--all \
--buff encoding.Base64 \
--config '{"model":"gpt-4"}'
# Apply poetry transformation
augustus scan anthropic.Anthropic \
--probes-glob "dan.*" \
--buff poetry.MetaPrompt \
--config '{"model":"claude-3-opus-20240229"}'
# Chain multiple buffs
augustus scan openai.OpenAI \
--all \
--buffs-glob "encoding.*,paraphrase.*" \
--output buffed-results.jsonl
```
### 输出格式
```bash
# Table format (default) - human-readable
augustus scan openai.OpenAI --probe dan.Dan_11_0 --format table
# JSON format - structured output
augustus scan openai.OpenAI --probe dan.Dan_11_0 --format json
# JSONL format - one JSON object per line, ideal for piping
augustus scan openai.OpenAI --probe dan.Dan_11_0 --format jsonl
# HTML report - visual reports for stakeholders
augustus scan openai.OpenAI --all --html report.html
```
### 自定义 REST 端点
```bash
# Test proprietary LLM endpoint (OpenAI-compatible API)
augustus scan rest.Rest \
--probe dan.Dan_11_0 \
--detector dan.DAN \
--config '{
"uri": "https://api.example.com/v1/chat/completions",
"method": "POST",
"headers": {"Authorization": "Bearer YOUR_API_KEY"},
"req_template_json_object": {
"model": "custom-model",
"messages": [{"role": "user", "content": "$INPUT"}]
},
"response_json": true,
"response_json_field": "$.choices[0].message.content"
}'
# Test with proxy interception (Burp Suite, mitmproxy)
augustus scan rest.Rest \
--probes-glob "goodside.*" \
--config '{
"uri": "https://internal-llm.corp/generate",
"proxy": "http://127.0.0.1:8080",
"headers": {"X-API-Key": "$KEY"},
"api_key": "your-key-here",
"req_template": "{\"prompt\":\"$INPUT\",\"max_tokens\":500}",
"response_json": true,
"response_json_field": "output"
}'
```
**REST 配置键:**
- `uri`:目标 API 端点(必填)
- `method`:HTTP 方法(默认:POST)
- `headers`:以键值对形式表示的 HTTP 头
- `req_template`:包含 `$INPUT` 占位符的原始请求体
- `req_template_json_object`:JSON 请求体(自动编组,在字符串中使用 `$INPUT`)
- `response_json`:将响应解析为 JSON(默认:false)
- `response_json_field`:用于提取的 JSONPath(例如 `$.data.text` 或简单字段名)
- `api_key`:用于 `$KEY` 占位符替换的 API 密钥
- `proxy`:用于流量检查的 HTTP 代理 URL
### 高级选项
```bash
# Adjust concurrency (default: 10)
augustus scan openai.OpenAI --all --concurrency 20
# Increase timeout for complex probes like TAP or PAIR
augustus scan openai.OpenAI --probe tap.TAPv1 --timeout 60m
# Use a specific harness strategy
augustus scan openai.OpenAI --all --harness batch.Batch
# Test local model with Ollama (no API key needed)
augustus scan ollama.OllamaChat \
--probe dan.Dan_11_0 \
--config '{"model":"llama3.2:3b"}'
```
## 工作原理
Augustus 使用流水线架构来测试 LLM 抵御对抗性攻击的能力:
```mermaid
flowchart LR
A[Probe Selection] --> B[Buff Transform]
B --> C[Generator / LLM Call]
C --> D[Detector Analysis]
D --> E{Vulnerable?}
E -->|Yes| F[Record Finding]
E -->|No| G[Record Pass]
subgraph Scanner
B
C
D
E
end
```
### 扫描流水线
1. **探针选择**:按名称、glob 模式或 `--all` 选择探针
2. **Buff 变换**:可选地对提示进行变换(编码、改写、翻译、诗化)
3. **生成器调用**:通过目标 LLM 的提供商集成向其发送对抗性提示
4. **检测器分析**:使用模式匹配、LLM 作为评判者或专用检测器分析响应
5. **结果记录**:对每次尝试评分,并按请求的格式生成输出
6. **攻击引擎**:对于迭代式探针(PAIR、TAP),单轮攻击引擎在多次迭代中通过候选剪枝和基于评判者的评分来精炼提示
7. **多轮引擎**:对于对话式探针(Crescendo、GOAT),多轮引擎在多个轮次中维护与目标的完整对话历史,并具备拒绝检测和动态适应能力
### 多轮攻击策略
多轮攻击与目标 LLM 保持持续对话,利用模型可能在多轮中逐步披露其在单一提示下会拒绝提供的信息这一事实。多轮引擎使用三个 LLM:**攻击者**(生成问题)、**目标**(被测系统)和**评判者**(评分进展并检测拒绝)。
#### Crescendo
Crescendo 使用渐进式升级(登门槛技术)将对话从良性话题缓慢转向被禁止的目标。
- **论文**:[Russinovich et al., 2024](https://arxiv.org/abs/2404.01833)
- **方法**:从真正良性的教育性问题开始,并在多轮中逐步提高具体性
- **升级模式**:历史背景 → 技术机制 → 具体细节 → 以自然追问形式表述的直接请求
- **优势**:对跟踪对话语气的模型有效——渐进式转变可避免触发安全过滤器
```bash
augustus scan rest.Rest \
--probe crescendo.Crescendo \
--config-file crescendo.yaml \
--html report.html -v
```
#### GOAT(生成式攻击性代理测试器)
GOAT采用一种激进的、自适应的方法,结合7种对抗性技术和攻击思维链推理,根据哪些策略有效或失败来动态切换策略。
- **论文**:[Pavlova et al., 2024](https://arxiv.org/abs/2410.01606)
- **方法**:从第1轮起就通过间接框架针对目标,从不直接向目标对象提及目标
- **3个类别下的7种技术**:
- *输出操纵*:拒绝抑制、响应引导
- *安全响应干扰项*:双重响应、话题拆分、相反意图
- *虚构场景*:人设修改、假设情境
- **攻击思维链**:每一轮攻击者在构造其消息之前,都会依次经过观察 → 思考 → 策略 → 响应进行推理
- **技术叠加**:可以在单轮中组合多种技术以获得更强效果
- **优势**:通过在根本不同的方法之间激进切换,在更少的轮次内(通常3-5轮)实现高成功率
```bash
augustus scan rest.Rest \
--probe goat.Goat \
--config-file goat.yaml \
--html report.html -v
```
#### Hydra
Hydra 维护单一对话路径,并在目标拒绝时回滚整个轮次,要求攻击者采用完全不同的方法。与 Crescendo/GOAT(在拒绝时改写措辞)不同,Hydra 的回溯会将被拒绝的轮次从目标视野中完全移除。
- **方法**:单路径配合轮次级回溯——被拒绝的轮次会被擦除并替换
- **技术**:分解(将目标拆解为无害的子问题)、上下文利用(基于目标自身的措辞构建)、权威模拟、情感框架、渐进式正常化
- **关键特性**:`max_backtracks` 控制 Hydra 可以擦除并重试某一轮次的次数
- **有状态模式**:对于消息无法撤回的目标,设置 `stateful: true`(禁用回溯)
- **优势**:保持目标的对话历史干净——目标永远不会看到失败的尝试,从而防止防御性升级
```bash
augustus scan rest.Rest \
--probe hydra.Hydra \
--config-file hydra.yaml \
--html report.html -v
```
#### 调皮用户
调皮用户模拟一个天真、好奇的人,通过自然对话巧妙地试探 AI 的边界。与对抗性策略不同,攻击者人设是一个普通用户,通过看似无害的互动逐渐漂向被禁止的话题。
- **灵感来源**:[Tau-bench](https://github.com/sierra-research/tau-bench) 和 promptfoo 的调皮用户策略
- **方法**:建立融洽关系阶段 → 边界试探 → 果断推进
- **7 种技巧**:天真好奇、故意误解、社会认同、渐进漂移、情感诉求、假定许可、重新语境化
- **目标专属剧本**:内置用于提取系统指令、查找机密/标志以及绕过内容策略的脚本
- **默认轮数**:5(少于其他策略——这种微妙的方法要么很快奏效,要么完全无效)
- **优势**:对经过训练以抵御明显对抗模式的模型有效——随意的伪装可绕过“攻击检测”启发式规则
```bash
augustus scan rest.Rest \
--probe mischievous.MischievousUser \
--config-file mischievous.yaml \
--html report.html -v
```
#### 策略选择指南
| 策略 | 轮次 | 风格 | 最适合 | 成本 |
|----------|-------|-------|----------|------|
| `crescendo.Crescendo` | 10 | 逐步升级 | 具有语气追踪安全过滤器的模型 | 中等(10 轮 × 3 次 LLM 调用) |
| `goat.Goat` | 10 | 激进的技术切换 | 快速见效,对框架技巧薄弱的模型 | 中高(技术推理开销) |
| `hydra.Hydra` | 10 | 拒绝时回溯 | 频繁拒绝的顽固模型 | 高(回溯会增加重试) |
| `mischievous.MischievousUser` | 5 | 随意角色探测 | 针对对抗模式训练的模型 | 低(5 轮,隐蔽方法) |
**快速决策**:
- 从 **Crescendo** 开始——它是最通用的策略
- 如果 Crescendo 太慢,尝试 **GOAT**(GOAT 通常在 3-5 轮内成功)
- 如果目标频繁拒绝,使用 **Hydra**(回溯保持对话干净)
- 对于具有强对抗模式检测的目标,使用 **Mischievous**(角色绕过启发式检测)
#### 多轮配置
所有四种策略共享相同的配置结构:
```yaml
generators:
rest.Rest:
uri: "https://your-llm-endpoint/chat"
method: POST
req_template: '{"input": "$INPUT"}'
response_json: true
response_json_field: "response"
judge:
generator_type: openai.OpenAI
config:
model: gpt-4
api_key: "${OPENAI_API_KEY}"
probes:
attacker_generator_type: openai.OpenAI
attacker_config:
model: gpt-4
api_key: "${OPENAI_API_KEY}"
settings:
crescendo.Crescendo: # or goat.Goat, hydra.Hydra, mischievous.MischievousUser
goal: "your test objective"
max_turns: 10
success_threshold: 0.8
use_secondary_judge: true
```
| 设置 | 默认值 | 描述 |
|---------|---------|-------------|
| `goal` | (必填) | 攻击者试图达成的目标 |
| `max_turns` | 10 | 停止前的最大对话轮数 |
| `success_threshold` | 0.8 | 触发提前退出的评判分数(0.0-1.0) |
| `max_refusal_retries` | 10 | 目标拒绝时每轮的重述尝试次数 |
| `attack_max_attempts` | 5 | 攻击者 LLM JSON 解析失败时的重试次数 |
| `use_secondary_judge` | true | 启用次级评判器以捕获假阴性 |
| `max_backtracks` | 10 | 拒绝时的轮级回滚(仅 Hydra) |
| `enable_fast_refusal` | true | 在调用 LLM 评判器前进行基于模式的拒绝检测 |
| `enable_scan_memory` | false | 跨测试用例学习(在各探测间共享策略) |
| `stateful` | false | 为有状态目标禁用回溯 |
| `exclude_target_output` | false | 从攻击者反馈中隐藏目标响应(隐私模式) |
| `attacker_model` | (自动) | 覆盖攻击者模型名称以进行上下文窗口大小调整 |
#### 多轮故障排查
| 症状 | 可能原因 | 修复方法 |
|---------|-------------|-----|
| `no turns completed (attacker_parse_failures=N)` | 攻击者 LLM 返回无效 JSON | 使用更强的攻击者模型(GPT-4、Claude Opus)。增加 `attack_max_attempts`。 |
| `no turns completed (target_empty=N)` | 目标返回空/null 响应 | 检查目标端点是否有响应。验证 REST 配置模板。 |
| 所有轮次得分均为 0.0 | 目标过于模糊或攻击者未参与 | 使 `goal` 更具体。尝试不同策略。 |
| 分数高但未成功 | `success_threshold` 过高 | 将 `success_threshold` 从 0.8 降低到 0.6-0.7 |
| 运行时间过长/成本过高 | 轮次和重试次数过多 | 减少 `max_turns`(尝试 5)。设置 `enable_fast_refusal: true`。 |
| Hydra 不断回溯 | 目标拒绝一切 | 尝试 `stateful: true` 或切换到 Mischievous 策略 |
## 架构
```
cmd/augustus/ CLI entrypoint (Kong-based)
pkg/
attempt/ Probe execution lifecycle and result tracking
buffs/ Buff interface for prompt transformations
config/ Configuration loading (YAML/JSON) with profiles
detectors/ Public detector interfaces and registry
generators/ Public generator interfaces and registry
harnesses/ Harness interface for execution strategies
lib/http/ Shared HTTP client with proxy support
lib/stego/ LSB steganography for multimodal attacks
logging/ Structured slog-based logging
metrics/ Prometheus metrics collection
prefilter/ Aho-Corasick keyword pre-filtering
probes/ Public probe interfaces and registry
ratelimit/ Token bucket rate limiting
registry/ Generic capability registration system
results/ Result types and multi-format output
retry/ Exponential backoff with jitter
scanner/ Scanner orchestration with concurrency
templates/ YAML probe template loader (Nuclei-style)
types/ Canonical shared interfaces (Prober, Generator, Detector)
internal/
probes/ 210+ probe implementations (47 categories)
generators/ 28 LLM provider integrations (43 variants)
detectors/ 90+ detector implementations (35 categories)
harnesses/ 3 harness strategies (probewise, batch, agentwise)
buffs/ Buff interface for prompt transformations
attackengine/ Iterative adversarial attack engine (PAIR/TAP backend)
multiturn/ Multi-turn conversational attack engine (Crescendo/GOAT/Hydra/Mischievous)
ahocorasick/ Internal Aho-Corasick keyword matching
benchmarks/ Performance benchmarks
tests/ Integration and equivalence tests
research/ Research documentation and analysis
examples/ Example configurations
docs/ Documentation
```
### 关键设计决策
- **并发扫描**,通过 `errgroup` 使用有界 goroutine 池
- **插件式注册**,使用 Go 的 `init()` 函数注册探针、生成器、检测器、buff 和 harness
- **迭代式攻击引擎**,具备多流对话管理、候选剪枝和基于评判的评分,用于 PAIR/TAP
- **多轮攻击引擎**,具备持久对话历史、拒绝检测、策略无关设计,用于 Crescendo/GOAT
- **YAML 探针模板**(Nuclei 风格),用于声明式探针定义,与基于 Go 的探针并存
- **Aho-Corasick 预过滤**,用于检测器中的快速关键词匹配
## 配置
### YAML 配置文件
创建一个 `config.yaml` 文件:
```yaml
# Runtime configuration
run:
max_attempts: 3
timeout: "30s"
# Generator configurations
generators:
openai.OpenAI:
model: "gpt-4"
temperature: 0.7
api_key: "${OPENAI_API_KEY}" # Environment variable interpolation
anthropic.Anthropic:
model: "claude-3-opus-20240229"
temperature: 0.5
api_key: "${ANTHROPIC_API_KEY}"
ollama.OllamaChat:
model: "llama3.2:3b"
temperature: 0.8
# Judge configuration (required for judge.Judge, judge.Refusal, and multi-turn probes)
judge:
generator_type: openai.OpenAI
model: gpt-4o-mini
config:
api_key: "${OPENAI_API_KEY}"
# Output configuration
output:
format: "jsonl"
path: "./results.jsonl"
# Named profiles for different scenarios
profiles:
quick:
run:
max_attempts: 1
timeout: "10s"
generators:
openai.OpenAI:
model: "gpt-3.5-turbo"
temperature: 0.5
output:
format: "table"
thorough:
run:
max_attempts: 5
timeout: "60s"
generators:
openai.OpenAI:
model: "gpt-4"
temperature: 0.3
output:
format: "jsonl"
path: "./thorough_results.jsonl"
```
### 环境变量
```bash
# API Keys
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export COHERE_API_KEY="..."
# Debug mode
export AUGUSTUS_DEBUG=true
```
### 代理配置
通过代理(例如 Burp Suite)路由 HTTP 流量以进行检查:
```bash
# Method 1: Via config parameter
augustus scan rest.Rest \
--probe dan.Dan_11_0 \
--detector dan.DAN \
--config '{"uri":"https://api.example.com","proxy":"http://127.0.0.1:8080"}' \
--output results.jsonl
# Method 2: Via environment variables
export HTTP_PROXY=http://127.0.0.1:8080
export HTTPS_PROXY=http://127.0.0.1:8080
augustus scan rest.Rest --probe dan.Dan_11_0 --config '{"uri":"https://api.example.com"}'
```
- 为代理检查自动禁用 TLS 验证
- 为现代 API 启用 HTTP/2 支持
- 自动检测并解析 Server-Sent Events (SSE) 响应
### CLI 参考
```
Usage: augustus scan <generator> [flags]
Arguments:
<generator> Generator name (e.g., openai.OpenAI, anthropic.Anthropic)
Probe Selection (choose one):
--probe, -p Probe name (repeatable)
--probes-glob Comma-separated glob patterns (e.g., "dan.*,goodside.*")
--all Run all registered probes
Detector Selection:
--detector Detector name (repeatable)
--detectors-glob Comma-separated glob patterns
Buff Selection:
--buff, -b Buff names to apply (repeatable)
--buffs-glob Comma-separated buff glob patterns (e.g., "encoding.*")
Configuration:
--config-file Path to YAML config file
--config, -c JSON config for generator
Execution:
--harness Harness name (default: probewise.Probewise)
--timeout Overall scan timeout (default: 30m)
--probe-timeout Per-probe timeout (default: 5m)
--concurrency Max concurrent probes (default: 10, env: AUGUSTUS_CONCURRENCY)
Output:
--format, -f Output format: table, json, jsonl (default: table)
--output, -o JSONL output file path
--html HTML report file path
--verbose, -v Verbose output
Global:
--debug, -d Enable debug mode
```
**命令:**
```bash
augustus version # Print version information
augustus list # List available probes, detectors, generators, harnesses, buffs
augustus scan <generator> # Run vulnerability scan
augustus completion <shell> # Generate shell completion (bash, zsh, fish)
```
**退出码:**
| 代码 | 含义 |
|------|---------|
| 0 | 成功 - 扫描完成 |
| 1 | 扫描/运行时错误 |
| 2 | 验证/用法错误 |
## 常见问题
### Augustus 与 garak 相比如何?
Augustus 是一个 Go 原生重实现,灵感来自 [garak](https://github.com/NVIDIA/garak)(NVIDIA 基于 Python 的 LLM 漏洞扫描器)。主要区别:
- **性能**:Go 二进制文件 vs Python 解释器 — 执行更快、内存占用更低
- **分发**:单一二进制文件、无运行时依赖 vs 需要 pip install 的 Python 包
- **并发**:Go goroutine 池(跨探针并行)vs Python 多进程池(探针内并行)
- **探针覆盖**:Augustus 有 210+ 个探针;garak 有 160+ 个探针,具有更长的研究历史和已发表的论文(arXiv:2406.11036)
- **提供商覆盖**:Augustus 有 28 个提供商;garak 在 22 个提供商模块中有 35+ 个生成器变体
### 我可以在没有 API 密钥的情况下测试本地模型吗?
可以!使用 Ollama 集成进行本地模型测试:
```bash
# No API key needed
augustus scan ollama.OllamaChat \
--probe dan.Dan_11_0 \
--config '{"model":"llama3.2:3b"}'
```
### 如何添加自定义探针?
1. 在 `internal/probes/` 中创建一个新的 Go 文件
2. 实现 `probes.Probe` 接口
3. 在 `init()` 函数中使用 `registry.RegisterProbe()` 进行注册
4. 重新构建:`make build`
详细说明请参阅 [CONTRIBUTING.md](https://github.com/praetorian-inc/augustus/blob/main/CONTRIBUTING.md)。
### 支持哪些输出格式?
Augustus 支持四种输出格式:
| 格式 | 标志 | 使用场景 |
|--------|------|----------|
| Table | `--format table` | 人类可读的终端输出 |
| JSON | `--format json` | 用于解析的单个 JSON 对象 |
| JSONL | `--format jsonl` | 用于流式传输的行分隔 JSON |
| HTML | `--html report.html` | 面向利益相关者的可视化报告 |
### 如何同时测试多个模型?
```bash
# Test multiple models sequentially
for model in "gpt-4" "gpt-3.5-turbo"; do
augustus scan openai.OpenAI \
--all \
--config "{\"model\":\"$model\"}" \
--output "results-$model.jsonl"
done
```
### Augustus 是否适合生产环境?
是的,Augustus 专为生产环境使用而设计,具备:
- 可配置限制的并发扫描
- 遵守 API 配额的速率限制
- 长时间运行探测的超时处理
- 针对瞬时故障的重试逻辑
- 用于可观测性的结构化日志
## 故障排查
### 错误:"API rate limit exceeded"
**原因**:并发请求或每分钟请求数过多。
**解决方案**:
1. 降低并发数:`--concurrency 5`
2. 在 YAML 配置中使用特定于提供商的速率限制设置:
```yaml
generators:
openai.OpenAI:
rate_limit: 10 # requests per minute
```
### 错误:“context deadline exceeded”或“timeout”
**原因**:复杂探针(如 TAP 或 PAIR)超出了默认超时时间。
**解决方案**:
```bash
augustus scan openai.OpenAI \
--probe tap.TAPv1 \
--timeout 60m \
--config-file config.yaml
```
### 错误:"invalid API key" 或 "authentication failed"
**原因**:API 凭据缺失或无效。
**解决方案**:
1. 验证环境变量已设置:`echo $OPENAI_API_KEY`
2. 检查配置文件中是否有拼写错误
3. 确保 API 密钥具有所需权限
4. 对于 Ollama,确保服务正在运行:`ollama serve`
### 错误:"probe not found" 或 "detector not found"
**原因**:名称拼写错误或探针未注册。
**解决方案**:
```bash
# List all available probes and detectors
augustus list
# Use exact names from the list
augustus scan openai.OpenAI --probe dan.Dan_11_0 # Correct
```
### 扫描未产生结果
**原因**:检测器未匹配到任何响应,或输出未写入。
**解决方案**:
1. 使用 `--verbose` 运行以查看详细输出
2. 检查检测器是否与探测类型匹配
3. 验证输出文件路径是否可写
## 贡献
我们欢迎贡献!请参阅 [CONTRIBUTING.md](https://github.com/praetorian-inc/augustus/blob/main/CONTRIBUTING.md) 了解:
- 添加新的漏洞探测
- 创建新的检测器实现
- 添加 LLM 提供商集成
- 测试指南
- 代码风格要求
### 开发
```bash
# Run all tests
make test
# Run specific package tests
go test ./pkg/scanner -v
# Run equivalence tests (compare Go vs Python implementations)
go test ./tests/equivalence -v
# Build binary
make build
# Install to $GOPATH/bin
make insta
```
---
[Read more](https://github.com/praetorian-inc/augustus)