<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
---
name: performing-c2-infrastructure-hunting
description: >-
  Hunt for adversary command and control infrastructure using certificate analysis, JARM fingerprinting, and passive DNS intelligence.
domain: cybersecurity
subdomain: c2-frameworks
tags:
  - infrastructure-hunting
  - jarm
  - certificate-transparency
  - passive-dns
  - threat-intel
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1071", "T1583"]
  cwe: ["CWE-300"]
  tools: ["JARM", "Shodan", "Censys", "SecurityTrails", "pDNS"]
---

# Performing C2 Infrastructure Hunting

## Overview

Hunt for adversary command and control infrastructure using certificate analysis, JARM fingerprinting, and passive DNS intelligence.

## Prerequisites

| Tool / Requirement | Details |
|---|---|
| `JARM` | Security tooling |
| `Shodan` | Security tooling |
| `Censys` | Security tooling |
| `SecurityTrails` | Security tooling |
| `pDNS` | 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
# JARM fingerprinting
python3 jarm.py target.com -p 443

# Shodan search for C2 signatures
shodan search "ssl.jarm:07d14d16d21d21d07c42d41d00041d24a458a375eef0c576d23a7bab9a9fb1"

# Certificate transparency search
curl -s "https://crt.sh/?q=%.example.com&output=json" | \
    python3 -m json.tool

# Censys search
censys search "services.tls.certificates.leaf.subject.common_name: *.c2domain.com"

# Passive DNS lookup
pdns_lookup example.com --source circl
```

## Workflow

### Step 1: Preparation and Reconnaissance

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

# Set up working directory
mkdir -p /tmp/performing-c2-infrastructure-hunting/{output,logs,artifacts}
```

### Step 2: Primary Analysis

```bash
# Execute primary analysis with JARM
# Refer to Quick Reference above for detailed commands
echo "[*] Running Performing C2 Infrastructure Hunting with JARM..."

# Log all operations
script -q /tmp/performing-c2-infrastructure-hunting/logs/session.log
```

### Step 3: Deep Investigation

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

# Cross-reference findings
diff /tmp/performing-c2-infrastructure-hunting/output/primary.json /tmp/performing-c2-infrastructure-hunting/output/secondary.json
```

### Step 4: Documentation and Reporting

```bash
# Generate structured findings report
cat <<'EOF' > /tmp/performing-c2-infrastructure-hunting/output/report.json
{
  "technique": "performing-c2-infrastructure-hunting",
  "domain": "c2-frameworks",
  "tools_used": ["JARM", "Shodan"],
  "findings": [],
  "recommendations": []
}
EOF
```

## Detection

```yaml
title: C2 Infrastructure Hunting Detection
id: c805a8fc-e03c-414b-9a22-1ac987db54fd
status: experimental
description: Detects suspicious activity related to performing c2 infrastructure hunting 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.t1583
  - attack.command_and_control
falsepositives:
  - Authorized penetration testing tools during scheduled assessments
```


**Detection Opportunities**

| Indicator | Source | Detection Logic |
|---|---|---|
| C2 Infrastructure Hunting Detection | windows/network_connection | Sigma rule (high) |
| ATT&CK Coverage | MITRE ATT&CK | T1071, T1583 |

## 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
- [JARM Documentation](https://jarm.org/) — Primary tooling
- [Shodan Reference](https://shodan.org/) — Secondary tooling
