cyber-green/hive
GitHub: cyber-green/hive
Hive 是一个由 WikiLeaks 公开的模块化 C2 框架,供安全研究人员研究 implant 通信、多协议触发与加密机制。
Stars: 1 | Forks: 0
# Hive C2 框架
## 概述
Hive 是一个模块化的 C2 框架,它使用 **HTTPS beaconing** 和 **Twofish 加密的 jshell** 来进行操作员交互。它支持:
- **7 种触发协议**用于出站连接(DNS、HTTP、ICMP 等)
- 用于 implant 到 C2 流量的 **XTEA + bzip2** 加密/压缩
- 用于 SSL/TLS、DH 密钥交换和 RSA 签名的 **Polarssl**
- **跨平台 implant**:Linux x86/x86_64、Solaris SPARC/x86、MikroTik (MIPS/PPC/x86)、ARM
- 通过 `hive-patcher` 工具对预编译的服务器二进制文件进行**内存中修补**
- **Honeycomb**:一个独立的 Python/C 收集器,用于解密、解压和记录 beacon 数据
## 仓库结构
```
hive/
├── client/ # Implant (hclient-linux)
│ ├── main.c # Entry point — beacon loop, trigger dispatch
│ ├── trigger.c # Trigger management
│ ├── trigger_network.c
│ ├── trigger_protocols.c # 7 beacon trigger implementations
│ ├── patcher.c # In-memory binary patcher
│ ├── b64.c # Base64
│ ├── ssl/ # PolarSSL-based TLS + custom crypto wrapper
│ └── Makefile
│
├── server/ # Controller (hived)
│ ├── main.c # Server entry, listener setup
│ ├── beacon.c # Beacon handler
│ ├── client_session.c # Session management
│ ├── jshell.c # Twofish-encrypted operator shell
│ ├── trigger_listen.c # Trigger listening
│ ├── trigger_sniff.c # Trigger sniffing
│ ├── trigger_callback_session.c
│ ├── trigger_payload.c
│ ├── twofish.c / farm9crypt.c / shuffle.c # Twofish implementation
│ ├── persistence.h
│ ├── compression.c
│ ├── process_list.c / ifconfig.c / survey_mac.c / survey_uptime.c # Recon
│ ├── Makefile, Makefile.* # Build targets for 10+ platforms
│ └── cryptcat-c-port/ # Cryptcat with Twofish support
│
├── common/ # Shared libraries
│ ├── crypto/ # Crypto utilities (mod_gen_string_header.py, mod_gen_cryptostring_header.py)
│ ├── debug/ # Debug helpers
│ ├── strings/ # String obfuscation
│ ├── polarssl-1.1.8/
│ └── bzip2-1.0.6/
│
├── honeycomb/ # Python beacon collector (offline log parser)
│ ├── honeycomb.py
│ ├── crypto.c / blth.c
│ └── watchdog.sh
│
└── ilm-client/ # C++ plugin for the parent "InterfaceLibrary" framework
├── hive.cpp / Ilm.cpp / Command.cpp / Connection.cpp / File.cpp
└── Makefile
```
## 构建状态:未完成
WikiLeaks 公开的版本缺少几个源文件,导致无法顺利完成构建:
### 缺失的源文件(未包含在 WikiLeaks 的发布中)
| 文件 | 用途 |
|---|---|
| `server/daemonize.c` / `.h` | 进程 daemon化 |
| `server/run_command.c` / `.h` | 命令执行 |
| `server/get_data.c` / `.h` | 从目标收集数据 |
| `server/netstat_an.c` / `netstat_rn.c` | 收集网络状态 |
| `server/tiny_crc16.c` / `.h` | 用于 payload 验证的 CRC16 |
| `server/trigger_b64.c` / `.h` | Base64 触发器编码 |
| `server/threads.h` | 线程声明 |
| `client/cryptcat/`(整个目录) | 带有 Twofish 的 Cryptcat(由 Makefile 引用) |
### 可修复的问题
| 问题 | 修复方法 |
|---|---|
| 缺少 `client/ssl/polarssl/` 符号链接 | `ln -s polarssl-0.14.0 polarssl` |
| 缺少 `server/polarssl/` 符号链接 | `ln -s polarssl-0.14.0 polarssl` |
| Python 脚本不在 `client/` 或 `server/` 中 | 从 `common/crypto/` 复制/建立符号链接 |
| `farm9crypt.h`, `twofish.h`, `port.h`, `shuffle.h` | 从 `server/cryptcat-c-port/` 复制到 `server/` |
| 加密字符串 `.txt` 不在 `client/` 中 | 从 `common/` 复制 |
### 构建期间自动生成的文件
| 文件 | 命令 |
|---|---|
| `_unpatched_*.h`(7 个文件) | 从预编译的服务器二进制文件执行 `xxd -i ` |
| `init_strings.c`, `init_crypto_strings.c` | Python `mod_gen_string_header.py` |
## 外部依赖
- **PolarSSL**(已包含 — `polarssl-0.14.0`, `polarssl-1.1.8`, `polarssl-1.3.4`)
- **bzip2**(已包含 — `bzip2-1.0.6`)
- **libILM_SDK.a**(未包含 — 闭源 InterfaceLibrary)
## 构建 (Linux x86)
```
# Symlinks
cd server && ln -s polarssl-0.14.0 polarssl && cd ..
cd client && ln -s ssl/polarssl-0.14.0 ssl/polarssl && cd ..
# 复制 crypto headers 到位
cp common/crypto/*.py client/
cp common/crypto/*.py server/
cp common/crypto/crypto_strings.txt client/
# 复制 cryptcat headers
cp server/cryptcat-c-port/farm9crypt.h server/
cp server/cryptcat-c-port/twofish.h server/
cp server/cryptcat-c-port/port.h server/
cp server/cryptcat-c-port/shuffle.h server/
# 构建 server
cd server && make -f Makefile.linux-x86
# 构建 client
cd client && make
```
## 贡献
如果您拥有上述任何**缺失的源文件**的副本,请提交 pull request。我们的目标是使这个代码库尽可能完整和可构建,以便供研究人员使用。
## 注意事项
这是由 WikiLeaks 发布的正在使用中的 C2 框架的研究存档。提供此代码**仅用于教育和研究目的**。WikiLeaks 的发布版中省略了几个文件,且外部库(ILM SDK)是私有的。
标签:C2框架, DNS 反向解析, IP 地址批量处理, 命令与控制, 安全学习资源, 客户端加密, 跨平台植入体, 逆向工具