[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EFEGTG66FS08X1TFEBJ1KH":3,"skill-same:01M7EFEGTG66FS08X1TFEBJ1KH":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":44,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":47,"updatedAt":48,"install":49,"resources":62},"01M7EFEGTG66FS08X1TFEBJ1KH","building-c2-redirector-infrastructure",null,"Build dumb-pipe and traffic-filtering C2 redirectors with nginx (proxy_pass) and Apache (mod_rewrite), deriving filter rules from a Malleable C2 profile, layering Let's Encrypt TLS, and applying OPSEC controls like domain fronting and UA\u002Fgeo filtering. Use when standing up red-team C2 that must survive blue-team triage or ensuring only profile-matching implant traffic reaches the hidden team server.","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Fbuilding-c2-redirector-infrastructure\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: building-c2-redirector-infrastructure\ndescription: Build dumb-pipe and traffic-filtering C2 redirectors with nginx (proxy_pass) and Apache (mod_rewrite), deriving filter rules from a Malleable C2 profile, layering Let's Encrypt TLS, and applying OPSEC controls like domain fronting and UA\u002Fgeo filtering. Use when standing up red-team C2 that must survive blue-team triage or ensuring only profile-matching implant traffic reaches the hidden team server.\ndomain: cybersecurity\nsubdomain: red-teaming\ntags:\n- red-team\n- c2-infrastructure\n- redirector\n- nginx\n- apache-mod-rewrite\n- malleable-c2\n- opsec\n- traffic-filtering\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- DE.CM-01\nmitre_attack:\n- T1090.002\n---\n# Building C2 Redirector Infrastructure\n\n> **Authorized Use Only:** This skill is for authorized red-team engagements, adversary-emulation exercises, and defensive research only. Command-and-control infrastructure is dual-use; deploying redirectors to control malware on systems you are not explicitly authorized to test is illegal. Operate only inside an agreed scope with a signed rules-of-engagement document, and decommission infrastructure when the engagement ends.\n\n## Overview\n\nA C2 redirector is an intermediary host that sits between victim implants and the real team server. Beacons connect to the redirector's public domain\u002FIP; the redirector inspects each request and either proxies legitimate C2 traffic back to the hidden team server or diverts everything else (scanners, blue-team analysts, sandboxes) to a benign decoy site. This protects the team server from discovery, takedown, and attribution, and lets operators rotate the public edge without rebuilding the backend. The technique maps to MITRE ATT&CK **T1090.002 (Proxy: External Proxy)** — adversaries route C2 through an intermediary node to obscure the true origin.\n\nRedirectors come in two flavors. **Dumb pipes** (socat, iptables NAT) blindly forward a port and provide separation but no filtering. **Smart\u002Ffiltering redirectors** (nginx `proxy_pass`, Apache `mod_rewrite` with `[P]`, or purpose-built tools like RedWarden) parse HTTP requests and only forward traffic that matches the implant's Malleable C2 profile — correct URI, User-Agent, headers — while sending everything else a `302` to a real website. The filtering logic is derived directly from the C2 framework's traffic profile, so the two must stay in lock-step. Tools such as `cs2modrewrite` automate generating Apache\u002Fnginx rules from a Cobalt Strike Malleable C2 profile.\n\nThis skill covers building both dumb and filtering redirectors with nginx and Apache, deriving filter rules from a malleable profile, layering TLS with Let's Encrypt, and applying OPSEC controls (categorized domains, domain fronting\u002FCDN fronting, header validation, geo\u002FUA filtering) for resilient, low-attribution infrastructure.\n\n## When to Use\n\n- Standing up red-team C2 that must survive blue-team triage and domain takedown requests.\n- Separating a hidden team server from any internet-facing host during an engagement.\n- Filtering implant traffic so only profile-matching requests reach the backend, diverting scanners.\n- Adding TLS termination, domain categorization, and CDN\u002Fdomain fronting to an HTTP(S) listener.\n- Teaching defenders how external-proxy C2 (T1090.002) is constructed so they can detect it.\n\n## Prerequisites\n\n- One or more disposable cloud VPS instances (the redirector edge) and a separate, firewalled team-server host.\n- A registered domain with controllable DNS, ideally aged\u002Fcategorized.\n- Root on the redirector host. Install the web server and TLS tooling:\n  ```bash\n  # Debian\u002FUbuntu redirector\n  sudo apt update\n  sudo apt install -y nginx apache2 socat certbot python3-certbot-nginx git\n  # Enable Apache proxy modules if using mod_rewrite redirector\n  sudo a2enmod rewrite proxy proxy_http ssl headers\n  ```\n- The C2 framework's Malleable C2 profile (Cobalt Strike `.profile`, Sliver\u002FHavoc HTTP profile) defining URIs, User-Agent, and headers.\n- `cs2modrewrite` to auto-generate rules from a Cobalt Strike profile:\n  ```bash\n  git clone https:\u002F\u002Fgithub.com\u002Fthreatexpress\u002Fcs2modrewrite\n  ```\n- Firewall the team server so it only accepts the redirector's source IP on the C2 port.\n\n## Objectives\n\n- Deploy a dumb-pipe redirector (socat\u002Fiptables) for fast port separation.\n- Deploy a filtering nginx reverse-proxy redirector keyed to a malleable profile.\n- Deploy an Apache `mod_rewrite` redirector with `[P]` proxying and `302` decoy fallback.\n- Auto-generate redirector rules from a Cobalt Strike profile with `cs2modrewrite`.\n- Terminate TLS with Let's Encrypt and harden the public edge.\n- Apply OPSEC: header\u002FUA validation, geo filtering, decoy diversion, and infra rotation.\n\n## MITRE ATT&CK Mapping\n\n| Technique ID | Official Name | Relevance |\n|--------------|---------------|-----------|\n| T1090.002 | Proxy: External Proxy | The redirector is an external intermediary that proxies C2 to hide the team server |\n| T1090.004 | Proxy: Domain Fronting | CDN fronting routes beacon traffic through a trusted high-reputation domain |\n| T1071.001 | Application Layer Protocol: Web Protocols | C2 is tunneled over HTTP\u002FHTTPS shaped by the malleable profile |\n| T1573.002 | Encrypted Channel: Asymmetric Cryptography | TLS termination at the redirector encrypts the beacon channel |\n| T1583.006 | Acquire Infrastructure: Web Services | Disposable VPS\u002FCDN edges are acquired for resilient C2 |\n\n## Workflow\n\n### 1. Lab and firewall the team server\nPlace the team server on a private host. Restrict its C2 port to the redirector's IP only.\n```bash\n# On the team server: only the redirector (203.0.113.10) may reach 443\u002Ftcp\nsudo ufw default deny incoming\nsudo ufw allow from 203.0.113.10 to any port 443 proto tcp\nsudo ufw allow OpenSSH\nsudo ufw enable\n```\n\n### 2. Dumb-pipe redirector (socat \u002F iptables)\nFor quick separation with no filtering, forward the C2 port to the team server.\n```bash\n# socat foreground forward of 443 -> team server\nsocat TCP4-LISTEN:443,fork,reuseaddr TCP4:10.0.0.2:443\n\n# Or iptables DNAT (persistent)\nsysctl -w net.ipv4.ip_forward=1\niptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.0.0.2:443\niptables -t nat -A POSTROUTING -p tcp -d 10.0.0.2 --dport 443 -j MASQUERADE\n```\n\n### 3. Filtering nginx reverse-proxy redirector\nOnly proxy requests whose URI matches the malleable profile; send everything else a `302` to a decoy. Replace the location regex and User-Agent with values from your profile.\n```nginx\n# \u002Fetc\u002Fnginx\u002Fsites-available\u002Fredirector.conf\nserver {\n    listen 443 ssl;\n    server_name cdn.example.com;\n\n    ssl_certificate     \u002Fetc\u002Fletsencrypt\u002Flive\u002Fcdn.example.com\u002Ffullchain.pem;\n    ssl_certificate_key \u002Fetc\u002Fletsencrypt\u002Flive\u002Fcdn.example.com\u002Fprivkey.pem;\n\n    # Proxy ONLY profile-matching C2 URIs to the hidden team server\n    location ~ ^\u002F(api\u002Fv2\u002Fjobs|cm\u002F[a-z0-9]+|push) {\n        # Require the implant's exact User-Agent\n        if ($http_user_agent != \"Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36\") {\n            return 302 https:\u002F\u002Fwww.legitimate-decoy.com\u002F;\n        }\n        proxy_pass https:\u002F\u002F10.0.0.2;\n        proxy_ssl_verify off;\n        proxy_set_header Host $host;\n        proxy_set_header X-Forwarded-For $remote_addr;\n    }\n\n    # Everything else -> benign decoy\n    location \u002F {\n        return 302 https:\u002F\u002Fwww.legitimate-decoy.com\u002F;\n    }\n}\n```\n```bash\nsudo ln -s \u002Fetc\u002Fnginx\u002Fsites-available\u002Fredirector.conf \u002Fetc\u002Fnginx\u002Fsites-enabled\u002F\nsudo nginx -t && sudo systemctl reload nginx\n```\n\n### 4. Apache mod_rewrite redirector\nApache's `[P]` flag proxies matching requests to the team server; non-matches get a `302` redirect. This is the format `cs2modrewrite` produces.\n```apache\n# \u002Fetc\u002Fapache2\u002Fsites-available\u002Fredirector.conf  (inside \u003CVirtualHost *:443>)\nRewriteEngine On\nSSLProxyEngine On\n# Require the implant User-Agent\nRewriteCond %{HTTP_USER_AGENT} \"Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36\" [NC]\n# Match valid C2 URIs (GET\u002FPOST\u002Fstager) from the malleable profile\nRewriteCond %{REQUEST_URI} ^\u002F(api\u002Fv2\u002Fjobs|cm\u002F[a-z0-9]+|push)\u002F?$\n# Proxy to the hidden team server, preserving the URI\nRewriteRule ^.*$ https:\u002F\u002F10.0.0.2%{REQUEST_URI} [P,L]\n# Everything else -> decoy site\nRewriteRule ^.*$ https:\u002F\u002Fwww.legitimate-decoy.com\u002F [R=302,L]\n```\n```bash\nsudo a2ensite redirector && sudo apache2ctl configtest && sudo systemctl reload apache2\n```\n\n### 5. Generate rules from a malleable profile\nLet `cs2modrewrite` build the Apache or nginx rules directly from your Cobalt Strike profile so the filter exactly matches beacon traffic.\n```bash\ncd cs2modrewrite\n# Apache mod_rewrite rules\npython3 cs2modrewrite.py -i havex.profile -c https:\u002F\u002F10.0.0.2 \\\n  -r https:\u002F\u002Fwww.legitimate-decoy.com -o \u002Fetc\u002Fapache2\u002Fredirect.rules\n# nginx config\npython3 cs2nginx.py -i havex.profile -c https:\u002F\u002F10.0.0.2 \\\n  -r https:\u002F\u002Fwww.legitimate-decoy.com -H cdn.example.com > \u002Fetc\u002Fnginx\u002Fsites-available\u002Fc2.conf\n```\n\n### 6. Terminate TLS with Let's Encrypt\nIssue a valid certificate so beacon HTTPS does not throw TLS warnings and the edge looks legitimate.\n```bash\nsudo certbot --nginx -d cdn.example.com --agree-tos -m ops@example.com --redirect\n# Verify auto-renewal\nsudo certbot renew --dry-run\n```\n\n### 7. Apply OPSEC controls\nLayer defenses against blue-team analysis: validate headers, geofence to the target country, divert sandboxes, and rotate edges. Consider CDN\u002Fdomain fronting (T1090.004) where supported.\n```bash\n# Example: drop non-target geographies at the firewall with ipset\u002FGeoIP,\n# require a custom auth header in the profile, and rotate the redirector\n# domain\u002FIP on a schedule. Check the redirector only forwards matched traffic:\ncurl -k https:\u002F\u002Fcdn.example.com\u002F                       # expect 302 to decoy\ncurl -k -A \"Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36\" \\\n  https:\u002F\u002Fcdn.example.com\u002Fapi\u002Fv2\u002Fjobs                  # expect proxied response\n```\n\n## Tools and Resources\n\n| Tool | Purpose | Source |\n|------|---------|--------|\n| nginx | Filtering reverse-proxy redirector | https:\u002F\u002Fnginx.org\u002F |\n| Apache mod_rewrite | `[P]` proxy + `302` decoy redirector | https:\u002F\u002Fhttpd.apache.org\u002Fdocs\u002Fcurrent\u002Fmod\u002Fmod_rewrite.html |\n| cs2modrewrite | Generate Apache\u002Fnginx rules from CS profile | https:\u002F\u002Fgithub.com\u002Fthreatexpress\u002Fcs2modrewrite |\n| RedWarden | Malleable-aware filtering C2 reverse proxy | https:\u002F\u002Fgithub.com\u002Fmgeeky\u002FRedWarden |\n| redi | Automated nginx + Let's Encrypt CS redirector | https:\u002F\u002Fgithub.com\u002Ftaherio\u002Fredi |\n| socat | Dumb-pipe TCP forwarder | http:\u002F\u002Fwww.dest-unreach.org\u002Fsocat\u002F |\n| Let's Encrypt \u002F certbot | Free TLS certificates | https:\u002F\u002Fcertbot.eff.org\u002F |\n| ired.team | Red-team infrastructure reference | https:\u002F\u002Fwww.ired.team\u002Foffensive-security\u002Fred-team-infrastructure |\n\n## Validation Criteria\n\n- [ ] Team server firewalled to accept only the redirector source IP on the C2 port.\n- [ ] Redirector deployed (dumb pipe and\u002For filtering reverse proxy).\n- [ ] Filter rules derived from the actual malleable C2 profile (URI + User-Agent + headers).\n- [ ] Non-matching requests return a `302` to a benign decoy site (verified with curl).\n- [ ] Matching beacon requests are proxied to the hidden team server (verified with curl).\n- [ ] Valid TLS certificate issued and auto-renewal confirmed.\n- [ ] OPSEC controls applied (UA\u002Fheader validation, geofencing, decoy diversion).\n- [ ] Domain categorization \u002F CDN fronting considered where applicable.\n- [ ] Infrastructure rotation and decommissioning plan documented.\n- [ ] All activity confined to the authorized engagement scope.\n","# Building C2 Redirector Infrastructure\n\n> **Authorized Use Only:** This skill is for authorized red-team engagements, adversary-emulation exercises, and defensive research only. Command-and-control infrastructure is dual-use; deploying redirectors to control malware on systems you are not explicitly authorized to test is illegal. Operate only inside an agreed scope with a signed rules-of-engagement document, and decommission infrastructure when the engagement ends.\n\n## Overview\n\nA C2 redirector is an intermediary host that sits between victim implants and the real team server. Beacons connect to the redirector's public domain\u002FIP; the redirector inspects each request and either proxies legitimate C2 traffic back to the hidden team server or diverts everything else (scanners, blue-team analysts, sandboxes) to a benign decoy site. This protects the team server from discovery, takedown, and attribution, and lets operators rotate the public edge without rebuilding the backend. The technique maps to MITRE ATT&CK **T1090.002 (Proxy: External Proxy)** — adversaries route C2 through an intermediary node to obscure the true origin.\n\nRedirectors come in two flavors. **Dumb pipes** (socat, iptables NAT) blindly forward a port and provide separation but no filtering. **Smart\u002Ffiltering redirectors** (nginx `proxy_pass`, Apache `mod_rewrite` with `[P]`, or purpose-built tools like RedWarden) parse HTTP requests and only forward traffic that matches the implant's Malleable C2 profile — correct URI, User-Agent, headers — while sending everything else a `302` to a real website. The filtering logic is derived directly from the C2 framework's traffic profile, so the two must stay in lock-step. Tools such as `cs2modrewrite` automate generating Apache\u002Fnginx rules from a Cobalt Strike Malleable C2 profile.\n\nThis skill covers building both dumb and filtering redirectors with nginx and Apache, deriving filter rules from a malleable profile, layering TLS with Let's Encrypt, and applying OPSEC controls (categorized domains, domain fronting\u002FCDN fronting, header validation, geo\u002FUA filtering) for resilient, low-attribution infrastructure.\n\n## When to Use\n\n- Standing up red-team C2 that must survive blue-team triage and domain takedown requests.\n- Separating a hidden team server from any internet-facing host during an engagement.\n- Filtering implant traffic so only profile-matching requests reach the backend, diverting scanners.\n- Adding TLS termination, domain categorization, and CDN\u002Fdomain fronting to an HTTP(S) listener.\n- Teaching defenders how external-proxy C2 (T1090.002) is constructed so they can detect it.\n\n## Prerequisites\n\n- One or more disposable cloud VPS instances (the redirector edge) and a separate, firewalled team-server host.\n- A registered domain with controllable DNS, ideally aged\u002Fcategorized.\n- Root on the redirector host. Install the web server and TLS tooling:\n  ```bash\n  # Debian\u002FUbuntu redirector\n  sudo apt update\n  sudo apt install -y nginx apache2 socat certbot python3-certbot-nginx git\n  # Enable Apache proxy modules if using mod_rewrite redirector\n  sudo a2enmod rewrite proxy proxy_http ssl headers\n  ```\n- The C2 framework's Malleable C2 profile (Cobalt Strike `.profile`, Sliver\u002FHavoc HTTP profile) defining URIs, User-Agent, and headers.\n- `cs2modrewrite` to auto-generate rules from a Cobalt Strike profile:\n  ```bash\n  git clone https:\u002F\u002Fgithub.com\u002Fthreatexpress\u002Fcs2modrewrite\n  ```\n- Firewall the team server so it only accepts the redirector's source IP on the C2 port.\n\n## Objectives\n\n- Deploy a dumb-pipe redirector (socat\u002Fiptables) for fast port separation.\n- Deploy a filtering nginx reverse-proxy redirector keyed to a malleable profile.\n- Deploy an Apache `mod_rewrite` redirector with `[P]` proxying and `302` decoy fallback.\n- Auto-generate redirector rules from a Cobalt Strike profile with `cs2modrewrite`.\n- Terminate TLS with Let's Encrypt and harden the public edge.\n- Apply OPSEC: header\u002FUA validation, geo filtering, decoy diversion, and infra rotation.\n\n## MITRE ATT&CK Mapping\n\n| Technique ID | Official Name | Relevance |\n|--------------|---------------|-----------|\n| T1090.002 | Proxy: External Proxy | The redirector is an external intermediary that proxies C2 to hide the team server |\n| T1090.004 | Proxy: Domain Fronting | CDN fronting routes beacon traffic through a trusted high-reputation domain |\n| T1071.001 | Application Layer Protocol: Web Protocols | C2 is tunneled over HTTP\u002FHTTPS shaped by the malleable profile |\n| T1573.002 | Encrypted Channel: Asymmetric Cryptography | TLS termination at the redirector encrypts the beacon channel |\n| T1583.006 | Acquire Infrastructure: Web Services | Disposable VPS\u002FCDN edges are acquired for resilient C2 |\n\n## Workflow\n\n### 1. Lab and firewall the team server\nPlace the team server on a private host. Restrict its C2 port to the redirector's IP only.\n```bash\n# On the team server: only the redirector (203.0.113.10) may reach 443\u002Ftcp\nsudo ufw default deny incoming\nsudo ufw allow from 203.0.113.10 to any port 443 proto tcp\nsudo ufw allow OpenSSH\nsudo ufw enable\n```\n\n### 2. Dumb-pipe redirector (socat \u002F iptables)\nFor quick separation with no filtering, forward the C2 port to the team server.\n```bash\n# socat foreground forward of 443 -> team server\nsocat TCP4-LISTEN:443,fork,reuseaddr TCP4:10.0.0.2:443\n\n# Or iptables DNAT (persistent)\nsysctl -w net.ipv4.ip_forward=1\niptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.0.0.2:443\niptables -t nat -A POSTROUTING -p tcp -d 10.0.0.2 --dport 443 -j MASQUERADE\n```\n\n### 3. Filtering nginx reverse-proxy redirector\nOnly proxy requests whose URI matches the malleable profile; send everything else a `302` to a decoy. Replace the location regex and User-Agent with values from your profile.\n```nginx\n# \u002Fetc\u002Fnginx\u002Fsites-available\u002Fredirector.conf\nserver {\n    listen 443 ssl;\n    server_name cdn.example.com;\n\n    ssl_certificate     \u002Fetc\u002Fletsencrypt\u002Flive\u002Fcdn.example.com\u002Ffullchain.pem;\n    ssl_certificate_key \u002Fetc\u002Fletsencrypt\u002Flive\u002Fcdn.example.com\u002Fprivkey.pem;\n\n    # Proxy ONLY profile-matching C2 URIs to the hidden team server\n    location ~ ^\u002F(api\u002Fv2\u002Fjobs|cm\u002F[a-z0-9]+|push) {\n        # Require the implant's exact User-Agent\n        if ($http_user_agent != \"Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36\") {\n            return 302 https:\u002F\u002Fwww.legitimate-decoy.com\u002F;\n        }\n        proxy_pass https:\u002F\u002F10.0.0.2;\n        proxy_ssl_verify off;\n        proxy_set_header Host $host;\n        proxy_set_header X-Forwarded-For $remote_addr;\n    }\n\n    # Everything else -> benign decoy\n    location \u002F {\n        return 302 https:\u002F\u002Fwww.legitimate-decoy.com\u002F;\n    }\n}\n```\n```bash\nsudo ln -s \u002Fetc\u002Fnginx\u002Fsites-available\u002Fredirector.conf \u002Fetc\u002Fnginx\u002Fsites-enabled\u002F\nsudo nginx -t && sudo systemctl reload nginx\n```\n\n### 4. Apache mod_rewrite redirector\nApache's `[P]` flag proxies matching requests to the team server; non-matches get a `302` redirect. This is the format `cs2modrewrite` produces.\n```apache\n# \u002Fetc\u002Fapache2\u002Fsites-available\u002Fredirector.conf  (inside \u003CVirtualHost *:443>)\nRewriteEngine On\nSSLProxyEngine On\n# Require the implant User-Agent\nRewriteCond %{HTTP_USER_AGENT} \"Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36\" [NC]\n# Match valid C2 URIs (GET\u002FPOST\u002Fstager) from the malleable profile\nRewriteCond %{REQUEST_URI} ^\u002F(api\u002Fv2\u002Fjobs|cm\u002F[a-z0-9]+|push)\u002F?$\n# Proxy to the hidden team server, preserving the URI\nRewriteRule ^.*$ https:\u002F\u002F10.0.0.2%{REQUEST_URI} [P,L]\n# Everything else -> decoy site\nRewriteRule ^.*$ https:\u002F\u002Fwww.legitimate-decoy.com\u002F [R=302,L]\n```\n```bash\nsudo a2ensite redirector && sudo apache2ctl configtest && sudo systemctl reload apache2\n```\n\n### 5. Generate rules from a malleable profile\nLet `cs2modrewrite` build the Apache or nginx rules directly from your Cobalt Strike profile so the filter exactly matches beacon traffic.\n```bash\ncd cs2modrewrite\n# Apache mod_rewrite rules\npython3 cs2modrewrite.py -i havex.profile -c https:\u002F\u002F10.0.0.2 \\\n  -r https:\u002F\u002Fwww.legitimate-decoy.com -o \u002Fetc\u002Fapache2\u002Fredirect.rules\n# nginx config\npython3 cs2nginx.py -i havex.profile -c https:\u002F\u002F10.0.0.2 \\\n  -r https:\u002F\u002Fwww.legitimate-decoy.com -H cdn.example.com > \u002Fetc\u002Fnginx\u002Fsites-available\u002Fc2.conf\n```\n\n### 6. Terminate TLS with Let's Encrypt\nIssue a valid certificate so beacon HTTPS does not throw TLS warnings and the edge looks legitimate.\n```bash\nsudo certbot --nginx -d cdn.example.com --agree-tos -m ops@example.com --redirect\n# Verify auto-renewal\nsudo certbot renew --dry-run\n```\n\n### 7. Apply OPSEC controls\nLayer defenses against blue-team analysis: validate headers, geofence to the target country, divert sandboxes, and rotate edges. Consider CDN\u002Fdomain fronting (T1090.004) where supported.\n```bash\n# Example: drop non-target geographies at the firewall with ipset\u002FGeoIP,\n# require a custom auth header in the profile, and rotate the redirector\n# domain\u002FIP on a schedule. Check the redirector only forwards matched traffic:\ncurl -k https:\u002F\u002Fcdn.example.com\u002F                       # expect 302 to decoy\ncurl -k -A \"Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36\" \\\n  https:\u002F\u002Fcdn.example.com\u002Fapi\u002Fv2\u002Fjobs                  # expect proxied response\n```\n\n## Tools and Resources\n\n| Tool | Purpose | Source |\n|------|---------|--------|\n| nginx | Filtering reverse-proxy redirector | https:\u002F\u002Fnginx.org\u002F |\n| Apache mod_rewrite | `[P]` proxy + `302` decoy redirector | https:\u002F\u002Fhttpd.apache.org\u002Fdocs\u002Fcurrent\u002Fmod\u002Fmod_rewrite.html |\n| cs2modrewrite | Generate Apache\u002Fnginx rules from CS profile | https:\u002F\u002Fgithub.com\u002Fthreatexpress\u002Fcs2modrewrite |\n| RedWarden | Malleable-aware filtering C2 reverse proxy | https:\u002F\u002Fgithub.com\u002Fmgeeky\u002FRedWarden |\n| redi | Automated nginx + Let's Encrypt CS redirector | https:\u002F\u002Fgithub.com\u002Ftaherio\u002Fredi |\n| socat | Dumb-pipe TCP forwarder | http:\u002F\u002Fwww.dest-unreach.org\u002Fsocat\u002F |\n| Let's Encrypt \u002F certbot | Free TLS certificates | https:\u002F\u002Fcertbot.eff.org\u002F |\n| ired.team | Red-team infrastructure reference | https:\u002F\u002Fwww.ired.team\u002Foffensive-security\u002Fred-team-infrastructure |\n\n## Validation Criteria\n\n- [ ] Team server firewalled to accept only the redirector source IP on the C2 port.\n- [ ] Redirector deployed (dumb pipe and\u002For filtering reverse proxy).\n- [ ] Filter rules derived from the actual malleable C2 profile (URI + User-Agent + headers).\n- [ ] Non-matching requests return a `302` to a benign decoy site (verified with curl).\n- [ ] Matching beacon requests are proxied to the hidden team server (verified with curl).\n- [ ] Valid TLS certificate issued and auto-renewal confirmed.\n- [ ] OPSEC controls applied (UA\u002Fheader validation, geofencing, decoy diversion).\n- [ ] Domain categorization \u002F CDN fronting considered where applicable.\n- [ ] Infrastructure rotation and decommissioning plan documented.\n- [ ] All activity confined to the authorized engagement scope.\n",{"name":5,"tags":24,"author":33,"domain":34,"license":15,"version":35,"nist_csf":36,"subdomain":38,"description":7,"mitre_attack":39},[25,26,27,28,29,30,31,32],"red-team","c2-infrastructure","redirector","nginx","apache-mod-rewrite","malleable-c2","opsec","traffic-filtering","mahipal","cybersecurity","1.0",[37],"DE.CM-01","red-teaming",[40],"T1090.002","main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","04-安全渗透\u002Fbuilding-c2-redirector-infrastructure",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill building-c2-redirector-infrastructure",{"tool":55,"command":56},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill building-c2-redirector-infrastructure",{"tool":58,"command":59},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill building-c2-redirector-infrastructure","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Fbuilding-c2-redirector-infrastructure\u002FSKILL.md",true,[63,69],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fapi-reference.md","REFERENCE","参考文档",2195,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Fbuilding-c2-redirector-infrastructure\u002Freferences\u002Fapi-reference.md",{"path":70,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fstandards.md",1819,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Fbuilding-c2-redirector-infrastructure\u002Freferences\u002Fstandards.md",[74,83,88,95,102,109],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":82},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":84,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":82},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":82},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":82},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":82},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":82},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]