<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
---
name: detecting-c2-beaconing-patterns
description: >-
  Detect command and control beaconing patterns through statistical analysis of network traffic timing, jitter, and payload characteristics.
domain: cybersecurity
subdomain: c2-frameworks
tags:
  - beaconing
  - detection
  - network-analysis
  - jitter
  - statistical-analysis
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1071", "T1573"]
  cwe: ["CWE-300"]
  tools: ["RITA", "Zeek", "Wireshark", "NetworkMiner", "JA3"]
---

# Detecting C2 Beaconing Patterns

## Overview

Detect command and control beaconing patterns through statistical analysis of network traffic timing, jitter, and payload characteristics.

## Prerequisites

| Tool / Requirement | Details |
|---|---|
| `RITA` | Security tooling |
| `Zeek` | Security tooling |
| `Wireshark` | Security tooling |
| `NetworkMiner` | Security tooling |
| `JA3` | Security tooling |
| Isolated lab environment for testing | Environment requirement |
| Authorization and signed Rules of Engagement (RoE) | Environment requirement |
| Relevant target samples or systems acquired through authorized channels | Environment requirement |

## Quick Reference

```bash
# RITA beaconing analysis
rita import /path/to/zeek/logs -d engagement_db
rita show-beacons engagement_db --human-readable

# Zeek connection analysis
zeek -r capture.pcap
cat conn.log | zeek-cut ts id.orig_h id.resp_h id.resp_p duration | \
    sort -t$'\t' -k2,2 -k3,3

# Statistical jitter analysis
python3 -c "
import pandas as pd
df = pd.read_csv('conn.log', sep='\t', comment='#',
                  names=['ts','uid','orig','orig_p','resp','resp_p'])
intervals = df.groupby(['orig','resp'])['ts'].diff().dropna()
print(f'Mean interval: {intervals.mean():.2f}s')
print(f'Std deviation: {intervals.std():.2f}s')
print(f'Jitter ratio: {intervals.std()/intervals.mean():.4f}')
"
```

## Workflow

### Step 1: Preparation and Reconnaissance

```bash
# Identify target and gather initial intelligence
file ./target_sample
rita --version 2>/dev/null || echo "Install RITA"

# Set up working directory
mkdir -p /tmp/detecting-c2-beaconing-patterns/{output,logs,artifacts}
```

### Step 2: Primary Analysis

```bash
# Execute primary analysis with RITA
# Refer to Quick Reference above for detailed commands
echo "[*] Running Detecting C2 Beaconing Patterns with RITA..."

# Log all operations
script -q /tmp/detecting-c2-beaconing-patterns/logs/session.log
```

### Step 3: Deep Investigation

```bash
# Apply Zeek for secondary analysis
echo "[*] Deep investigation with Zeek..."

# Cross-reference findings
diff /tmp/detecting-c2-beaconing-patterns/output/primary.json /tmp/detecting-c2-beaconing-patterns/output/secondary.json
```

### Step 4: Documentation and Reporting

```bash
# Generate structured findings report
cat <<'EOF' > /tmp/detecting-c2-beaconing-patterns/output/report.json
{
  "technique": "detecting-c2-beaconing-patterns",
  "domain": "c2-frameworks",
  "tools_used": ["RITA", "Zeek"],
  "findings": [],
  "recommendations": []
}
EOF
```

## Detection

```yaml
title: C2 Beaconing Patterns Detection
id: 04ec3e22-05c4-4312-97fb-479e149d11a2
status: experimental
description: Detects suspicious activity related to detecting c2 beaconing patterns techniques in c2 frameworks context
logsource:
  category: network_connection
  product: windows
detection:
  selection:
    DestinationPort: 443
    Initiated: "true"
  condition: selection
level: high
tags:
  - attack.t1071
  - attack.t1573
  - attack.command_and_control
falsepositives:
  - Authorized penetration testing tools during scheduled assessments
```


**Detection Opportunities**

| Indicator | Source | Detection Logic |
|---|---|---|
| C2 Beaconing Patterns Detection | windows/network_connection | Sigma rule (high) |
| ATT&CK Coverage | MITRE ATT&CK | T1071, T1573 |

## Verification

- [ ] Environment and tools verified and operational
- [ ] Target samples acquired through authorized channels
- [ ] Primary analysis completed with findings documented
- [ ] Secondary validation performed with independent tooling
- [ ] All artifacts preserved in structured output directory
- [ ] Detection opportunities documented for blue team

## References

- [MITRE ATT&CK T1071](https://attack.mitre.org/techniques/T1071) — Related technique
- [RITA Documentation](https://rita.org/) — Primary tooling
- [Zeek Reference](https://zeek.org/) — Secondary tooling
