# Malware Config Extraction C2 Extraction

> Use when the goal is the complete C2 infrastructure picture from a sample, covering primary and backup addresses, ports, protocols, URI paths, and failover logic. Covers combining static config extraction with sandbox network observation, finding hardcoded vs DGA vs dead-drop-resolver C2, extracting failover and retry logic, and producing IOC packages with confidence levels. Use when incident response needs blocking IOCs, when threat intel needs infrastructure tracking, or when assessing how resilient the C2 channel is.

- Skill: `mizazhaider-ceh/malware-config-extraction-c2-extraction` (Agent Skill)
- Install (CLI): `npx get-skill add mizazhaider-ceh/malware-config-extraction-c2-extraction`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mizazhaider-ceh/malware-config-extraction-c2-extraction/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: mizazhaider-ceh (https://skillmd.com/u/mizazhaider-ceh)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/mizazhaider-ceh/malware-config-extraction-c2-extraction

---


The C2 picture has three sources: addresses embedded in the binary
(config), addresses contacted during detonation (observed), and
addresses the malware can generate or fetch (DGA, resolvers). Any one
source alone is incomplete: configs contain backups never contacted,
detonations miss failover paths, and DGAs hide the real domain. This
sub-skill covers assembling all three into one infrastructure package.
Scope: extract and analyze C2 data only from samples you are authorized
to handle, in an isolated lab, during authorized DFIR or threat intel
work. Never contact attacker infrastructure; analysis is offline only.

## Quick Workflow

1. Extract embedded addresses: decode the config and list every URL,
   IP, domain, and port.
2. Collect observed addresses: DNS queries and connections from the
   sandbox pcap.
3. Reconcile: which embedded addresses were observed, which were not,
   and which observed addresses were not embedded.
4. Hunt for generation logic: DGA functions, hardcoded seeds, date
   dependence.
5. Hunt for resolver logic: dead-drop addresses (social media,
   paste sites, DNS TXT) used to fetch real C2.
6. Map failover order: which address is tried first, what triggers
   fallback, retry intervals.
7. Package IOCs with per-address confidence and observation status.

## 1. Embedded vs observed reconciliation

```text
Embedded (from config decode):
  1. http://beacon.example-cdn[.]net/api/v2/beacon
  2. http://backup.example-cdn[.]net/api/v2/beacon
  3. 192.0.2.44:443

Observed (from pcap):
  DNS beacon.example-cdn[.]net -> 93.184.216.34
  TCP 93.184.216.34:80, 12 beacons

Reconciliation:
  #1 OBSERVED (primary, active)
  #2 EMBEDDED ONLY (backup, never contacted: still block it)
  #3 EMBEDDED ONLY (IP fallback, never contacted: still block it)
```

Embedded-only addresses are preemptive IOCs: the malware will use them
when the primary dies. Observed-only addresses need explanation: a
legitimate service (Windows Update) or an unlisted C2 (fetch from
resolver). Resolve every discrepancy before finalizing.

## 2. DGA detection and analysis

Signs: many DNS queries to random-looking domains, most NXDOMAIN, in a
burst at startup.

```bash
# NXDOMAIN burst in the pcap
tshark -r traffic.pcap -Y "dns.flags.rcode==3" -T fields \
  -e dns.qry.name | sort | uniq -c | sort -rn | head -20
```

Example output shape:

```text
  47 xqztm20261023.example[.]com
  47 plkqw20261023.example[.]net
  ...
```

Dated, algorithmic names in a burst: classic DGA. Next steps: find the
generation function (search for the seed constant and date usage),
reimplement it to predict future domains, and note the seed and
algorithm for threat intel. DGA domains are published as patterns or
predicted lists, not single IOCs; coordinate with intel on the format.

## 3. Dead-drop resolvers

Some families fetch the real C2 from a public location: a social media
profile, a paste site, a DNS TXT record, a blockchain comment. Signs in
the trace: an HTTP GET to a legitimate site early in execution,
followed by C2 traffic to a new address.

```text
Trace shape:
  T+5s  GET https://paste.example/p/abcd1234   (legitimate site)
  T+8s  DNS evil-c2.example[.]net              (address from the paste)
  T+9s  POST https://evil-c2.example[.]net/beacon
```

The dead-drop location is itself an IOC (monitor it, request takedown
through proper channels), and the fetched address is the operational
C2. Document the fetch mechanism: defenders who only block the final
domain miss the resilience story.

## 4. Failover and retry logic

Read the connection loop to understand resilience:

```text
Typical logic (from disassembly or trace inference):
  for addr in [primary, backup, ip_fallback]:
      try connect(addr, timeout=30s)
      if success: break
  sleep(retry_interval) and restart list on total failure
```

Extract: the ordered address list, per-address timeout, sleep between
full cycles, and any backoff (linear, exponential). This tells the SOC
how fast blocking the primary shifts traffic to the backup (often
seconds), which justifies blocking all addresses at once rather than
one at a time.

## 5. IOC packaging

```text
C2 infrastructure package: Nimbus loader, 2026-10-23
CONFIRMED (observed in detonation):
  beacon.example-cdn[.]net -> 93.184.216.34:80
    HTTP POST /api/v2/beacon, 60s interval, UA NimbusAgent/2.1
EXTRACTED (in config, not observed):
  backup.example-cdn[.]net (backup, order 2)
  192.0.2.44:443 (IP fallback, order 3)
DGA: none observed
RESOLVER: none observed
RETRY: 30s per address, 60s full cycle, no backoff
```

Confidence labels: CONFIRMED for observed, EXTRACTED for config-only,
PREDICTED for DGA output. Expiry guidance: domains fast (days),
IPs medium (weeks), URI paths slow (months). Hand to the SOC with
blocking priority in that order.

## Edge cases

- C2 over legitimate services (Telegram, Discord, cloud storage):
  blocking the domain is infeasible; detect on the token, channel,
  or request pattern instead.
- Encrypted SNI / ECH: the domain is hidden; rely on IP, JA3, and
  behavioral patterns.
- P2P C2: no fixed addresses; the IOC is the protocol signature and
  bootstrap node list.
- C2 that only activates on trigger (specific date, command):
  detonation shows nothing; the config is the only source.
- IPv6 C2: ensure the IOC package and blocks cover v6, not just v4.

## Escalation

- If infrastructure analysis reveals a large active botnet or
  victim data on the C2's side (from a sinkhole you operate with
  authorization), escalate to threat intel and legal/compliance
  before any further action.
