一个用于 Mythic C2 框架的监听器配置文件,利用 AI 供应商的文件 API
ai_file 是一个 Mythic C2 profile,它使用公开文档化的 OpenAI Files API,通过 jsonl 文件而非传统的 HTTP/S 监听器来交换植入体消息。它依赖于 OpenAI 在公开文档中定义的 Files API 行为:https://developers.openai.com/api/docs/guides/file-inputs?api-mode=responses。
监听器轮询 /v1/files 端点以查找带有 purpose=batch 的 .jsonl 文件,在本地解密每个请求信封,将原始 Mythic 消息字节转发到 Mythic 的 /agent_message,加密 Mythic 的响应,并将响应 .jsonl 文件上传回 Files API。
\
在 Mythic 目录下:
sudo ./mythic-cli install folder /path/to/openai_file
sudo ./mythic-cli c2 start openai_file
在启动 profile 之前,编辑 C2_Profiles/openai_file/openai_file/c2_code/config.json:
{
"instances": [
{
"name": "default",
"api_key": "REPLACE_ME",
"base_url": "https://api.openai.com/v1",
"organization": "",
"project": "",
"purpose": "batch",
"channel_id": "mythic",
"request_prefix": "mythic_to_server",
"response_prefix": "mythic_to_agent",
"transport_key": "REPLACE_ME",
"poll_interval_seconds": 5,
"delete_processed_files": true,
"debug": true,
"max_file_bytes": 10485760,
"mythic_host": "",
"mythic_port": 0
}
]
}
必需的值是 api_key、transport_key,以及监听器和 payload profile 配置之间匹配的 channel_id。transport_key 可以是 base64:<32 raw bytes> 或高熵口令;口令在用于信封加密之前会经过 SHA-256 派生。
Agent 和监听器使用 OpenAI 的 Files API .jsonl 文件(purpose=batch)交换文件。
请求文件名:
<request_prefix>_<channel_id>_<request_id>.jsonl
响应文件名:
<response_prefix>_<channel_id>_<request_id>.jsonl
默认请求前缀是 mythic_to_server;默认响应前缀是 mythic_to_agent;默认通道是 mythic。
每个文件包含一个或多个 JSON 对象,每行一个:
{"v":1,"profile":"openai_file","channel":"mythic","direction":"request","id":"req_001","alg":"aes-256-cbc-hmac-sha256+base64url","nonce":"...","ciphertext":"...","created_at":0}
ciphertext 是 AES-256-CBC 输出,并在原始 Mythic 消息字节上附加 HMAC-SHA256 标签。nonce 是 CBC IV。nonce 和 ciphertext 是无填充的 base64url。AAD 是:
v|profile|channel|direction|id|alg
例如:
1|openai_file|mythic|request|req_001|aes-256-cbc-hmac-sha256+base64url