# C2 Fundamentals Traffic Shaping

> Use when shaping command and control traffic so it resembles ordinary traffic for the target environment in a lab or an authorized red team engagement. Covers malleable profiles, HTTP method and URI rotation, header and user agent selection, sleep and jitter tuning, data encoding inside plausible content, and detection by defenders through beacon regularity, default profile indicators, and TLS fingerprints.

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

---


Traffic shaping is the practice of making command and control traffic
look like ordinary traffic for the environment it runs in. A profile
defines the method, URIs, headers, user agents, timing, and encoding
of every beacon. This sub-skill belongs under
c2-cobalt-strike-operations because malleable profiles are the
canonical shaping mechanism, but the principles apply to any
authorized implant. All shaping here is for lab work and authorized
engagements under a signed rules of engagement, and the goal is a
clean, measurable test for defenders, not invisibility.

## Quick Workflow

1. Study what ordinary traffic looks like in the target environment, including common user agents, URIs, and content types.
2. Write a profile that matches that traffic, with realistic URIs, headers, and encoding.
3. Set sleep and jitter to match the agreed baseline, and record them.
4. Test the profile end to end in the lab, from beacon generation through tasking and result return.
5. Check the shaped traffic from the defender view, including timing regularity and byte-count patterns.
6. Rotate URIs and user agents across beacons so no single pattern repeats on a fixed schedule.
7. Never reuse a profile across engagements, and never ship a public example profile unchanged.

## 1. Profile structure

A profile has four parts. Timing sets sleep and jitter. The request
shape sets method, URIs, headers, and user agent. Encoding sets how
tasking and results hide inside plausible content, such as JSON
config blobs or image metadata, rather than raw base64 in a query
string. The response shape sets what the server sends back, including
content type and encoding, so responses look like the content they
claim to be.

```c
# Malleable C2 profile fragment, shaped for ordinary web traffic
set sleeptime "60000";
set jitter "30";
set useragent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)";

http-get {
    set uri "/static/js/app.min.js";
    client {
        header "Accept" "application/javascript";
        header "Accept-Language" "en-US,en;q=0.9";
        metadata {
            base64url;
            header "Cookie";
        }
    }
    server {
        header "Content-Type" "application/javascript";
        output {
            base64url;
            print;
        }
    }
}

http-post {
    set uri "/api/v2/config";
    client {
        header "Content-Type" "application/json";
        id {
            base64url;
            parameter "session";
        }
        output {
            base64url;
            print;
        }
    }
    server {
        header "Content-Type" "application/json";
        output {
            base64url;
            print;
        }
    }
}
```

Change every URI, header value, and encoding choice from any public
example before use. Defenders already know public defaults, and a
copied profile is a detection rule waiting to fire.

## 2. Rotation and timing

Rotation breaks repetition. Rotate URIs, user agents, and request
ordering across beacons, so no single pattern repeats every sleep
interval. Vary beacon size too, because identical byte counts on a
fixed schedule are trivially detectable even when the content looks
plausible. Sleep and jitter work together, with jitter adding
randomness around the sleep base, but jitter alone does not save a
profile whose URIs and sizes never change.

```python
# Check rotation coverage before go-live, using the profile URI list
uris = [
    "/static/js/app.min.js",
    "/api/v2/config",
    "/assets/logo.png",
    "/static/css/main.css",
]
user_agents = [
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
]
print(f"URIs in rotation: {len(uris)}")
print(f"user agents in rotation: {len(user_agents)}")
print(f"distinct combinations: {len(uris) * len(user_agents)}")
assert len(uris) >= 3, "rotation needs at least three URIs"
assert len(user_agents) >= 2, "rotation needs at least two user agents"
print("rotation check passed")
```

Test the shaped traffic the way a defender would. Capture a sample
of beacon traffic in the lab, check interval regularity, check
byte-count regularity, and check that the claimed content type
matches the actual payload. If any of those checks fail in the lab,
they will fail faster against a real blue team.

```bash
# Capture shaped beacon traffic in the lab and inspect timing
tcpdump -i eth0 -w /tmp/shaped-beacons.pcap host 203.0.113.10 &
sleep 180
kill %1 2>/dev/null || true
ls -l /tmp/shaped-beacons.pcap
```

## 3. Encoding and blending mistakes

Encode tasking inside plausible content, and keep the encoding
consistent with the claimed content type. JSON tasking inside a
response labeled as JavaScript, or image metadata that is not a
valid image, fails proxy inspection immediately. Keep total beacon
size small and irregular, avoid base64 in query strings, and avoid
custom headers that no real browser or application in the
environment would send. A profile that blends in one environment can
stand out in another, so match the environment you are actually
testing, not a generic internet average.

## Edge cases

- A profile that looks right on paper but breaks tasking in practice costs the first day of the engagement. Test end to end in the lab first.
- Changing a profile mid-engagement requires a team server restart in Cobalt Strike, which drops active beacons. Schedule changes between phases.
- Rotation that cycles predictably is still a pattern. Randomize selection instead of cycling in fixed order.
- Identical beacon sizes across task types reveal tasking even when content is encoded. Pad or vary sizes within the agreed profile.
- A user agent that does not match the target platform stands out immediately. Match user agents to the operating systems in scope.

## Detection and defender view

Defenders detect shaped traffic through beacon timing regularity,
default profile indicators such as known URIs and headers, JA3 TLS
fingerprints that do not match real browsers, content type
mismatches under proxy inspection, and DNS or HTTP anomalies when
shaping is inconsistent. Shaping raises the bar for detection, it
does not remove it. Assume a competent blue team will find
long-running shaped traffic, share indicators with the defensive
contact after the engagement, and treat time to detection as a
measured result.

## Key references

- MITRE ATT&CK T1071 Application Layer Protocol
- MITRE ATT&CK T1071.001 Web Protocols
- MITRE ATT&CK T1132 Data Encoding
- MITRE ATT&CK T1573 Encrypted Channel
- MITRE ATT&CK T1027 Obfuscated Files or Information
- Cobalt Strike docs: https://hstechdocs.helpsystems.com/manuals/cobaltstrike/current/userguide/content/topics/welcome_main.htm
- Malleable C2 profile language reference: https://hstechdocs.helpsystems.com/manuals/cobaltstrike/current/userguide/content/topics/malleable-c2.htm