- If the C2 overlaps with legitimate shared infrastructure (CDN,
  cloud), escalate blocking decisions: collateral damage risk needs
  explicit approval.

- If extracted infrastructure is shared with unrelated crimeware (bulletproof host), escalate to threat intel for clustering before blocking.
- If the C2 uses a domain generation algorithm with a future seed, share predicted domains with intel partners rather than acting alone.

## Detection and defender view

Block everything at once: primary, backups, and fallbacks, because
failover is measured in seconds. Prefer pattern detections (URI path,
User-Agent, JA3, beacon interval) alongside domain blocks, since
domains are the cheapest thing for the operator to replace. Feed the
failover timing to the SOC: "blocking the primary buys about 30
seconds before the backup is tried" sets honest expectations. Track
infrastructure reuse across families; shared C2 is a clustering
signal stronger than most code similarities.

## Key references

- MITRE ATT&CK: T1071 (Application Layer Protocol), T1008 (Fallback
  Channels), T1568 (Dynamic Resolution)
- Wireshark documentation:
  https://www.wireshark.org/docs/
- CAPE Sandbox documentation:
  https://capev2.readthedocs.io/
- DGArchive (DGA reference):
  https://dgarchive.caad.fkie.fraunhofer.de/
- Malpedia (family infrastructure references):
  https://malpedia.caad.fkie.fraunhofer.de/

