From 7562e3dc44511de2610244426eb0c3dbcd8fb1cc Mon Sep 17 00:00:00 2001 From: n0mad1k Date: Fri, 11 Apr 2025 21:10:35 -0400 Subject: [PATCH] fingers crossed --- {tasks/files => files}/clean-logs.sh | 0 {tasks/files => files}/persistent-listener.sh | 0 {tasks/files => files}/rubber-ducky.txt | 0 {tasks/files => files}/secure-exit.sh | 0 {tasks/files => files}/serve-beacons.sh | 0 tasks/configure_redirector.yml | 8 +- .../templates => templates}/default-site.j2 | 0 .../templates => templates}/gophish-config.j2 | 0 {tasks/templates => templates}/index.html.j2 | 0 {tasks/templates => templates}/motd-aws.j2 | 0 {tasks/templates => templates}/motd-linode.j2 | 0 {tasks/templates => templates}/nginx.conf.j2 | 3 +- .../proxychains.conf.j2 | 0 templates/redirector-index.html.j2 | 122 ++++++++++++++++++ templates/redirector-site.conf.j2 | 80 ++++++++++++ {tasks/templates => templates}/resolv.conf.j2 | 0 .../templates => templates}/secure-ssh.sh.j2 | 0 .../shell-handler.service.j2 | 2 +- .../sliver-server.service.j2 | 0 {tasks/templates => templates}/torrc.j2 | 0 20 files changed, 208 insertions(+), 7 deletions(-) rename {tasks/files => files}/clean-logs.sh (100%) rename {tasks/files => files}/persistent-listener.sh (100%) rename {tasks/files => files}/rubber-ducky.txt (100%) rename {tasks/files => files}/secure-exit.sh (100%) rename {tasks/files => files}/serve-beacons.sh (100%) rename {tasks/templates => templates}/default-site.j2 (100%) rename {tasks/templates => templates}/gophish-config.j2 (100%) rename {tasks/templates => templates}/index.html.j2 (100%) rename {tasks/templates => templates}/motd-aws.j2 (100%) rename {tasks/templates => templates}/motd-linode.j2 (100%) rename {tasks/templates => templates}/nginx.conf.j2 (96%) rename {tasks/templates => templates}/proxychains.conf.j2 (100%) create mode 100644 templates/redirector-index.html.j2 create mode 100644 templates/redirector-site.conf.j2 rename {tasks/templates => templates}/resolv.conf.j2 (100%) rename {tasks/templates => templates}/secure-ssh.sh.j2 (100%) rename {tasks/templates => templates}/shell-handler.service.j2 (94%) rename {tasks/templates => templates}/sliver-server.service.j2 (100%) rename {tasks/templates => templates}/torrc.j2 (100%) diff --git a/tasks/files/clean-logs.sh b/files/clean-logs.sh similarity index 100% rename from tasks/files/clean-logs.sh rename to files/clean-logs.sh diff --git a/tasks/files/persistent-listener.sh b/files/persistent-listener.sh similarity index 100% rename from tasks/files/persistent-listener.sh rename to files/persistent-listener.sh diff --git a/tasks/files/rubber-ducky.txt b/files/rubber-ducky.txt similarity index 100% rename from tasks/files/rubber-ducky.txt rename to files/rubber-ducky.txt diff --git a/tasks/files/secure-exit.sh b/files/secure-exit.sh similarity index 100% rename from tasks/files/secure-exit.sh rename to files/secure-exit.sh diff --git a/tasks/files/serve-beacons.sh b/files/serve-beacons.sh similarity index 100% rename from tasks/files/serve-beacons.sh rename to files/serve-beacons.sh diff --git a/tasks/configure_redirector.yml b/tasks/configure_redirector.yml index fd5d365..3fdec53 100644 --- a/tasks/configure_redirector.yml +++ b/tasks/configure_redirector.yml @@ -55,7 +55,7 @@ - name: Create shell handler service template: - src: "shell-handler.service.j2" + src: "../templates/shell-handler.service.j2" dest: /etc/systemd/system/shell-handler.service mode: '0644' owner: root @@ -63,7 +63,7 @@ - name: Configure NGINX for zero-logging if enabled template: - src: "nginx.conf.j2" + src: "../templates/nginx.conf.j2" dest: /etc/nginx/nginx.conf mode: '0644' owner: root @@ -72,7 +72,7 @@ - name: Configure NGINX for C2 redirection template: - src: "redirector-site.conf.j2" + src: "../templates/redirector-site.conf.j2" dest: /etc/nginx/sites-available/default mode: '0644' owner: root @@ -80,7 +80,7 @@ - name: Create legitimate-looking index.html template: - src: "redirector-index.html.j2" + src: "../templates/redirector-index.html.j2" dest: /var/www/html/index.html mode: '0644' owner: www-data diff --git a/tasks/templates/default-site.j2 b/templates/default-site.j2 similarity index 100% rename from tasks/templates/default-site.j2 rename to templates/default-site.j2 diff --git a/tasks/templates/gophish-config.j2 b/templates/gophish-config.j2 similarity index 100% rename from tasks/templates/gophish-config.j2 rename to templates/gophish-config.j2 diff --git a/tasks/templates/index.html.j2 b/templates/index.html.j2 similarity index 100% rename from tasks/templates/index.html.j2 rename to templates/index.html.j2 diff --git a/tasks/templates/motd-aws.j2 b/templates/motd-aws.j2 similarity index 100% rename from tasks/templates/motd-aws.j2 rename to templates/motd-aws.j2 diff --git a/tasks/templates/motd-linode.j2 b/templates/motd-linode.j2 similarity index 100% rename from tasks/templates/motd-linode.j2 rename to templates/motd-linode.j2 diff --git a/tasks/templates/nginx.conf.j2 b/templates/nginx.conf.j2 similarity index 96% rename from tasks/templates/nginx.conf.j2 rename to templates/nginx.conf.j2 index 8a6c327..bf16f8f 100644 --- a/tasks/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -37,7 +37,6 @@ http { # Headers to confuse fingerprinting # Microsoft-IIS/8.5 server header to throw off analysis - #more_set_headers 'Server: Microsoft-IIS/8.5'; add_header Server "Microsoft-IIS/8.5"; server_name_in_redirect off; @@ -56,4 +55,4 @@ http { # Virtual Host Configs include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; -} \ No newline at end of file +} diff --git a/tasks/templates/proxychains.conf.j2 b/templates/proxychains.conf.j2 similarity index 100% rename from tasks/templates/proxychains.conf.j2 rename to templates/proxychains.conf.j2 diff --git a/templates/redirector-index.html.j2 b/templates/redirector-index.html.j2 new file mode 100644 index 0000000..00910cf --- /dev/null +++ b/templates/redirector-index.html.j2 @@ -0,0 +1,122 @@ + + + + + + {{ redirector_subdomain }} - Content Delivery Network + + + +
+

{{ redirector_subdomain }}.{{ domain }}

+

Enterprise Content Delivery Network

+
+ +
+
+

Welcome to Our CDN

+

This server is part of our global content delivery network, optimizing digital asset delivery for enterprise applications. Our CDN provides fast, reliable, and secure content distribution across our global network.

+

This is a private service. Unauthorized access is prohibited.

+
+ +
+

Our Features

+ +
+
1
+
+

Global Distribution

+

Content cached and distributed across multiple geographic locations for minimum latency.

+
+
+ +
+
2
+
+

DDoS Protection

+

Enterprise-grade protection against distributed denial of service attacks.

+
+
+ +
+
3
+
+

Asset Optimization

+

Automatic compression and format optimization for images, scripts, and styles.

+
+
+
+ +
+

Need Access?

+

If you're a client requiring access to our CDN services, please contact your account representative.

+ Contact Sales +
+
+ + + + diff --git a/templates/redirector-site.conf.j2 b/templates/redirector-site.conf.j2 new file mode 100644 index 0000000..b325d90 --- /dev/null +++ b/templates/redirector-site.conf.j2 @@ -0,0 +1,80 @@ +server { + listen 80; + listen [::]:80; + server_name {{ redirector_subdomain }}.{{ domain }}; + + # Redirect to HTTPS + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl; + listen [::]:443 ssl; + server_name {{ redirector_subdomain }}.{{ domain }}; + + # SSL Configuration + ssl_certificate /etc/letsencrypt/live/{{ redirector_subdomain }}.{{ domain }}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/{{ redirector_subdomain }}.{{ domain }}/privkey.pem; + + # Root directory + root /var/www/html; + index index.html; + + # Primary location for legitimate website traffic + location / { + try_files $uri $uri/ =404; + } + + # Special URI patterns for C2 traffic + # These will redirect to the actual C2 server + + # Sliver HTTP C2 channel + location /ajax/ { + proxy_pass http://{{ c2_ip }}:8888; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + + # Static resources that actually redirect to C2 + location ~ ^/static/(css|js|images)/.*\.(css|js|png|jpg|jpeg|gif|ico)$ { + proxy_pass http://{{ c2_ip }}:8888; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + } + + # Additional security headers + add_header X-Content-Type-Options "nosniff" always; + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header Referrer-Policy "no-referrer" always; + add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:;" always; + + # Disable logging for this server block + access_log off; + error_log /dev/null crit; +} + +# Catch-all server block to respond to unknown hosts +server { + listen 80 default_server; + listen [::]:80 default_server; + listen 443 ssl default_server; + listen [::]:443 ssl default_server; + + # Self-signed cert for catch-all + ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; + ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; + + # Redirect all unknown traffic to a legitimate-looking site + return 301 https://www.google.com; + + # Disable logs + access_log off; + error_log /dev/null crit; +} diff --git a/tasks/templates/resolv.conf.j2 b/templates/resolv.conf.j2 similarity index 100% rename from tasks/templates/resolv.conf.j2 rename to templates/resolv.conf.j2 diff --git a/tasks/templates/secure-ssh.sh.j2 b/templates/secure-ssh.sh.j2 similarity index 100% rename from tasks/templates/secure-ssh.sh.j2 rename to templates/secure-ssh.sh.j2 diff --git a/tasks/templates/shell-handler.service.j2 b/templates/shell-handler.service.j2 similarity index 94% rename from tasks/templates/shell-handler.service.j2 rename to templates/shell-handler.service.j2 index a5c048c..15be079 100644 --- a/tasks/templates/shell-handler.service.j2 +++ b/templates/shell-handler.service.j2 @@ -24,4 +24,4 @@ Environment="C2_HOST={{ c2_ip }}" Environment="LISTEN_PORT={{ shell_handler_port }}" [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/tasks/templates/sliver-server.service.j2 b/templates/sliver-server.service.j2 similarity index 100% rename from tasks/templates/sliver-server.service.j2 rename to templates/sliver-server.service.j2 diff --git a/tasks/templates/torrc.j2 b/templates/torrc.j2 similarity index 100% rename from tasks/templates/torrc.j2 rename to templates/torrc.j2