C2 framework AV evasion methodology
In-depth reference
The following reference materialsLoad on demand, read when reaching the corresponding Phase:
6-step decision process
Phase 1: 识别 C2 组件
├─ 找到 implant/beacon/agent 目录
└─ 识别语言(C/Go/Rust/Python)
Phase 2: 检测规则搜索 → ⛔必读 references/detection-search.md
├─ YARA 规则(VirusTotal/GitHub/Elastic/ESET)
├─ Sigma 规则(日志行为检测)
└─ 网络规则(Snort/Suricata/Zeek)
Phase 3: 逐规则分析 → ⛔必读 references/rule-analysis.md
├─ 解析每个 $s1/$a1/hex pattern
├─ 定位源码中产生该 pattern 的位置
├─ 制定免杀策略(优先级: 编译器标志 > 构建配置 > 源码修改 > 重构)
│
├─ Phase 3.5: Hex 分析 → references/hex-analysis.md
├─ Phase 3.6: 二进制资产 → references/binary-analysis.md
└─ Phase 3.7: 字符串搜索 → references/string-search.md
Phase 4: 靶向修改 → ⛔必读 references/source-modify.md
├─ ⛔ 编译器标志优先!(-O2, -fomit-frame-pointer, -fno-ident)
├─ 字符串混淆(XOR 加密)
├─ 函数重命名
└─ Makefile/构建链修改
Phase 5: 验证
└─ grep 确认所有检测 pattern 已消除
Phase 6: 文档
└─ 生成 modifications_summary.md
Priority framework
| Priority |
Component |
Action |
| 1 (Highest) |
Implant/Beacon/Agent binary |
Must modify |
| 2 (High) |
Network signature exposure |
Must modify |
| 3 (Skip) |
Internal strings (do not affect detection) |
Can skip |
AV evasion strategy decision matrix
| Pattern type |
Compiler flags |
Source code modification |
Both required |
| Function prologue |
✅ Usually sufficient |
✅ Alternative |
Rare |
| String bytes |
❌ Ineffective |
✅ Required |
— |
| API call sequence |
⚠️ May be effective |
✅ Required |
Sometimes |
| Configuration struct |
❌ Ineffective |
✅ Required |
— |
String obfuscation
- After obfuscation must verify: compilation passes, functionality is normal, operation is unaffected
- Automated processing: batch replacement via script, not manual one-by-one modification