分析 Cobalt Strike 可延展配置文件
使用说明
使用 pyMalleableC2 库解析可延展 C2 配置文件,提取失陷指标(IOC)和检测机会。结合 JARM 指纹识别来识别 C2 服务器。
from malleablec2 import Profile
# 从文件解析可延展配置文件
profile = Profile.from_file("amazon.profile")
# 提取全局选项(休眠时间、抖动、User-Agent)
print(profile.ast.pretty())
# 获取 HTTP-GET 块的 URI 和 Headers,用于构建网络签名
# 获取 HTTP-POST 块中的数据外泄模式
# 对已知 C2 基础设施生成 JARM 指纹
关键分析步骤:
- 解析可延展配置文件,提取 HTTP-GET/POST URI 模式
- 提取 User-Agent 字符串和自定义 Headers,用于 IDS 签名
- 识别休眠时间和抖动,用于设置 Beacon 检测阈值
- 使用 JARM 扫描可疑 IP,与已知 C2 指纹哈希进行匹配
- 将提取的 IOC 与网络流量日志进行交叉参考
示例
# 解析配置文件并提取检测指标
from malleablec2 import Profile
p = Profile.from_file("cobaltstrike.profile")
print(p) # 重建的源码
# 对可疑 C2 服务器进行 JARM 扫描
import subprocess
result = subprocess.run(
["python3", "jarm.py", "suspect-server.com"],
capture_output=True, text=True
)
print(result.stdout)
# 将指纹与已知 CS JARM 哈希进行比对