Skip to main content
command CX Codex

c2_evasion — Claude Code command: analyze and modify C2

c2_evasion examines C2 framework source code, locates detection rules (YARA, Sigma), and suggests modifications to bypass signatures. Takes a path to the source as an argument.

MIT ★ 336 updated 2026-04-09

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/c2_evasion.md
Open on GitHub

What c2_evasion does

The command spawns the c2-evasion-agent subagent to parse a C2 framework's structure (implant, server), search for known detection rules via gh CLI, and produce separate analysis for each rule found. Prioritizes compiler flags first (low effort, high impact), followed by build configuration, source modifications, and function refactoring as a last resort. All output goes into ./rules/<c2_name>/ with subdirectories for rule types (yara, sigma, network), per-rule analysis in rule_analysis/, and a summary report.

The command requires an explicit path to C2 source (for example, /path/to/c2 or ./mythic-agent). It does not compile, run, or test modified binaries—only analyzes and documents changes. Available across Claude Code, Codex, GitHub Copilot, and Gemini CLI, each with its own config file in the corresponding project folder (.claude/commands/, ~/.codex/prompts/, and so on).

What it helps with

  • locate all detection rules (YARA, Sigma, Network) for a specific C2 framework
  • analyze each rule to identify which strings or hex patterns trigger it
  • find the lowest-effort modification strategy (compiler flags, build config, or source changes)
  • document evasion strategies and code modifications for each rule

Example prompts for the agent

  • Analyze C2 evasion for /home/user/mythic-agent
  • Modify source in ./sliver-client to evade YARA rules
  • Run C2 analysis on ../c2-frameworks/beacon

How to install c2_evasion

Manually: put the files in place

.claude/commands/c2_evasion.md

Call it with /c2_evasion. For all projects use ~/.claude/commands/

Questions about c2_evasion

How do I install c2_evasion in Claude Code?

Add the file .claude/commands/c2_evasion.md to your project root. For other platforms: Codex uses ~/.codex/prompts/c2_evasion.md, GitHub Copilot uses .github/prompts/c2_evasion.prompt.md, and Gemini CLI uses .gemini/commands/c2_evasion.toml.

What does c2_evasion do?

It searches for detection rules targeting C2 frameworks (YARA, Sigma), analyzes each rule separately to identify which patterns trigger it, and recommends modifications—compiler flags, build settings, or code changes—to bypass detection. Results are saved as structured reports.

Do I need the compiled C2 binary for this to work?

No. The command only needs the path to source code. It analyzes the source, does not compile or execute modified binaries, and produces documentation of changes and evasion strategies.

Source text

c2_evasion.md · MIT
---
description: Analyze C2 framework source code, find detection rules (YARA, Sigma, etc.), and modify source to evade detection. Triggers on "C2 evasion", "analyze C2", "YARA", "modify C2", "bypass detection", "C2免杀".
argument-hint: Required: path to C2 source (e.g., "/path/to/c2")
---

# C2 Evasion Command

Launch the c2-evasion-agent to analyze and modify C2 framework source code.

## Usage

```bash
/c2_evasion /path/to/c2/source
/c2_evasion ./mythic-agent
/c2_evasion ./sliver-client
```

## What This Command Does

1. **Identifies C2 framework** type and components (implant/server)
2. **Searches detection rules** (YARA, Sigma, Network) via `gh` CLI
3. **Per-rule analysis** - Creates separate analysis for EACH rule with evasion strategies
4. **Proactively searches** for sensitive strings (even if YARA rules are hex-only)
5. **Modifies source code** - Compiler flags FIRST, then source changes
6. **Documents all changes** in `./rules/<c2_name>/`

## CRITICAL: Per-Rule Analysis

For EACH YARA/Sigma rule, create `./rules/<c2_name>/rule_analysis/<rule_name>.md`:
- Parse all patterns ($a1, $s1, hex, regex)
- Identify pattern source in code
- Develop evasion strategies with priority:
  1. **Compiler flags** (LOWEST effort, HIGHEST impact)
  2. **Build configuration** changes
  3. **Source code** modifications
  4. **Function/struct refactoring** (last resort)

## Priority Framework

| Priority | Component | Action |
|----------|-----------|--------|
| 1 (HIGHEST) | Implant/Beacon/Agent | MODIFY |
| 2 (HIGH) | Network Exposure | MODIFY |
| 3 (SKIP) | Internal Strings | SKIP |

