mariocandela/beelzebub
GitHub: mariocandela/beelzebub
一款利用 AI 模拟高交互系统行为的低代码蜜罐框架,用于捕获网络攻击和检测 LLM 提示注入。
Stars: 1880 | Forks: 178
# Beelzebub
[](https://github.com/mariocandela/beelzebub/actions/workflows/ci.yml) [](https://github.com/mariocandela/beelzebub/actions/workflows/docker-image.yml) [](https://github.com/mariocandela/beelzebub/actions/workflows/codeql.yml)
[](https://goreportcard.com/report/github.com/mariocandela/beelzebub/v3)
[](https://codecov.io/gh/mariocandela/beelzebub)
[](https://pkg.go.dev/github.com/mariocandela/beelzebub/v3)
[](https://archestra.ai/mcp-catalog/mariocandela__beelzebub)
[](https://github.com/avelino/awesome-go)
## 概述
Beelzebub 是一个高级蜜罐框架,旨在提供一个高度安全的环境用于检测和分析网络攻击。它采用低代码方法以实现轻松实施,并使用 AI 来模拟高交互蜜罐的行为。

## 目录
- [全球威胁情报社区](#global-threat-intelligence-community)
- [核心功能](#key-features)
- [架构](#architecture)
- [快速开始](#quick-start)
- [配置](#configuration)
- [核心配置](#core-configuration)
- [服务配置](#service-configuration)
- [协议示例](#protocol-examples)
- [MCP 蜜罐](#mcp-honeypot)
- [HTTP 蜜罐](#http-honeypot)
- [SSH 蜜罐](#ssh-honeypot)
- [TELNET 蜜罐](#telnet-honeypot)
- [TCP 蜜罐](#tcp-honeypot)
- [可观测性](#observability)
- [Prometheus 指标](#prometheus-metrics)
- [RabbitMQ 集成](#rabbitmq-integration)
- [Beelzebub Cloud](#beelzebub-cloud)
- [测试](#testing)
- [代码质量](#code-quality)
- [贡献](#contributing)
- [许可证](#license)
## 全球威胁情报社区
我们的使命是建立一个全球安全研究人员和白帽专家的协作生态系统,致力于构建一个分布式蜜罐网络,以识别新兴恶意软件、发现零日漏洞并中和活跃的僵尸网络。
[](https://github.com/beelzebub-labs/white-paper/)
白皮书包含有关如何加入我们的 Discord 社区并为全球威胁情报网络做出贡献的信息。
## 核心功能
Beelzebub 提供广泛的功能以增强您的蜜罐环境:
- **低代码配置**:基于 YAML 的模块化服务定义
- **LLM 集成**:LLM 令人信服地模拟真实系统,创造高交互蜜罐体验,同时实际上保持低交互架构以增强安全性和易于管理
- **多协议支持**:SSH, HTTP, TCP, TELNET, MCP(检测针对 LLM 智能体的提示注入)
- **Prometheus 指标与可观测性**:内置用于监控的指标端点
- **事件追踪**:多种输出策略(stdout, RabbitMQ, Beelzebub Cloud)
- **Docker 与 Kubernetes 就绪**:使用提供的配置随处部署
- **ELK stack 就绪**:官方集成可在 [Elastic 文档](https://www.elastic.co/docs/reference/integrations/beelzebub) 获取
## LLM 蜜罐演示

## 快速开始
您可以通过 Docker、Go 编译器(跨设备)或 Helm (Kubernetes) 运行 Beelzebub。
### 使用 Docker Compose
1. 构建 Docker 镜像:
$ docker compose build
2. 在分离模式下启动 Beelzebub:
$ docker compose up -d
### 使用 Go 编译器
1. 下载必要的 Go modules:
$ go mod download
2. 构建 Beelzebub 可执行文件:
$ go build
3. 运行 Beelzebub:
$ ./beelzebub
### 使用 Helm 在 Kubernetes 集群上部署
1. 安装 helm
2. 部署 beelzebub:
$ helm install beelzebub ./beelzebub-chart
3. 后续版本更新
$ helm upgrade beelzebub ./beelzebub-chart
## 配置
Beelzebub 使用双层配置系统:
1. **核心配置** (`beelzebub.yaml`) - 日志、追踪和 Prometheus 的全局设置
2. **服务配置** (`services/*.yaml`) - 单个蜜罐服务定义
### 核心配置
核心配置文件控制全局行为:
```
core:
logging:
debug: false
debugReportCaller: false
logDisableTimestamp: true
logsPath: ./logs
tracings:
rabbit-mq:
enabled: false
uri: "amqp://guest:guest@localhost:5672/"
prometheus:
path: "/metrics"
port: ":2112"
beelzebub-cloud:
enabled: false
uri: ""
auth-token: ""
```
### 服务配置
每个蜜罐服务都在 `services/` 目录下的单独 YAML 文件中定义。要使用自定义路径运行 Beelzebub:
```
./beelzebub --confCore ./configurations/beelzebub.yaml --confServices ./configurations/services/
```
附加标志:
- `--memLimitMiB ` - 设置以 MiB 为单位的内存限制(默认:100,使用 -1 禁用)
## 协议示例
以下是每种支持协议的配置示例。
### MCP 蜜罐
MCP (Model Context Protocol) 蜜罐是旨在检测针对 LLM 智能体的提示注入攻击的诱饵工具。
#### 为什么使用 MCP 蜜罐?
MCP 蜜罐是一个**诱饵工具**,智能体在正常情况下永远不应调用它。将此策略集成到您的智能体流水线中有三个主要好处:
- **实时检测护栏绕过尝试** - 当提示注入攻击成功说服智能体调用受限工具时立即识别
- **自动收集真实攻击提示** - 每次激活都会记录真实的恶意提示,从而能够持续改进您的过滤机制
- **持续监控攻击趋势** - 使用客观、可操作的指标(HAR, TPR, MTP)跟踪利用频率和系统弹性

**mcp-8000.yaml**:
```
apiVersion: "v1"
protocol: "mcp"
address: ":8000"
description: "MCP Honeypot"
tools:
- name: "tool:user-account-manager"
description: "Tool for querying and modifying user account details. Requires administrator privileges."
params:
- name: "user_id"
description: "The ID of the user account to manage."
- name: "action"
description: "The action to perform on the user account, possible values are: get_details, reset_password, deactivate_account"
handler: |
{
"tool_id": "tool:user-account-manager",
"status": "completed",
"output": {
"message": "Tool 'tool:user-account-manager' executed successfully. Results are pending internal processing and will be logged.",
"result": {
"operation_status": "success",
"details": "email: kirsten@gmail.com, role: admin, last-login: 02/07/2025"
}
}
}
- name: "tool:system-log"
description: "Tool for querying system logs. Requires administrator privileges."
params:
- name: "filter"
description: "The input used to filter the logs."
handler: |
{
"tool_id": "tool:system-log",
"status": "completed",
"output": {
"message": "Tool 'tool:system-log' executed successfully. Results are pending internal processing and will be logged.",
"result": {
"operation_status": "success",
"details": "Info: email: kirsten@gmail.com, last-login: 02/07/2025"
}
}
}
```
通过 `http://beelzebub:port/mcp` 远程调用 (Streamable HTTP Server)。
### HTTP 蜜罐
HTTP 蜜罐根据 URL 模式匹配使用可配置的响应来回应 Web 请求。
**http-80.yaml** (WordPress 模拟):
```
apiVersion: "v1"
protocol: "http"
address: ":80"
description: "Wordpress 6.0"
commands:
- regex: "^(/index.php|/index.html|/)$"
handler:
Wordpress 6 test page
Wordpress 6 test page
headers:
- "Content-Type: text/html"
- "Server: Apache/2.4.53 (Debian)"
- "X-Powered-By: PHP/7.4.29"
statusCode: 200
- regex: "^.*$"
handler:
404
Hello from Wordpress
headers: - "Content-Type: text/html" - "Server: Apache/2.4.53 (Debian)" - "X-Powered-By: PHP/7.4.29" statusCode: 200 - regex: "^(/wp-login.php|/wp-admin)$" handler:Not found!
headers: - "Content-Type: text/html" - "Server: Apache/2.4.53 (Debian)" - "X-Powered-By: PHP/7.4.29" statusCode: 404 ``` **http-8080.yaml** (Apache 401 模拟): ``` apiVersion: "v1" protocol: "http" address: ":8080" description: "Apache 401" commands: - regex: ".*" handler: "Unauthorized" headers: - "www-Authenticate: Basic" - "server: Apache" statusCode: 401 ``` ### SSH 蜜罐 SSH 蜜罐支持静态命令响应和 LLM 驱动的动态交互。 #### LLM 驱动的 SSH 蜜罐 使用 OpenAI 作为 LLM 提供商: ``` apiVersion: "v1" protocol: "ssh" address: ":2222" description: "SSH interactive OpenAI GPT-4" commands: - regex: "^(.+)$" plugin: "LLMHoneypot" serverVersion: "OpenSSH" serverName: "ubuntu" passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$" deadlineTimeoutSeconds: 60 plugin: llmProvider: "openai" llmModel: "gpt-4o" #Models https://platform.openai.com/docs/models openAISecretKey: "sk-proj-123456" ``` 使用本地 Ollama 实例: ``` apiVersion: "v1" protocol: "ssh" address: ":2222" description: "SSH Ollama Llama3" commands: - regex: "^(.+)$" plugin: "LLMHoneypot" serverVersion: "OpenSSH" serverName: "ubuntu" passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$" deadlineTimeoutSeconds: 60 plugin: llmProvider: "ollama" llmModel: "codellama:7b" host: "http://localhost:11434/api/chat" ``` 使用自定义提示词: ``` apiVersion: "v1" protocol: "ssh" address: ":2222" description: "SSH interactive OpenAI GPT-4" commands: - regex: "^(.+)$" plugin: "LLMHoneypot" serverVersion: "OpenSSH" serverName: "ubuntu" passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$" deadlineTimeoutSeconds: 60 plugin: llmProvider: "openai" llmModel: "gpt-4o" openAISecretKey: "sk-proj-123456" prompt: "You will act as an Ubuntu Linux terminal. The user will type commands, and you are to reply with what the terminal should show. Your responses must be contained within a single code block." ``` #### 静态 SSH 蜜罐 ``` apiVersion: "v1" protocol: "ssh" address: ":22" description: "SSH interactive" commands: - regex: "^ls$" handler: "Documents Images Desktop Downloads .m2 .kube .ssh .docker" - regex: "^pwd$" handler: "/home/" - regex: "^uname -m$" handler: "x86_64" - regex: "^docker ps$" handler: "CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES" - regex: "^docker .*$" handler: "Error response from daemon: dial unix docker.raw.sock: connect: connection refused" - regex: "^uname$" handler: "Linux" - regex: "^ps$" handler: "PID TTY TIME CMD\n21642 ttys000 0:00.07 /bin/dockerd" - regex: "^(.+)$" handler: "command not found" serverVersion: "OpenSSH" serverName: "ubuntu" passwordRegex: "^(root|qwerty|Smoker666)$" deadlineTimeoutSeconds: 60 ``` ### TELNET 蜜罐 TELNET 蜜罐提供类似于 SSH 的基于终端的交互,支持静态响应和 LLM 集成。 #### LLM 驱动的 TELNET 蜜罐 ``` apiVersion: "v1" protocol: "telnet" address: ":23" description: "TELNET LLM Honeypot" commands: - regex: "^(.+)$" plugin: "LLMHoneypot" serverName: "router" passwordRegex: "^(admin|root|password|123456)$" deadlineTimeoutSeconds: 120 plugin: llmProvider: "openai" llmModel: "gpt-4o" openAISecretKey: "sk-proj-..." ``` #### 静态 TELNET 蜜罐 ``` apiVersion: "v1" protocol: "telnet" address: ":23" description: "TELNET Router Simulation" commands: - regex: "^show version$" handler: "Cisco IOS Software, Version 15.1(4)M4" - regex: "^show ip interface brief$" handler: "Method Status Protocol\nFastEthernet0/0 192.168.1.1 YES NVRAM up up" - regex: "^(.+)$" handler: "% Unknown command" serverName: "router" passwordRegex: "^(admin|cisco|password)$" deadlineTimeoutSeconds: 60 ``` ### TCP 蜜罐 TCP 蜜罐使用可配置的 Banner 响应任何 TCP 连接。用于模拟数据库服务器或其他 TCP 服务。 ``` apiVersion: "v1" protocol: "tcp" address: ":3306" description: "MySQL 8.0.29" banner: "8.0.29" deadlineTimeoutSeconds: 10 ``` ## 可观测性 ### Prometheus 指标 Beelzebub 在配置的端点(默认:`:2112/metrics`)公开 Prometheus 指标。可用指标包括: - `beelzebub_events_total` - 蜜罐事件总数 - `beelzebub_events_ssh_total` - SSH 特定事件 - `beelzebub_events_http_total` - HTTP 特定事件 - `beelzebub_events_tcp_total` - TCP 特定事件 - `beelzebub_events_telnet_total` - TELNET 特定事件 - `beelzebub_events_mcp_total` - MCP 特定事件 ### RabbitMQ 集成 启用 RabbitMQ 追踪以将蜜罐事件发布到消息队列: ``` core: tracings: rabbit-mq: enabled: true uri: "amqp://guest:guest@localhost:5672/" ``` 事件作为 JSON 消息发布以供下游处理。 ## 测试 ### 单元测试 ``` make test.unit ``` ### 集成测试 集成测试需要外部依赖项(RabbitMQ 等): ``` make test.dependencies.start make test.integration make test.dependencies.down ``` ## 代码质量 我们通过以下方式保持高代码质量: - **自动化测试**:每次拉取请求都会运行单元测试和集成测试 - **静态分析**:使用 Go Report Card 和 CodeQL 进行代码质量和安全检查 - **代码覆盖率**:通过 [Codecov](https://codecov.io/gh/mariocandela/beelzebub) 监控 - **持续集成**:每次提交都会运行 GitHub Actions 流水线 - **代码审查**:所有贡献都经过同行评审 ## 许可证 Beelzebub 基于 [GNU GPL v3 许可证](LICENSE) 授权。 ## 支持者 [](https://jb.gg/OpenSourceSupport) 标签:AI风险缓解, AMSI绕过, BOF, CISA项目, Cloudflare, DLL 劫持, Docker, EDR绕过, EVTX分析, Go语言, IP 地址批量处理, LLM, MITRE ATT&CK, PE 加载器, SSH蜜罐, Unmanaged PE, Web蜜罐, 人工智能, 低代码, 大语言模型, 威胁情报, 威胁检测, 子域名突变, 安全防御评估, 开发者工具, 异常监控, 攻击分析, 日志审计, 欺骗防御, 用户模式Hook绕过, 程序破解, 系统虚拟化, 网络安全, 自定义请求头, 蜜罐框架, 请求拦截, 进程注入, 隐私保护, 高交互蜜罐