Files
beelzebub/README.md

326 lines
8.7 KiB
Markdown
Raw Normal View History

# Beelzebub
2022-06-13 23:56:23 +02:00
2023-06-04 23:21:22 +02:00
[![CI](https://github.com/mariocandela/beelzebub/actions/workflows/ci.yml/badge.svg)](https://github.com/mariocandela/beelzebub/actions/workflows/ci.yml) [![Docker](https://github.com/mariocandela/beelzebub/actions/workflows/docker-image.yml/badge.svg)](https://github.com/mariocandela/beelzebub/actions/workflows/docker-image.yml) [![codeql](https://github.com/mariocandela/beelzebub/actions/workflows/codeql.yml/badge.svg)](https://github.com/mariocandela/beelzebub/actions/workflows/codeql.yml)
2023-10-11 23:35:58 +02:00
[![Go Report Card](https://goreportcard.com/badge/github.com/mariocandela/beelzebub/v3)](https://goreportcard.com/report/github.com/mariocandela/beelzebub/v3)
[![codecov](https://codecov.io/gh/mariocandela/beelzebub/graph/badge.svg?token=8XTK7D4WHE)](https://codecov.io/gh/mariocandela/beelzebub)
2023-10-11 23:35:58 +02:00
[![Go Reference](https://pkg.go.dev/badge/github.com/mariocandela/beelzebub/v3.svg)](https://pkg.go.dev/github.com/mariocandela/beelzebub/v3)
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)
2022-05-14 19:04:44 +02:00
2023-06-04 23:21:22 +02:00
## Overview
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
<img src="https://beelzebub.netlify.app/go-beelzebub.png" alt="Beelzebub Logo" width="200"/>
2023-06-04 23:21:22 +02:00
## LLM Honeypot
2023-06-04 23:21:22 +02:00
[![asciicast](https://asciinema.org/a/665295.svg)](https://asciinema.org/a/665295)
2023-06-04 23:21:22 +02:00
## Telegram Bot for Real-Time Attacks
2023-06-04 23:21:22 +02:00
Stay updated on real-time attacks by joining our dedicated Telegram channel: [Telegram Channel](https://t.me/beelzebubhoneypot)
2023-03-09 07:32:36 +01:00
2023-06-04 23:21:22 +02:00
## Examples
2022-06-14 11:51:32 +02:00
2023-06-04 23:21:22 +02:00
To better understand the capabilities of Beelzebub, you can explore our example repository: [mariocandela/beelzebub-example](https://github.com/mariocandela/beelzebub-example)
2022-06-14 11:51:32 +02:00
2022-05-14 19:04:44 +02:00
## Quick Start
2023-06-04 23:21:22 +02:00
We provide two quick start options for build and run Beelzebub: using Docker Compose or the Go compiler.
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
```
### 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
```
### 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
## Testing
We provide two types of tests: unit tests and integration tests.
### Unit Tests
To run unit tests:
2022-07-03 17:15:38 +02:00
```bash
$ make test.unit
2023-06-04 23:21:22 +02:00
```
### Integration Tests
2022-07-03 17:15:38 +02:00
2023-06-04 23:21:22 +02:00
To run integration tests:
```bash
$ make test.dependencies.start
$ make test.integration
$ make test.dependencies.down
2023-06-04 23:21:22 +02:00
```
2023-06-04 23:21:22 +02:00
## Key Features
2023-06-04 23:21:22 +02:00
Beelzebub offers a wide range of features to enhance your honeypot environment:
- Support for Ollama
- Support for OpenAI
- SSH Honeypot
- HTTP Honeypot
- TCP Honeypot
2023-06-04 23:21:22 +02:00
- Prometheus openmetrics integration
- Docker integration
- RabbitMQ integration
- kubernetes
2023-06-04 23:21:22 +02:00
## Example Configuration
2022-05-14 19:04:44 +02:00
2023-06-04 23:21:22 +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.
2022-05-14 19:04:44 +02:00
2023-06-04 23:21:22 +02:00
To execute Beelzebub with your custom path, use the following command:
```bash
$ ./beelzebub --confCore ./configurations/beelzebub.yaml --confServices ./configurations/services/
```
Here are some example configurations for different honeypot scenarios:
#### Example HTTP Honeypot on Port 80
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
2023-06-04 23:21:22 +02:00
#### Example HTTP Honeypot on Port 8080
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
2023-06-04 23:21:22 +02:00
#### Example SSH Honeypot
2022-06-02 12:49:33 +02:00
###### LLM Honeypots
Follow a SSH LLM Honeypot using OpenAI as provider LLM:
```yaml
apiVersion: "v1"
protocol: "ssh"
address: ":2222"
2024-07-21 20:15:09 +02:00
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: "gpt4-o" #Models https://platform.openai.com/docs/models
openAISecretKey: "sk-proj-123456"
```
Examples with local Ollama instance using model codellama:7b:
```yaml
apiVersion: "v1"
protocol: "ssh"
address: ":2222"
2024-07-21 20:15:09 +02:00
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" #Models https://ollama.com/search
host: "http://example.com/api/chat" #default http://localhost:11434/api/chat
2023-06-04 23:21:22 +02: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:
llmProvider: "openai"
llmModel: "gpt4-o"
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
###### SSH Honeypot on Port 22
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
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
Beelzebub is licensed under the [MIT License](LICENSE).
## Supported by JetBrains
[![JetBrains Black Box Logo logo](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_square.png)](https://jb.gg/OpenSourceSupport)