## Evasion Priority

| Strategy | Priority | Effort |
|----------|----------|--------|
| Compiler flags | 1 (BEST) | Low |
| Build config | 2 | Medium |
| Source changes | 3 | Medium |
| Refactoring | 4 | High |

## Output

```
./rules/<c2_name>/
├── yara/              # Found YARA rules
├── sigma/             # Found Sigma rules
├── network/           # Found network rules
├── rule_analysis/           # Per-rule analysis files
│   ├── Windows_Trojan_X.md
│   └── ...
├── binary_assets/
│   └── analysis.md
├── hex_analysis.md
└── modifications_summary.md
```

## Security

- **ONLY** modify code in user-provided path
- **NEVER** run or test modified binaries
- **NEVER skip a rule** - every rule must have analysis
- **ALWAYS try compiler flags first**
- Document ALL changes

## Agent

Spawns `c2-evasion-agent` subagent for comprehensive analysis and modification.

See `c2_evasion` skill for detailed workflow.

© JDArmy · MIT · JDArmy/Evasion-SubAgents

Similar slash commands

All slash commands for Security →
detection-engineer 0xSteph detection-engineer turns an attack technique into a detection rule you can load: Sigma, Splunk SPL, Elastic EQL, Sentinel Kusto, YARA. Includes tuning notes. CX Codex ★ 2,482repo stars agency-threat-intelligence-analyst huytran1120 agency-threat-intelligence-analyst is a Claude Code skill that examines cyber threats, actor groups, and attack campaigns. It maps adversary behavior to MITRE ATT&CK and produces intelligence reports and detection rules. CX Codex +1 ★ 85repo stars windows-av-evasion yaklang windows-av-evasion — a playbook skill for bypassing AV and EDR on Windows: AMSI, ETW, .NET assembly loading, shellcode execution, process injection. CX Codex +1 3,900installs analyzing-command-and-control-communication mahipal The analyzing-command-and-control-communication skill examines malware C2 traffic to map protocols, beacon patterns, encoding, commands, and infrastructure. Use it when a PCAP needs protocol analysis or detection signatures. CX Codex +1 545installs analyzing-cobalt-strike-beacon-configuration mahipal The analyzing-cobalt-strike-beacon-configuration skill for Claude Code extracts Cobalt Strike Beacon settings from PE files and memory dumps, including C2 servers, malleable profiles, and license watermarks. CX Codex +1 410installs security-detections-mcp reason-machines security-detections-mcp connects your coding agent to an MCP server querying detection rules across Sigma, Splunk, and Elastic. Useful for spotting coverage gaps in MITRE ATT&CK. CX Codex +1 863installs

From the same set22

The whole set →
evasion-agent This subagent modifies a supplied shellcode loader with evasion techniques from a knowledge base. Its workflow includes compilation, but excludes running or testing the executable. CX Codex ★ 336repo stars loadergen-agent loadergen-agent builds shellcode loaders in C, C++ or Rust from knowledge base components and compiles with MinGW. For evasion technique research and security tool testing. CX Codex ★ 336repo stars evasion_integrate evasion_integrate adds evasion techniques to a shellcode loader you already have: it edits the source, checks which tricks fit and builds the binary. CX Codex +1 ★ 336repo stars tool_profile tool_profile is a Claude Code rule about SharpHound, the data collector used by BloodHound. It applies to questions about Active Directory collection, the tool’s build, and detection. CX Codex +1 ★ 336repo stars loader_generate loader_generate spawns an agent to assemble and compile C, C++, or Rust shellcode loaders from a techniques knowledge base. CX Codex +1 ★ 336repo stars rule_inventory The rule_inventory rule catalogues YARA indicators for Stowaway, including binary names, strings, paths, command-line patterns, and hashes. Use it when checking samples for those indicators. CX Codex +1 ★ 336repo stars tool_profile tool_profile — a Claude rule that profiles Stowaway: what the Go multi-hop proxy is built from, how it compiles, and which traces it leaves on a host. CX Codex +1 ★ 336repo stars rule_mapping rule_mapping is a Claude Code rule that analyzes YARA and Sigma signatures for AdaptixC2. It helps assess which signatures are outdated during detection rule reviews. CX Codex +1 ★ 336repo stars

Project sponsors

Companies that keep this analytics open