2023-06-04 23:25:43 +02:00
# Beelzebub
2022-06-13 23:56:23 +02:00
2023-06-04 23:21:22 +02:00
[](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)
2023-10-11 23:35:58 +02:00
[](https://goreportcard.com/report/github.com/mariocandela/beelzebub/v3)
2023-10-09 01:16:53 +02:00
[](https://codecov.io/gh/mariocandela/beelzebub)
2023-10-11 23:35:58 +02:00
[](https://pkg.go.dev/github.com/mariocandela/beelzebub/v3)
2023-10-30 12:29:34 +01:00
[](https://github.com/avelino/awesome-go)
2022-05-14 19:04:44 +02:00
2023-06-04 23:21:22 +02:00
## Overview
2024-06-26 23:22:56 +02:00
Beelzebub is an advanced honeypot framework designed to provide a highly secure environment for detecting and analyzing cyber attacks. It offers a low code approach for easy implementation and uses AI to mimic the behavior of a high-interaction honeypot.
2023-06-04 23:21:22 +02:00
2023-08-31 16:38:05 +02:00
< img src = "https://beelzebub.netlify.app/go-beelzebub.png" alt = "Beelzebub Logo" width = "200" / >
2023-06-04 23:21:22 +02:00
2025-07-01 23:07:49 +02:00
## Key Features
Beelzebub offers a wide range of features to enhance your honeypot environment:
- Low-code configuration: YAML-based, modular service definition
- LLM integration: The LLM convincingly simulates a real system, creating high-interaction honeypot experiences, while actually maintaining low-interaction architecture for enhanced security and easy management.
- Multi-protocol support: SSH, HTTP, TCP, MCP(Detect prompt injection against LLM agents)
- Prometheus metrics & observability
- Docker & Kubernetes ready
- ELK stack ready, docs: [Official ELK integration ](https://www.elastic.co/docs/reference/integrations/beelzebub )
## LLM SSH Honeypot Demo
2023-06-04 23:21:22 +02:00
2024-06-23 20:04:43 +02:00
[](https://asciinema.org/a/665295)
2025-07-01 23:07:49 +02:00
## Code Quality
We are strongly committed to maintaining high code quality in the Beelzebub project. Our development workflow includes comprehensive testing, code reviews, static analysis, and continuous integration to ensure the reliability and maintainability of the codebase.
### What We Do
* **Automated Testing:**
Both unit and integration tests are run on every pull request to catch regressions and ensure stability.
2023-06-04 23:21:22 +02:00
2025-07-01 23:07:49 +02:00
* **Static Analysis:**
We use tools like Go Report Card and CodeQL to automatically check for code quality, style, and security issues.
2023-03-31 20:03:42 +02:00
2025-07-01 23:07:49 +02:00
* **Code Coverage:**
Our test coverage is monitored with [Codecov ](https://codecov.io/gh/mariocandela/beelzebub ), and we aim for extensive coverage of all core components.
2023-03-09 07:32:36 +01:00
2025-07-01 23:07:49 +02:00
* **Continuous Integration:**
Every commit triggers automated CI pipelines on GitHub Actions, which run all tests and quality checks.
2022-06-14 11:51:32 +02:00
2025-07-01 23:07:49 +02:00
* **Code Reviews:**
All new contributions undergo peer review to maintain consistency and high standards across the project.
2022-06-14 11:51:32 +02:00
2022-05-14 19:04:44 +02:00
## Quick Start
2025-07-01 23:07:49 +02:00
You can run Beelzebub via Docker, Go compiler(cross device), or Helm (Kubernetes).
2022-05-14 19:04:44 +02:00
2023-06-04 23:21:22 +02:00
### Using Docker Compose
2022-05-14 19:04:44 +02:00
2023-06-04 23:21:22 +02:00
1. Build the Docker images:
2022-05-14 19:04:44 +02:00
2023-06-04 23:21:22 +02:00
```bash
$ docker-compose build
```
2. Start Beelzebub in detached mode:
```bash
$ docker-compose up -d
```
2025-07-01 23:07:49 +02:00
2023-06-04 23:21:22 +02:00
### Using Go Compiler
2022-05-14 19:04:44 +02:00
2023-06-04 23:21:22 +02:00
1. Download the necessary Go modules:
```bash
$ go mod download
```
2. Build the Beelzebub executable:
```bash
$ go build
```
3. Run Beelzebub:
```bash
$ ./beelzebub
```
2023-09-21 23:19:56 +02:00
### Deploy on kubernetes cluster using helm
1. Install helm
2. Deploy beelzebub:
```bash
$ helm install beelzebub ./beelzebub-chart
```
3. Next release
```bash
$ helm upgrade beelzebub ./beelzebub-chart
```
2023-06-04 23:21:22 +02:00
2025-07-01 23:07:49 +02:00
## Example Configuration
2023-06-04 23:21:22 +02:00
2025-07-01 23:07:49 +02:00
Beelzebub allows easy configuration for different services and ports. Simply create a new file for each service/port within the `/configurations/services` directory.
2023-06-04 23:21:22 +02:00
2025-07-01 23:07:49 +02:00
To execute Beelzebub with your custom path, use the following command:
2022-07-03 17:15:38 +02:00
```bash
2025-07-01 23:07:49 +02:00
$ ./beelzebub --confCore ./configurations/beelzebub.yaml --confServices ./configurations/services/
2023-06-04 23:21:22 +02:00
```
2025-07-01 23:07:49 +02:00
Here are some example configurations for different honeypot scenarios:
2023-02-26 18:04:05 +01:00
2025-07-01 23:07:49 +02:00
### MCP Honeypot
2023-02-26 18:04:05 +01:00
2025-07-01 23:07:49 +02:00
#### Why choose an MCP Honeypot?
2023-02-26 18:04:05 +01:00
2025-07-01 23:07:49 +02:00
An MCP honeypot is a **decoy tool** that the agent should never invoke under normal circumstances. Integrating this strategy into your agent pipeline offers three key benefits:
2022-12-21 00:12:43 +01:00
2025-07-01 23:07:49 +02:00
* **Real-time detection of guardrail bypass attempts.**
Instantly identify when a prompt injection attack successfully convinces the agent to invoke a restricted tool.
* **Automatic collection of real attack prompts for guardrail fine-tuning.**
Every activation logs genuine malicious prompts, enabling continuous improvement of your filtering mechanisms.
* **Continuous monitoring of attack trends through key metrics (HAR, TPR, MTP).**
Track exploit frequency and system resilience using objective, actionable measurements.
2022-12-21 00:12:43 +01:00
2025-07-01 23:07:49 +02:00
##### Example MCP Honeypot Configuration
2022-05-14 19:04:44 +02:00
2025-07-01 23:07:49 +02:00
###### mcp-8000.yaml
2022-05-14 19:04:44 +02:00
2025-07-01 23:07:49 +02:00
```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"
}
}
}
2023-06-04 23:21:22 +02:00
```
2025-07-01 23:07:49 +02:00
#### Invoke remotely: beelzebub:port/mcp (Streamable HTTPServer).
2023-06-04 23:21:22 +02:00
2025-07-01 23:07:49 +02:00
### HTTP Honeypot
2022-05-14 19:04:44 +02:00
2022-05-14 19:10:18 +02:00
###### http-80.yaml
2022-05-14 19:04:44 +02:00
```yaml
apiVersion: "v1"
protocol: "http"
address: ":80"
2022-06-02 12:49:33 +02:00
description: "Wordpress 6.0"
2022-05-14 19:04:44 +02:00
commands:
2023-06-04 23:21:22 +02:00
- regex: "^(/index.php|/index.html|/)$"
handler:
< html >
< header >
< title > Wordpress 6 test page< / title >
< / header >
< body >
< h1 > Hello from Wordpress< / h1 >
< / body >
< / html >
2022-05-14 19:04:44 +02:00
headers:
- "Content-Type: text/html"
2022-06-02 12:49:33 +02:00
- "Server: Apache/2.4.53 (Debian)"
- "X-Powered-By: PHP/7.4.29"
2022-05-14 19:04:44 +02:00
statusCode: 200
2023-06-04 23:21:22 +02:00
- regex: "^(/wp-login.php|/wp-admin)$"
handler:
< html >
< header >
< title > Wordpress 6 test page< / title >
< / header >
< body >
< form action = "" method = "post" >
< label for = "uname" > < b > Username< / b > < / label >
< input type = "text" placeholder = "Enter Username" name = "uname" required >
< label for = "psw" > < b > Password< / b > < / label >
< input type = "password" placeholder = "Enter Password" name = "psw" required >
< button type = "submit" > Login< / button >
< / form >
< / body >
< / html >
2022-05-14 19:04:44 +02:00
headers:
- "Content-Type: text/html"
2022-06-02 12:49:33 +02:00
- "Server: Apache/2.4.53 (Debian)"
- "X-Powered-By: PHP/7.4.29"
statusCode: 200
2023-06-04 23:21:22 +02:00
- regex: "^.*$"
handler:
< html >
< header >
< title > 404< / title >
< / header >
< body >
< h1 > Not found!< / h1 >
< / body >
< / html >
headers:
- "Content-Type: text/html"
- "Server: Apache/2.4.53 (Debian)"
- "X-Powered-By: PHP/7.4.29"
statusCode: 404
```
2022-06-02 12:49:33 +02:00
2025-07-01 23:07:49 +02:00
### HTTP Honeypot
2022-05-14 19:04:44 +02:00
2022-05-14 19:10:18 +02:00
###### http-8080.yaml
2022-05-14 19:04:44 +02:00
```yaml
apiVersion: "v1"
protocol: "http"
address: ":8080"
2022-06-02 12:49:33 +02:00
description: "Apache 401"
2022-05-14 19:04:44 +02:00
commands:
2022-06-02 12:49:33 +02:00
- regex: ".*"
2022-05-14 19:04:44 +02:00
handler: "Unauthorized"
headers:
2022-06-02 12:49:33 +02:00
- "www-Authenticate: Basic"
- "server: Apache"
2022-05-14 19:04:44 +02:00
statusCode: 401
2023-06-04 23:21:22 +02:00
```
2022-05-14 19:04:44 +02:00
2025-07-01 23:07:49 +02:00
### SSH Honeypot
2022-06-02 12:49:33 +02:00
2025-02-16 22:48:59 +01:00
###### LLM Honeypots
2024-07-21 20:11:18 +02:00
2025-02-16 22:48:59 +01:00
Follow a SSH LLM Honeypot using OpenAI as provider LLM:
2024-07-21 20:11:18 +02:00
```yaml
apiVersion: "v1"
protocol: "ssh"
address: ":2222"
2024-07-21 20:15:09 +02:00
description: "SSH interactive OpenAI GPT-4"
2024-07-21 20:11:18 +02:00
commands:
- regex: "^(.+)$"
plugin: "LLMHoneypot"
serverVersion: "OpenSSH"
serverName: "ubuntu"
passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$"
deadlineTimeoutSeconds: 60
plugin:
2025-02-16 22:48:59 +01:00
llmProvider: "openai"
2025-02-20 18:20:17 +01:00
llmModel: "gpt-4o" #Models https://platform.openai.com/docs/models
2024-07-21 20:11:18 +02:00
openAISecretKey: "sk-proj-123456"
```
2025-02-16 22:48:59 +01:00
Examples with local Ollama instance using model codellama:7b:
2022-12-16 23:02:16 +01:00
```yaml
apiVersion: "v1"
protocol: "ssh"
address: ":2222"
2024-07-21 20:15:09 +02:00
description: "SSH Ollama Llama3"
2022-12-16 23:02:16 +01:00
commands:
- regex: "^(.+)$"
2024-07-21 20:11:18 +02:00
plugin: "LLMHoneypot"
2022-12-16 23:02:16 +01:00
serverVersion: "OpenSSH"
serverName: "ubuntu"
passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$"
deadlineTimeoutSeconds: 60
plugin:
2025-02-16 22:48:59 +01:00
llmProvider: "ollama"
llmModel: "codellama:7b" #Models https://ollama.com/search
2024-07-21 20:11:18 +02:00
host: "http://example.com/api/chat" #default http://localhost:11434/api/chat
2023-06-04 23:21:22 +02:00
```
2025-01-14 08:45:30 +01:00
Example with custom prompt:
```yaml
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:
2025-02-16 22:48:59 +01:00
llmProvider: "openai"
2025-02-20 18:20:17 +01:00
llmModel: "gpt-4o"
2025-01-14 08:45:30 +01:00
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."
```
2023-06-04 23:21:22 +02:00
2025-07-01 23:07:49 +02:00
###### SSH Honeypot
2022-12-16 23:02:16 +01:00
2022-05-14 19:10:18 +02:00
###### ssh-22.yaml
2022-05-14 19:04:44 +02:00
```yaml
apiVersion: "v1"
protocol: "ssh"
address: ":22"
2023-06-04 23:21:22 +02:00
2022-06-02 12:49:33 +02:00
description: "SSH interactive"
2022-05-14 19:04:44 +02:00
commands:
- regex: "^ls$"
2023-06-04 23:21:22 +02:00
handler: "Documents Images Desktop Downloads .m2 .kube .ssh .docker"
2022-05-14 19:04:44 +02:00
- regex: "^pwd$"
handler: "/home/"
- regex: "^uname -m$"
handler: "x86_64"
- regex: "^docker ps$"
2023-06-04 23:21:22 +02:00
handler: "CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES"
2022-05-14 19:04:44 +02:00
- regex: "^docker .*$"
handler: "Error response from daemon: dial unix docker.raw.sock: connect: connection refused"
- regex: "^uname$"
handler: "Linux"
- regex: "^ps$"
2023-06-04 23:21:22 +02:00
handler: "PID TTY TIME CMD\n21642 ttys000 0:00.07 /bin/dockerd"
2022-05-14 19:04:44 +02:00
- regex: "^(.+)$"
handler: "command not found"
serverVersion: "OpenSSH"
serverName: "ubuntu"
2022-06-02 12:49:33 +02:00
passwordRegex: "^(root|qwerty|Smoker666)$"
2022-05-14 19:04:44 +02:00
deadlineTimeoutSeconds: 60
2023-06-04 23:21:22 +02:00
```
2022-06-02 12:49:33 +02:00
2025-07-01 23:07:49 +02:00
## Testing
Maintaining excellent code quality is essential for security-focused projects like Beelzebub. We welcome all contributors who share our commitment to robust, readable, and reliable code!
### Unit Tests
For contributor, we have a comprehensive suite of unit/integration tests that cover the core functionality of Beelzebub. To run the unit tests, use the following command:
```bash
$ make test.unit
```
### Integration Tests
To run integration tests:
```bash
$ make test.dependencies.start
$ make test.integration
$ make test.dependencies.down
```
2023-06-04 23:21:22 +02:00
## Roadmap
2022-07-03 17:15:38 +02:00
2023-06-04 23:21:22 +02:00
Our future plans for Beelzebub include developing it into a robust PaaS platform.
2022-05-14 19:04:44 +02:00
## Contributing
2023-06-04 23:21:22 +02:00
The Beelzebub team welcomes contributions and project participation. Whether you want to report bugs, contribute new features, or have any questions, please refer to our [Contributor Guide ](CONTRIBUTING.md ) for detailed information. We encourage all participants and maintainers to adhere to our [Code of Conduct ](CODE_OF_CONDUCT.md ) and foster a supportive and respectful community.
2022-05-14 19:04:44 +02:00
Happy hacking!
## License
2023-08-30 23:04:35 +02:00
Beelzebub is licensed under the [MIT License ](LICENSE ).
2023-01-08 13:10:19 +01:00
2025-04-05 08:52:13 +02:00
## Supported by
[](https://jb.gg/OpenSourceSupport)
