通过Telegram机器人间消息隧道传输Athena和Apollo代理流量的Mythic C2配置文件,将加密载荷通过其Push C2 gRPC服务桥接到Mythic。
Telegram 为 Athena 和 Apollo agent 提供了一个 Mythic C2 profile。它使用 Telegram 私有的 bot 到 bot 消息作为传输方式,并使用 Mythic 的 Push C2 gRPC 服务作为控制器桥接。
Athena or Apollo agent bot <-> Telegram Bot API <-> controller bot <-> Telegram C2 service <-> Mythic
每个正在运行的 agent 使用自己的 Bot API token。C2 服务使用一个控制器 bot token。两个 bot 都必须启用 Telegram 的 Bot 到 Bot 通信模式。
消息使用一个小型 JSON 信封,并在通过 sendMessage 发送之前被拆分为 2,800 个字符的块。Agent payload 保留其 aes256_hmac 加密;Telegram 服务转发加密的 Mythic 消息而不对其进行解密。
在 Mythic 目录中运行此命令:
./mythic-cli install github https://github.com/DavidCarliez/mythic_telegram_profile
对于本地开发,改为安装检出目录:
./mythic-cli install folder /path/to/telegram -f
在同一个 Mythic 部署中安装一个受支持的 agent fork:
# Athena
./mythic-cli install github https://github.com/DavidCarliez/Athena -b telegram-c2
# Apollo
./mythic-cli install github https://github.com/DavidCarliez/Apollo -b telegram-c2
getUpdates 消费者共享同一个更新队列。私有 bot 到 bot 消息要求两个 bot 都启用通信模式。Telegram 在其 Bot 到 Bot 通信 指南中记录了该要求。
在 Mythic 中,打开 C2 Profiles,展开 telegram 的操作,然后选择 View/Edit Config。设置:
| Key | Value |
|---|---|
botToken | 来自 BotFather 的控制器 bot token |
apiBase | https://api.telegram.org,除非使用兼容的本地 Bot API 服务器 |
pollTimeout | 长轮询超时,从 1 到 50 秒 |
mythicGrpc | Mythic Push C2 gRPC 端点;对于正常的 Mythic 部署,保留提供的值 |
保存配置,然后启动该 profile。
在构建 Athena 或 Apollo 时选择 telegram C2 profile,并提供:
| Parameter | Description |
|---|---|
bot_token | payload 专用 agent bot 的 token |
controller_bot | 控制器 bot 用户名,带或不带 @ |
api_base | Telegram Bot API 基础 URL |
message_checks | 等待每个控制器响应时的最大长轮询次数 |
time_between_checks | 长轮询超时,以秒为单位 |
callback_interval | Agent 回调间隔,以秒为单位 |
callback_jitter | Agent 回调抖动百分比 |
AESPSK | aes256_hmac 消息加密 |
user_agent | 发送到 Telegram 的 HTTP User-Agent |
proxy_* | 可选的 HTTP 代理设置 |
killdate | Payload 过期日期 |
AESPSK。getUpdates 调用会相互消耗对方的响应。每条 Telegram 文本消息包含一个带有以下字段的 JSON 对象:
v:协议版本,当前为 1sender_id:由 agent 进程生成的随机路由标识符client_id:响应路由标识符to_server:方向标志packet_id:块集合标识符reply_to:由控制器响应确认的请求标识符sleep:当前 agent 回调间隔,以秒为单位jitter:当前 agent 回调抖动百分比chunk:从零开始的块索引chunks:总块数,限制为 256message:加密的 Mythic 消息片段不完整的块集合会在十分钟后过期。