一个 Mythic C2 Profile,使用 Microsoft Graph API 通过 Microsoft Teams 频道进行通信。
Agent <---> Microsoft Teams Channel <---> C2 Server <---> Mythic
通信表现为正常的 Teams 频道活动。
此 Profile 支持:
从你的 Mythic 服务器:
sudo ./mythic-cli install github https://github.com/Whispergate/msteams
或从本地文件夹:
sudo ./mythic-cli install folder /path/to/msteams
ChannelMessage.Read.All - 读取频道消息ChannelMessage.Send - 发送频道消息如果 ChannelMessage.Send 不可用,请使用 Group.ReadWrite.All 或配置 webhook URL。
完整设置说明位于安装后的 Mythic 文档页面:https://<your-mythic-server>:7443/docs/c2-profiles/msteams。
通过 Mythic UI 编辑:C2 Profiles > msteams > View/Edit Config。
任何实现了 msteams C2 profile 参数的 Mythic agent 都可以使用此 profile。Agent 需要:
test/ 中包含一个模拟测试基础设施,用于在没有任何 Azure 或 M365 账户的情况下进行本地测试。这让你可以针对本地伪造的 Graph API 测试完整的 C2 管道——包括已编译的植入程序。
将 test/mock_server.py 复制到你的 Mythic 主机并启动它:
python3 mock_server.py
这会在端口 8443 上启动一个伪造的 Graph API。
在 Mythic 中使用模拟值配置 msteams C2 profile:
{
"tenant_id": "fake-tenant-id",
"client_id": "fake-client-id",
"client_secret": "fake-client-secret",
"team_id": "fake-team-id",
"channel_id": "fake-channel-id",
"graph_base": "http://<mythic-host-ip>:8443/v1.0",
"login_base": "http://<mythic-host-ip>:8443",
"poll_interval": 3,
"clear_messages": true,
"debug": true
}
在 Mythic UI 中启动 msteams profile。
要针对模拟服务器测试真实的已编译 agent,agent 二进制文件需要使用模拟服务器的 IP 和端口进行硬编码构建,而不是使用真实的 Graph API 端点。在 Starburst agent 代码(agent_code/src/transport/msteams.cc)中:
// Change these for mock testing:
#define GRAPH_API_HOST "<mythic-host-ip>"
#define LOGIN_HOST "<mythic-host-ip>"
#define API_PORT 8443
// And change WINHTTP_FLAG_SECURE to 0 in WinHttpOpenRequest
// since the mock server uses plain HTTP:
WINHTTP_DEFAULT_ACCEPT_TYPES,
0
然后重新安装 Starburst,使用 msteams profile(使用相同的伪造 tenant/client/team/channel ID)构建 payload,并在能够访问 Mythic 主机的 Windows VM 上运行它。
在构建生产 payload 之前,请记得还原这些更改:
#define GRAPH_API_HOST "graph.microsoft.com"
#define LOGIN_HOST "login.microsoftonline.com"
#define API_PORT 443
WINHTTP_DEFAULT_ACCEPT_TYPES,
WINHTTP_FLAG_SECURE
要进行快速的管道测试而无需编译 agent:
GRAPH_URL=http://<mythic-host-ip>:8443 python test/fake_agent.py
更多详情请参见 test/README.md。
clear_messages 以在处理后进行清理poll_interval 合理(10-30 秒)以避免速率限制msteams/
config.json # Mythic container config
C2_Profiles/msteams/
Dockerfile # Container image
main.py # Mythic service entrypoint
requirements.txt # Python dependencies
rabbitmq_config.json # RabbitMQ settings
msteams/
c2_functions/msteams.py # C2Profile class + parameters
c2_code/
server.py # Main polling loop
graph_client.py # MS Graph API client
mythic_client.py # Mythic API forwarder
config.py # Config singleton
config.json # Default config values
documentation-c2/msteams/_index.md # Mythic docs page
test/
mock_server.py # Mock Graph API server
fake_agent.py # Simulated agent for testing
test_c2_server.py # Standalone C2 server test harness
test_config.json # Test config with fake values
| 参数 | 描述 | 默认值 |
|---|
tenant_id | Entra ID 租户(目录)ID | |
client_id | 应用注册客户端 ID | |
client_secret | 应用注册客户端密钥 | |
team_id | Teams 团队 ID | |
channel_id | Teams 频道 ID | |
webhook_url | 用于发送的可选 webhook URL | |
graph_base | Graph API 基础 URL | https://graph.microsoft.com/v1.0 |
login_base | 登录端点基础 URL | https://login.microsoftonline.com |
poll_interval | 轮询间隔秒数 | 10 |
clear_messages | 处理后删除消息 | false |
debug | 启用详细日志记录 | false |