<!-- 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-c2-redirectors
description: >-
  Implement C2 traffic redirectors using Apache mod_rewrite, Nginx, CDNs, and cloud services to obscure team server infrastructure.
domain: cybersecurity
subdomain: c2-frameworks
tags:
  - redirectors
  - mod-rewrite
  - cdn
  - infrastructure-hiding
  - opsec
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1090"]
  cwe: ["CWE-300"]
  tools: ["Apache", "Nginx", "socat", "iptables", "CloudFront"]
---

# Implementing C2 Redirectors

## Overview

Implement C2 traffic redirectors using Apache mod_rewrite, Nginx, CDNs, and cloud services to obscure team server infrastructure.

## Prerequisites

| Tool / Requirement | Details |
|---|---|
| `Apache` | Security tooling |
| `Nginx` | Security tooling |
| `socat` | Security tooling |
| `iptables` | Security tooling |
| `CloudFront` | 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
# Apache mod_rewrite redirector
cat <<'EOF' > /etc/apache2/sites-available/redirector.conf
<VirtualHost *:443>
    SSLEngine On
    SSLCertificateFile /etc/letsencrypt/live/cdn.example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/cdn.example.com/privkey.pem

    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/api/v1/.*
    RewriteCond %{HTTP_USER_AGENT} "Mozilla/5.0.*"
    RewriteRule ^(.*)$ https://teamserver.internal:443$1 [P,L]

    RewriteRule ^(.*)$ https://legitimate-site.com$1 [L,R=302]
</VirtualHost>
EOF

# socat simple redirector
socat TCP-LISTEN:443,fork TCP:teamserver:443
```

## Workflow

### Step 1: Preparation and Reconnaissance

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

# Set up working directory
mkdir -p /tmp/implementing-c2-redirectors/{output,logs,artifacts}
```

### Step 2: Primary Analysis

```bash
# Execute primary analysis with Apache
# Refer to Quick Reference above for detailed commands
echo "[*] Running Implementing C2 Redirectors with Apache..."

# Log all operations
script -q /tmp/implementing-c2-redirectors/logs/session.log
```

### Step 3: Deep Investigation

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

# Cross-reference findings
diff /tmp/implementing-c2-redirectors/output/primary.json /tmp/implementing-c2-redirectors/output/secondary.json
```

### Step 4: Documentation and Reporting

```bash
# Generate structured findings report
cat <<'EOF' > /tmp/implementing-c2-redirectors/output/report.json
{
  "technique": "implementing-c2-redirectors",
  "domain": "c2-frameworks",
  "tools_used": ["Apache", "Nginx"],
  "findings": [],
  "recommendations": []
}
EOF
```

## Detection

```yaml
title: C2 Redirectors Detection
id: 1e63669b-3eeb-4405-b0ec-3f3cfd26405d
status: experimental
description: Detects suspicious activity related to implementing c2 redirectors techniques in c2 frameworks context
logsource:
  category: network_connection
  product: windows
detection:
  selection:
    DestinationPort: 443
    Initiated: "true"
  condition: selection
level: high
tags:
  - attack.t1090
  - attack.command_and_control
falsepositives:
  - Authorized penetration testing tools during scheduled assessments
```


**Detection Opportunities**

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

## 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 T1090](https://attack.mitre.org/techniques/T1090) — Related technique
- [Apache Documentation](https://apache.org/) — Primary tooling
- [Nginx Reference](https://nginx.org/) — Secondary tooling
