<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
---
name: implementing-encrypted-c2-channels
description: >-
  Implement encrypted C2 channels using custom encryption, certificate pinning, and protocol obfuscation to resist TLS inspection, packet capture, and network forensics.
domain: cybersecurity
subdomain: c2-frameworks
tags:
  - encrypted-c2
  - tls
  - certificate-pinning
  - protocol-obfuscation
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1573"]
  frameworks: ["MITRE ATT&CK"]
  tools: ["openssl", "custom-crypto", "wireshark"]
---

# Implementing Encrypted C2 Channels

## Overview

Implement encrypted C2 channels using custom encryption, certificate pinning, and protocol obfuscation to resist TLS inspection, packet capture, and network forensics.

## Prerequisites

| Tool / Requirement | Details |
|---|---|
| `openssl` | Security tooling |
| `custom-crypto` | Security tooling |
| `wireshark` | Security tooling |
| OpenSSL, custom encryption library, C2 framework, PKI infrastructure | Environment requirement |

## Quick Reference

```bash
# Quick start commands
node scripts/agent.js --help
node scripts/agent.js certs --type self-signed --cn cdn.microsoft.com
```

## Workflow

### Step 1: Generate Certificates

```bash
node scripts/agent.js certs --type self-signed --cn cdn.microsoft.com
```

### Step 2: Configure Encrypted Channel

```bash
node scripts/agent.js configure --encryption aes-256-gcm --pinning enabled
```

### Step 3: Test Against Inspection

```bash
node scripts/agent.js test --proxy mitm-proxy --verify pinning
```

## Detection

```yaml
title: Encrypted C2 Channels Detection
id: c46fc19d-e60b-4f65-a35e-2849ee78b616
status: experimental
description: Detects suspicious activity related to implementing encrypted c2 channels techniques in c2 frameworks context
logsource:
  category: network_connection
  product: windows
detection:
  selection:
    DestinationPort: 443
    Initiated: "true"
  condition: selection
level: high
tags:
  - attack.t1573
  - attack.command_and_control
falsepositives:
  - Authorized penetration testing tools during scheduled assessments
```


**Detection Opportunities**

| Indicator | Source | Detection Logic |
|---|---|---|
| Encrypted C2 Channels Detection | windows/network_connection | Sigma rule (high) |
| ATT&CK Coverage | MITRE ATT&CK | T1573 |

## Verification

- **Verify certificate**: `node scripts/agent.js verify --component certs`
- **Confirm encryption**: `node scripts/agent.js verify --component encryption`

## References

- MITRE ATT&CK: T1573
- Frameworks: MITRE ATT&CK
- Tools: openssl, custom-crypto, wireshark
