{"id":3759,"date":"2024-12-25T14:03:49","date_gmt":"2024-12-25T13:03:49","guid":{"rendered":"https:\/\/hardsoftsecurity.es\/?p=3759"},"modified":"2025-01-16T17:50:32","modified_gmt":"2025-01-16T16:50:32","slug":"deploying-secure-red-team-infrastructure","status":"publish","type":"post","link":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/","title":{"rendered":"Deploying Secure Red Team Infrastructure"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Welcome to a new post, where we are going to see how to deploy a secure Red Team infrastructure. We will se how to deploy legit services to perform phishing and hide our C2 traffic through HTTPS protocol.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"800\" height=\"411\" data-attachment-id=\"3764\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/redteam-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?fit=1467%2C754&amp;ssl=1\" data-orig-size=\"1467,754\" data-comments-opened=\"1\" data-image-title=\"redteam\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?fit=800%2C411&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?resize=800%2C411&#038;ssl=1\" alt=\"\" class=\"wp-image-3764\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?w=1467&amp;ssl=1 1467w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?resize=300%2C154&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?resize=768%2C395&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Disclaimer<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">The information provided in this post is intended for educational purposes only. The techniques, tools, and methodologies discussed are designed to help cybersecurity professionals and enthusiasts understand how to deploy a red team infrastructure in a controlled and lawful environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By accessing this content, you agree to use the information responsibly and only in environments where you have explicit authorization to perform testing or simulations. Unauthorized use of these techniques on systems without proper consent may violate local, national, or international laws, and such actions could lead to severe legal consequences.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Neither the author nor this post assumes any responsibility or liability for misuse of the information provided. Always prioritize ethical practices, respect for privacy, and compliance with applicable laws and regulations.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">1. Initial information<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The creation of this infrastructure has been done with Digital Ocean (the creation of the servers are not covered on this post). I\u2019ve created 4 VPS servers that have different purposes:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"800\" height=\"168\" data-attachment-id=\"3766\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-91\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-15.png?fit=1231%2C258&amp;ssl=1\" data-orig-size=\"1231,258\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-15.png?fit=800%2C168&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-15.png?resize=800%2C168&#038;ssl=1\" alt=\"\" class=\"wp-image-3766\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-15.png?w=1231&amp;ssl=1 1231w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-15.png?resize=300%2C63&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-15.png?resize=768%2C161&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">1.1 Summary of the infrastructure<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Since I want to learn how to deploy a fully operational red team infrastructure, I will deploy the following servers:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>Function<\/strong><\/th><th><strong>Minimal Setup<\/strong><\/th><\/tr><\/thead><tbody><tr><td>C2 Server (Havoc)<\/td><td>1 VPS<\/td><\/tr><tr><td>Phishing Server\/payloads<\/td><td>1 VPS<\/td><\/tr><tr><td>Redirector for C2<\/td><td>1 VPS<\/td><\/tr><tr><td>Redirector for Phishing\/payloads<\/td><td>1 VPS<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The perfect scenario would be 6 even 8. Something like this:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>Function<\/strong><\/th><th><strong>Minimal Setup<\/strong><\/th><\/tr><\/thead><tbody><tr><td>C2 Server (Havoc)<\/td><td>1 VPS<\/td><\/tr><tr><td>Phishing Server<\/td><td>1 VPS<\/td><\/tr><tr><td>Payload Server<\/td><td>1 VPS<\/td><\/tr><tr><td>Long term C2 Server<\/td><td>1 VPS<\/td><\/tr><tr><td>Redirector for C2<\/td><td>1 VPS<\/td><\/tr><tr><td>Redirector for Phishing\/payloads<\/td><td>1 VPS<\/td><\/tr><tr><td>Redirector for Payload Server<\/td><td>1 VPS<\/td><\/tr><tr><td>Redirector for long term C2 Server<\/td><td>1 VPS<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">1.2 Detailed infrastructure information<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The physical requirements are the following:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-center\" data-align=\"center\"><strong>Name<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Role<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\">IP<\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>CPU<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>RAM<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Storage<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>OS<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Notes<\/strong><\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\">c2 server<\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>C2 Server<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\">x<\/td><td class=\"has-text-align-center\" data-align=\"center\">2 vCPUs<\/td><td class=\"has-text-align-center\" data-align=\"center\">2 GB<\/td><td class=\"has-text-align-center\" data-align=\"center\">20-40 GB<\/td><td class=\"has-text-align-center\" data-align=\"center\">Ubuntu 22.04 LTS<\/td><td class=\"has-text-align-center\" data-align=\"center\">Upgrade to 4 vCPUs\/4 GB RAM for &gt;50 targets.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">phishing server<\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Phishing Server<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\">x<\/td><td class=\"has-text-align-center\" data-align=\"center\">1 vCPU<\/td><td class=\"has-text-align-center\" data-align=\"center\">1 GB<\/td><td class=\"has-text-align-center\" data-align=\"center\">25 GB<\/td><td class=\"has-text-align-center\" data-align=\"center\">Ubuntu 22.04 LTS<\/td><td class=\"has-text-align-center\" data-align=\"center\">CDN recommended for large file payloads.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Redirector for C2<\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Redirector for C2<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\">x<\/td><td class=\"has-text-align-center\" data-align=\"center\">1 vCPU<\/td><td class=\"has-text-align-center\" data-align=\"center\">1 GB<\/td><td class=\"has-text-align-center\" data-align=\"center\">25 GB<\/td><td class=\"has-text-align-center\" data-align=\"center\">Ubuntu 22.04 LTS<\/td><td class=\"has-text-align-center\" data-align=\"center\">High-speed network connection is critical.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Redirector for phishing<\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Redirector for phishing<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\">x<\/td><td class=\"has-text-align-center\" data-align=\"center\">1 vCPU<\/td><td class=\"has-text-align-center\" data-align=\"center\">1 GB<\/td><td class=\"has-text-align-center\" data-align=\"center\">25 GB<\/td><td class=\"has-text-align-center\" data-align=\"center\">Ubuntu 22.04 LTS<\/td><td class=\"has-text-align-center\" data-align=\"center\">High-speed network connection is critical.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">1.3 Selection of domain<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For this part I will recommend you at least 2 domains one for the phishing phase and the other one for the C2 traffic:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Domain<\/th><th>Provider<\/th><\/tr><\/thead><tbody><tr><td>soft.example.com<\/td><td>Your preference<\/td><\/tr><tr><td>mail.example.com<\/td><td>Your preference<\/td><\/tr><tr><td>health.c2traffic.com<\/td><td>Your preference<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">1.4 Final red team infrastructure<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The final diagram about what we are going to have:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"800\" height=\"484\" data-attachment-id=\"3765\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-90\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-14.png?fit=1219%2C738&amp;ssl=1\" data-orig-size=\"1219,738\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-14.png?fit=800%2C484&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-14.png?resize=800%2C484&#038;ssl=1\" alt=\"\" class=\"wp-image-3765\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-14.png?w=1219&amp;ssl=1 1219w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-14.png?resize=300%2C182&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-14.png?resize=768%2C465&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">2. Initial set up for the servers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">2.1 Update the servers<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Initial update after the installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt -y install update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>apt -y upgrade<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.2 Installation of Havoc into the C2 Server &#8211; VPS1<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For the people that does not know what is Havoc C2, you can find great information on Havoc&#8217;s <a href=\"https:\/\/github.com\/HavocFramework\/Havoc\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">github<\/a> or from the Havoc&#8217;s <a href=\"https:\/\/havocframework.com\/docs\/welcome\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">documentation<\/a>.  Also, I recommend the blog of my buddy <a href=\"https:\/\/leosmith.wtf\/blog\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">&#8220;P4P1&#8221;<\/a>, where he has very good reviews and walk-through posts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first step before installing havoc is establish a good firewall rules.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2.2.1 Firewall configuration<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The default policy it will be drop. We will configure our firewall to be sure that we just accept the traffic that we want:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\n# Flush existing rules\niptables -F\niptables -X\n\n# Default policy: DROP\niptables -P INPUT DROP\niptables -P FORWARD DROP\niptables -P OUTPUT DROP\n\n# Allow loopback traffic\niptables -A INPUT -i lo -j ACCEPT\niptables -A OUTPUT -o lo -j ACCEPT\n\n# Allow outbound DNS (UDP and TCP to port 53)\niptables -A OUTPUT -p udp --dport 53 -j ACCEPT\niptables -A OUTPUT -p tcp --dport 53 -j ACCEPT\niptables -A INPUT -p udp --sport 53 -j ACCEPT\niptables -A INPUT -p tcp --sport 53 -j ACCEPT\n\n# Allow outbound HTTP and HTTPS\niptables -A OUTPUT -p tcp --dport 80 -j ACCEPT\niptables -A OUTPUT -p tcp --dport 443 -j ACCEPT\niptables -A INPUT -p tcp --sport 80 -j ACCEPT\niptables -A INPUT -p tcp --sport 443 -j ACCEPT\n\n# Allow ICMP outbound (ping)\niptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT\niptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT\n\n# Allow SSH\niptables -A INPUT -p tcp --dport 22 -j ACCEPT\niptables -A OUTPUT -p tcp --sport 22 -j ACCEPT\n\n# Incoming\n\n# Allow ICMP incoming (ping)\niptables -A INPUT -p icmp -s &lt;ip-redirector-server&gt; -j ACCEPT\niptables -A OUTPUT -p icmp -d &lt;ip-redirector-server&gt; -j ACCEPT\n\n# Allow incoming HTTPS traffic\niptables -A INPUT -p tcp --dport 443 -s &lt;ip-redirector-server&gt; -j ACCEPT\n\n# Allow related and established connections\niptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\niptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n\n# Save rules\niptables-save &gt; \/etc\/iptables\/rules.v4\niptables-restore &lt; \/etc\/iptables\/rules.v4\nnetfilter-persistent save<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">2.2.2 Havoc Installation<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Install requirements:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y git build-essential apt-utils cmake libfontconfig1 libglu1-mesa-dev libgtest-dev libspdlog-dev libboost-all-dev libncurses5-dev libgdbm-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev libbz2-dev mesa-common-dev qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5websockets5 libqt5websockets5-dev qtdeclarative5-dev golang-go qtbase5-dev libqt5websockets5-dev python3-dev libboost-all-dev mingw-w64 nasm<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Update go:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get update\nwget &lt;https:\/\/go.dev\/dl\/go1.21.0.linux-amd64.tar.gz&gt;\ntar -xvf go1.21.0.linux-amd64.tar.gz\nmv go \/usr\/local\nexport GOROOT=\/usr\/local\/go\nexport GOPATH=$HOME\/go\nexport PATH=$GOPATH\/bin:$GOROOT\/bin:$PATH\nsource ~\/.profile<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Clone the repository:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/HavocFramework\/Havoc.git<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install go dependencies:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd Havoc\/teamserver\ngo mod download golang.org\/x\/sys\ngo mod download github.com\/ugorji\/go<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Fom root directory of havoc compile the server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make ts-build<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Execute the server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/havoc server --profile .\/profiles\/havoc.yaotl -v --debug &amp;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expose Havoc port locally through SSH tunnel:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -N -L 0.0.0.0:40056:127.0.0.1:40056 root@167.71.14.172<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Connect with havoc client:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/havoc client<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"289\" data-attachment-id=\"3767\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-92\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-16.png?fit=502%2C289&amp;ssl=1\" data-orig-size=\"502,289\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-16.png?fit=502%2C289&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-16.png?resize=502%2C289&#038;ssl=1\" alt=\"\" class=\"wp-image-3767\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-16.png?w=502&amp;ssl=1 502w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-16.png?resize=300%2C173&amp;ssl=1 300w\" sizes=\"(max-width: 502px) 100vw, 502px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">2.3 Installation of GoPhish for phishing &#8211; VPS2<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">I decided to install GoPhish because is very simple to use with a friendly user interface. If you want to know more about it, you can check information on GoPhish&#8217;s <a href=\"https:\/\/github.com\/gophish\/gophish\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">github<\/a> or on GoPhish&#8217;s <a href=\"https:\/\/getgophish.com\/documentation\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">documentation<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2.3.1 Firewall rules<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">As we did with the C2 Server, we will deploy a strict firewall rules:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\n# Flush existing rules\niptables -F\niptables -X\n\n# Default policy: DROP\niptables -P INPUT DROP\niptables -P FORWARD DROP\niptables -P OUTPUT DROP\n\n# Enable log\n#iptables -A INPUT -j LOG --log-prefix \"IPTables-Dropped: \" --log-level 4\n\n# Allow loopback traffic\niptables -A INPUT -i lo -j ACCEPT\niptables -A OUTPUT -o lo -j ACCEPT\n\n# Allow outbound DNS (UDP and TCP to port 53)\niptables -A OUTPUT -p udp --dport 53 -j ACCEPT\niptables -A OUTPUT -p tcp --dport 53 -j ACCEPT\niptables -A INPUT -p udp --sport 53 -j ACCEPT\niptables -A INPUT -p tcp --sport 53 -j ACCEPT\n\n# Allow outbound HTTP and HTTPS\niptables -A OUTPUT -p tcp --dport 80 -j ACCEPT\niptables -A OUTPUT -p tcp --dport 443 -j ACCEPT\niptables -A INPUT -p tcp --sport 80 -j ACCEPT\niptables -A INPUT -p tcp --sport 443 -j ACCEPT\n\n# Allow ICMP outbound (ping)\niptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT\niptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT\n\n# Allow outbound SMTP on port 465 (SMTP over SSL)\niptables -A OUTPUT -p tcp --dport 465 -j ACCEPT\niptables -A INPUT -p tcp --sport 465 -j ACCEPT\n\n# Allow SSH\niptables -A INPUT -p tcp --dport 22 -j ACCEPT\niptables -A OUTPUT -p tcp --sport 22 -j ACCEPT\n\n# Incoming\n\n# Allow incoming HTTP traffic\niptables -A INPUT -p tcp --dport 80 -s &lt;phishing-redirector-ip&gt; -j ACCEPT\n\n# Allow related and established connections\niptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\niptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n\n# Save rules\niptables-save &gt; \/etc\/iptables\/rules.v4\niptables-restore &lt; \/etc\/iptables\/rules.v4\nnetfilter-persistent save<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">2.3.2 SMTP Inbox account creation in our provider<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The first thing we will do is creating some email accounts into the provider where we bought out domains. We are gonna use the provider&#8217;s email servers to send the email doing the authentication with that user:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"224\" data-attachment-id=\"3768\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-93\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-17.png?fit=1707%2C478&amp;ssl=1\" data-orig-size=\"1707,478\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-17.png?fit=800%2C224&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-17.png?resize=800%2C224&#038;ssl=1\" alt=\"\" class=\"wp-image-3768\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-17.png?w=1707&amp;ssl=1 1707w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-17.png?resize=300%2C84&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-17.png?resize=768%2C215&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-17.png?resize=1536%2C430&amp;ssl=1 1536w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-17.png?w=1600&amp;ssl=1 1600w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">2.3.3 Installation of GoPhish<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To be able to install GoPhish we will need to install in the server golang-go:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt -y install golang-go<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Download GoPhish:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget &lt;https:\/\/github.com\/gophish\/gophish\/releases\/download\/v0.12.1\/gophish-v0.12.1-linux-64bit.zip&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create GoPhish directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir GoPish<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Unzip GoPhish inside the directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unzip gophish-v0.12.1-linux-64bit.zip<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inside of GoPhish add executable rights to the binary gopish:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x gophish<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"457\" data-attachment-id=\"3769\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-94\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-18.png?fit=1053%2C601&amp;ssl=1\" data-orig-size=\"1053,601\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-18.png?fit=800%2C457&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-18.png?resize=800%2C457&#038;ssl=1\" alt=\"\" class=\"wp-image-3769\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-18.png?w=1053&amp;ssl=1 1053w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-18.png?resize=300%2C171&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-18.png?resize=768%2C438&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Since, GoPhish runs as script, we will need to create it as service to be able to run it as a service. First, we will create the following folder:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir \/var\/log\/gophish<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create the following script inside \/etc\/systemd\/system\/gophish.service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Unit]\nDescription=GoPhish Service\nAfter=network.target\n\n&#91;Service]\nExecStart=\/root\/GoPhish\/gophish\nType=simple\nUser=root\nWorkingDirectory=\/root\/GoPhish\nRestart=always\nPIDFile=\/var\/run\/gophish.pid\n\n&#91;Install]\nWantedBy=multi-user.target<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make it executable:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x gophish<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Reload systemd:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl daemon-reload<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the script in the system:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable gophish<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start the service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start gophish<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create the tunnel to be able to access the platform:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -N -L 0.0.0.0:3333:127.0.0.1:3333 root@134.122.121.230<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Get access with the credentials configured:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"569\" data-attachment-id=\"3770\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-95\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-19.png?fit=906%2C644&amp;ssl=1\" data-orig-size=\"906,644\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-19.png?fit=800%2C569&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-19.png?resize=800%2C569&#038;ssl=1\" alt=\"\" class=\"wp-image-3770\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-19.png?w=906&amp;ssl=1 906w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-19.png?resize=300%2C213&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-19.png?resize=768%2C546&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Once inside, we will create a profile to be able to send emails pointing to our relay server that we will configure on the next point:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"663\" data-attachment-id=\"3771\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-96\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-20.png?fit=1001%2C830&amp;ssl=1\" data-orig-size=\"1001,830\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-20.png?fit=800%2C663&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-20.png?resize=800%2C663&#038;ssl=1\" alt=\"\" class=\"wp-image-3771\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-20.png?w=1001&amp;ssl=1 1001w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-20.png?resize=300%2C249&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-20.png?resize=768%2C637&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">2.4 C2 redirector deployment &#8211; VPS3<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The functionality of this server will be basically to hide the real C2 server IP. The communications are going to be through this server and always encrypted.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2.4.1 Firewall rules<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">As we have done with the rest of server, we will set up a strict firewall rules to just accept the traffic between the servers:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\n# Flush existing rules\niptables -F\niptables -X\n\n# Default policy: DROP\niptables -P INPUT DROP\niptables -P FORWARD DROP\niptables -P OUTPUT DROP\n\n# Allow loopback traffic\niptables -A INPUT -i lo -j ACCEPT\niptables -A OUTPUT -o lo -j ACCEPT\n\n# Allow outbound DNS (UDP and TCP to port 53)\niptables -A OUTPUT -p udp --dport 53 -j ACCEPT\niptables -A OUTPUT -p tcp --dport 53 -j ACCEPT\niptables -A INPUT -p udp --sport 53 -j ACCEPT\niptables -A INPUT -p tcp --sport 53 -j ACCEPT\n\n# Allow outbound HTTP and HTTPS\niptables -A OUTPUT -p tcp --dport 80 -j ACCEPT\niptables -A OUTPUT -p tcp --dport 443 -j ACCEPT\niptables -A INPUT -p tcp --sport 80 -j ACCEPT\niptables -A INPUT -p tcp --sport 443 -j ACCEPT\n\n# Allow SSH\niptables -A INPUT -p tcp --dport 22 -j ACCEPT\niptables -A OUTPUT -p tcp --sport 22 -j ACCEPT\n\n# Allow Incoming traffic\n\n# Allow ICMP incoming (ping)\niptables -A INPUT -p icmp -j ACCEPT\niptables -A OUTPUT -p icmp -j ACCEPT\n\n# Allow incoming HTTPS traffic\niptables -A INPUT -p tcp --dport 443 -j ACCEPT\n\n# Allow incoming HTTP traffic\niptables -A INPUT -p tcp --dport 80 -j ACCEPT\n\n# Allow related and established connections\niptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\niptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n\n# Save rules\niptables-save &gt; \/etc\/iptables\/rules.v4\niptables-restore &lt; \/etc\/iptables\/rules.v4\nnetfilter-persistent save<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">2.4.2 Creating domains for the C2 traffic<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">In your domain provider you will create one A register and CNAME:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"593\" height=\"428\" data-attachment-id=\"3773\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-97\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-21.png?fit=593%2C428&amp;ssl=1\" data-orig-size=\"593,428\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-21.png?fit=593%2C428&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-21.png?resize=593%2C428&#038;ssl=1\" alt=\"\" class=\"wp-image-3773\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-21.png?w=593&amp;ssl=1 593w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-21.png?resize=300%2C217&amp;ssl=1 300w\" sizes=\"(max-width: 593px) 100vw, 593px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">2.4.3 NGINX as Proxy Server to redirect the HTTP\/S traffic to our C2 Server<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">We will use nginx as proxy server. Installation of nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enable nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create file config for the domain:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/nginx\/sites-available\/health.c2traffic.es<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    listen 80;\n    listen &#91;::]:80;\n\n    server_name health.c2traffic.es www.health.c2traffic.es;\n\n    location \/ {\n        proxy_pass https:\/\/c2-server-ip\/;\n        include proxy_params;\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make available the configuration;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ln -s \/etc\/nginx\/sites-available\/health.c2traffic.es \/etc\/nginx\/sites-enabled\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install certbot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snap install --classic certbot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sync certbot to the system:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ln -s \/snap\/bin\/certbot \/usr\/bin\/certbot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Generate certificates with let&#8217;s encrypt:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>certbot --nginx -d health.c2traffic.es -d www.health.c2traffic.es -v<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Final nginx configuration with HTTPS:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    # Redirect all HTTP traffic to HTTPS\n    listen 80;\n    listen &#91;::]:80;\n    server_name health.c2traffic.es www.health.c2traffic.es;\n\n    return 301 https:\/\/$host$request_uri;\n}\n\nserver {\n    # Listen for HTTPS traffic\n    listen 443 ssl;\n    listen &#91;::]:443 ssl;\n\n    server_name health.c2traffic.es www.health.c2traffic.es;\n\n    # SSL Certificates (managed by Certbot)\n    ssl_certificate \/etc\/letsencrypt\/live\/health.c2traffic.es\/fullchain.pem;\n    ssl_certificate_key \/etc\/letsencrypt\/live\/health.c2traffic.es\/privkey.pem;\n    include \/etc\/letsencrypt\/options-ssl-nginx.conf;\n    ssl_dhparam \/etc\/letsencrypt\/ssl-dhparams.pem;\n\n    # Proxy settings\n    location \/ {\n        proxy_pass https:\/\/167.71.14.172\/;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n\n        # Optional: Timeouts for the proxied server\n        proxy_read_timeout 90;\n        proxy_connect_timeout 90;\n        proxy_send_timeout 90;\n\n        # Optional: Security headers\n        add_header X-Content-Type-Options nosniff;\n        add_header X-Frame-Options SAMEORIGIN;\n        add_header X-XSS-Protection \"1; mode=block\";\n    }\n\n    # Optional: Custom error pages (e.g., for 404 or 50x errors)\n    error_page 404 \/404.html;\n    location = \/404.html {\n        internal;\n    }\n    error_page 500 502 503 504 \/50x.html;\n    location = \/50x.html {\n        internal;\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enable auto renew:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start snap.certbot.renew.service<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.5 Relay Server with postfix -VPS4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This server will be responsible of the emails and responsible of hide the phishing server behind the relay server&#8217;s IP.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2.5.1 Firewall rules<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">As we did before, we are going to implement strict rules:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\n# Flush existing rules\niptables -F\niptables -X\n\n# Default policy: DROP\niptables -P INPUT DROP\niptables -P FORWARD DROP\niptables -P OUTPUT DROP\n\n# Enable log\n#iptables -A INPUT -j LOG --log-prefix \"IPTables-Dropped: \" --log-level 4\n\n# Allow loopback traffic\niptables -A INPUT -i lo -j ACCEPT\niptables -A OUTPUT -o lo -j ACCEPT\n\n# Outbound\n\n# Allow outbound DNS (UDP and TCP to port 53)\niptables -A OUTPUT -p udp --dport 53 -j ACCEPT\niptables -A OUTPUT -p tcp --dport 53 -j ACCEPT\niptables -A INPUT -p udp --sport 53 -j ACCEPT\niptables -A INPUT -p tcp --sport 53 -j ACCEPT\n\n# Allow outbound HTTP and HTTPS\niptables -A OUTPUT -p tcp --dport 80 -j ACCEPT\niptables -A OUTPUT -p tcp --dport 443 -j ACCEPT\niptables -A INPUT -p tcp --sport 80 -j ACCEPT\niptables -A INPUT -p tcp --sport 443 -j ACCEPT\n\n# Allow outbound SMTP connections to any IP on port 465\niptables -A OUTPUT -p tcp --dport 465 -j ACCEPT\n\n# Allow outbound SMTP on port 587 (modern SMTP submission)\niptables -A OUTPUT -p tcp --dport 587 -j ACCEPT\niptables -A INPUT -p tcp --sport 587 -j ACCEPT\n\n# Allow ICMP outbound (ping)\niptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT\niptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT\n\n# Allow SSH\niptables -A INPUT -p tcp --dport 22 -j ACCEPT\niptables -A OUTPUT -p tcp --sport 22 -j ACCEPT\n\n# Incoming\n\n# Allow incoming SMTP traffic on port 465 from the trusted IP\niptables -A INPUT -p tcp --dport 465 -s &lt;phishing-server-ip&gt; -j ACCEPT\n\n# Allow incoming HTTPS traffic\niptables -A INPUT -p tcp --dport 443 -j ACCEPT\n\n# Allow incoming HTTP traffic\niptables -A INPUT -p tcp --dport 80 -j ACCEPT\n\n# Allow related and established connections\niptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\niptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n\n# Save rules\niptables-save &gt; \/etc\/iptables\/rules.v4\niptables-restore &lt; \/etc\/iptables\/rules.v4\nnetfilter-persistent save<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">2.5.2 Postfix Relay Configuration<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Install postfix:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt -y install postfix<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Choose internet site:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"532\" data-attachment-id=\"3774\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-98\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-22.png?fit=833%2C554&amp;ssl=1\" data-orig-size=\"833,554\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-22.png?fit=800%2C532&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-22.png?resize=800%2C532&#038;ssl=1\" alt=\"\" class=\"wp-image-3774\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-22.png?w=833&amp;ssl=1 833w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-22.png?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-22.png?resize=768%2C511&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Set up your domain, the one are you going to use for the phishing emails:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"139\" data-attachment-id=\"3775\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-99\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-23.png?fit=1793%2C312&amp;ssl=1\" data-orig-size=\"1793,312\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-23.png?fit=800%2C139&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-23.png?resize=800%2C139&#038;ssl=1\" alt=\"\" class=\"wp-image-3775\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-23.png?w=1793&amp;ssl=1 1793w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-23.png?resize=300%2C52&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-23.png?resize=768%2C134&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-23.png?resize=1536%2C267&amp;ssl=1 1536w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-23.png?w=1600&amp;ssl=1 1600w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Configure the DNS:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"643\" height=\"651\" data-attachment-id=\"3776\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-100\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-24.png?fit=643%2C651&amp;ssl=1\" data-orig-size=\"643,651\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-24.png?fit=643%2C651&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-24.png?resize=643%2C651&#038;ssl=1\" alt=\"\" class=\"wp-image-3776\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-24.png?w=643&amp;ssl=1 643w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-24.png?resize=296%2C300&amp;ssl=1 296w\" sizes=\"(max-width: 643px) 100vw, 643px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Configure SPF, DKIM and DMARC:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"597\" height=\"280\" data-attachment-id=\"3777\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-101\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-25.png?fit=597%2C280&amp;ssl=1\" data-orig-size=\"597,280\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-25.png?fit=597%2C280&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-25.png?resize=597%2C280&#038;ssl=1\" alt=\"\" class=\"wp-image-3777\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-25.png?w=597&amp;ssl=1 597w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-25.png?resize=300%2C141&amp;ssl=1 300w\" sizes=\"(max-width: 597px) 100vw, 597px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Inside \/etc\/postfix\/master.cf we will configure the server to listen on 465,so, we will need to uncomment the following lines because most of the provider don&#8217;t allow access throuth the ports 25:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>smtps     inet  n       -       y       -       -       smtpd\n  -o syslog_name=postfix\/smtps\n  -o smtpd_tls_wrappermode=yes\n  -o smtpd_sasl_auth_enable=yes\n#  -o smtpd_reject_unlisted_recipient=no\n#  -o smtpd_client_restrictions=$mua_client_restrictions\n#  -o smtpd_helo_restrictions=$mua_helo_restrictions\n#  -o smtpd_sender_restrictions=$mua_sender_restrictions\n#  -o smtpd_recipient_restrictions=\n  -o smtpd_relay_restrictions=permit_mynetworks,permit_sasl_authenticated,defer_unauth_destination<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"231\" data-attachment-id=\"3779\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-102\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-26.png?fit=1082%2C313&amp;ssl=1\" data-orig-size=\"1082,313\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-26.png?fit=800%2C231&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-26.png?resize=800%2C231&#038;ssl=1\" alt=\"\" class=\"wp-image-3779\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-26.png?w=1082&amp;ssl=1 1082w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-26.png?resize=300%2C87&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-26.png?resize=768%2C222&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Inside \/etc\/postfix\/main.cf we will configure our smtp relay:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># See \/usr\/share\/postfix\/main.cf.dist for a commented, more complete version\n\n# Debian specific:  Specifying a file name will cause the first\n# line of that file to be used as the name.  The Debian default\n# is \/etc\/mailname.\n#myorigin = \/etc\/mailname\n\nsmtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)\nbiff = no\n\n# Uncomment the next line to generate \"delayed mail\" warnings\n#delay_warning_time = 4h\n\nreadme_directory = no\n\n# See &lt;http:\/\/www.postfix.org\/COMPATIBILITY_README.html&gt; -- default to 3.6 on\n# fresh installs.\ncompatibility_level = 3.6\n\n# TLS parameters\nsmtpd_tls_cert_file=\/etc\/ssl\/certs\/ssl-cert-snakeoil.pem\nsmtpd_tls_key_file=\/etc\/ssl\/private\/ssl-cert-snakeoil.key\nsmtpd_tls_security_level=may\n\nsmtp_tls_CApath=\/etc\/ssl\/certs\nsmtp_tls_session_cache_database = btree:${data_directory}\/smtp_scache\n\nsmtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination\nmyhostname = ubuntu-rd-smtp\nalias_maps = hash:\/etc\/aliases\nalias_database = hash:\/etc\/aliases\nmyorigin = \/etc\/mailname\n\n# Modified to authenticate\nmydestination = $myhostname, <strong>mail.phishing.domain, phishing.domain, hostname,<\/strong> localhost.localdomain, localhost\n\n# Relayhost configuration\nrelayhost = &#91;<strong>provider.smtp.server<\/strong>]:587\n\n# Enable TLS encryption\nsmtp_tls_security_level = encrypt\nsmtp_tls_protocols = !SSLv2, !SSLv3\nsmtp_tls_mandatory_protocols = !SSLv2, !SSLv3\n\n# Use the CA certificate bundle to verify the relay server's certificate\nsmtp_tls_CAfile = \/etc\/ssl\/certs\/ca-certificates.crt\n\n# Authentication settings (if needed by your relay)\nsmtp_sasl_auth_enable = yes\nsmtp_sasl_password_maps = hash:\/etc\/postfix\/sasl_passwd\nsmtp_sasl_security_options = noanonymous\nsmtp_sasl_mechanism_filter = plain, login\n\n# Remove unwanted headers\nsmtp_header_checks = regexp:\/etc\/postfix\/smtp_header_checks\n\nmasquerade_domains = <strong>phishing.domain<\/strong>\nremote_header_rewrite_domain = <strong>phishing.domain<\/strong>\nappend_dot_mydomain = yes\n\nmynetworks = 127.0.0.0\/8 &#91;::ffff:127.0.0.0]\/104 &#91;::1]\/128 <strong>your-public-ips<\/strong>\nmailbox_size_limit = 0\nrecipient_delimiter = +\ninet_interfaces = all\ninet_protocols = all\ninet_protocols = all<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create file with credentials \/etc\/postfix\/sasl_passwd:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;smtp-provider-server]:587 support@phishing.domain:password<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Change the permissions and create a hash database:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 600 \/etc\/postfix\/sasl_passwd<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>postmap \/etc\/postfix\/sasl_passwd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create file to delete the headers \u201csmtp_header_checks\u201d:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/^Received:.*\/              IGNORE\n\/^X-Originating-IP:\/    IGNORE\n\/^X-Mailer:\/            IGNORE\n\/^Mime-Version:\/        IGNORE<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Compile the headers rule:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo postmap \/etc\/postfix\/smtp_header_checks<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Include the checks into master.cf:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-o header_checks=regexp:\/etc\/postfix\/smtp_header_checks<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"166\" data-attachment-id=\"3780\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-103\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-27.png?fit=735%2C166&amp;ssl=1\" data-orig-size=\"735,166\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-27.png?fit=735%2C166&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-27.png?resize=735%2C166&#038;ssl=1\" alt=\"\" class=\"wp-image-3780\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-27.png?w=735&amp;ssl=1 735w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-27.png?resize=300%2C68&amp;ssl=1 300w\" sizes=\"(max-width: 735px) 100vw, 735px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart postfix<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Test send emails:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"Test email\" | mail -s \"Test Subject\" -r \"support &lt;support@phishing.domain&gt;\" your-email@gmail.com<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">2.5.3 Nginx Proxy Server to redirect the phishing traffic<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Install nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enable nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create file config for the domain:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/nginx\/sites-available\/<strong>phishing.domain<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    listen 80;\n    listen &#91;::]:80;\n\n    server_name <strong>phishing.domain<\/strong> www.<strong>phishing.domain<\/strong>;\n\n    location \/ {\n        proxy_pass http:\/\/<strong>ip-phishing-server<\/strong>\/;\n        include proxy_params;\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make available the configuration;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ln -s \/etc\/nginx\/sites-available\/<strong>phishing.domain<\/strong> \/etc\/nginx\/sites-enabled\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install certbot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snap install --classic certbot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sync certbot to the system:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ln -s \/snap\/bin\/certbot \/usr\/bin\/certbot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Generate certificates:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>certbot --nginx -d <strong>phishing.domain<\/strong> -d www.<strong>phishing.domain<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Final nginx configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    # Redirect all HTTP traffic to HTTPS\n    listen 80;\n    listen &#91;::]:80;\n    server_name <strong>phishing.domain<\/strong> www.<strong>phishing.domain<\/strong>;\n\n    return 301 https:\/\/$host$request_uri;\n}\n\nserver {\n    # Listen for HTTPS traffic\n    listen 443 ssl;\n    listen &#91;::]:443 ssl;\n\n    server_name <strong>phishing.domain<\/strong> www.<strong>phishing.domain<\/strong>;\n\n    # SSL Certificates (managed by Certbot)\n    ssl_certificate \/etc\/letsencrypt\/live\/<strong>phishing.domain<\/strong>\/fullchain.pem;\n    ssl_certificate_key \/etc\/letsencrypt\/live\/<strong>phishing.domain<\/strong>\/privkey.pem;\n    include \/etc\/letsencrypt\/options-ssl-nginx.conf;\n    ssl_dhparam \/etc\/letsencrypt\/ssl-dhparams.pem;\n\n    # Proxy settings for all other paths\n    location \/ {\n        proxy_pass http:\/\/<strong>phishing-server-ip<\/strong>\/;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n\n        # Optional: Timeouts for the proxied server\n        proxy_read_timeout 90;\n        proxy_connect_timeout 90;\n        proxy_send_timeout 90;\n\n        # Optional: Security headers\n        add_header X-Content-Type-Options nosniff;\n        add_header X-Frame-Options SAMEORIGIN;\n        add_header X-XSS-Protection \"1; mode=block\";\n    }\n\n    # Serve local files for \/download\/ to deliver the C2 payloads\n    location \/download\/ {\n        root \/var\/www\/html\/;\n        autoindex on;                       # Optional: Enable directory listing\n        autoindex_exact_size off;           # Optional: Human-readable file sizes\n        autoindex_format html;              # Optional: HTML format for listing\n    }\n\n    # Optional: Custom error pages (e.g., for 404 or 50x errors)\n    error_page 404 \/404.html;\n    location = \/404.html {\n        internal;\n    }\n    error_page 500 502 503 504 \/50x.html;\n    location = \/50x.html {\n        internal;\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enable auto renew:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start snap.certbot.renew.service<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3. SSH Fail2Ban for ALL the servers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Install Fail2Ban:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt -y install fail2ban<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enable the service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable fail2ban<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start the service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start fail2ban<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"177\" data-attachment-id=\"3781\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-104\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-28.png?fit=936%2C207&amp;ssl=1\" data-orig-size=\"936,207\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-28.png?fit=800%2C177&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-28.png?resize=800%2C177&#038;ssl=1\" alt=\"\" class=\"wp-image-3781\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-28.png?w=936&amp;ssl=1 936w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-28.png?resize=300%2C66&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-28.png?resize=768%2C170&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Start new configuration copying the conf file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp \/etc\/fail2ban\/jail.conf \/etc\/fail2ban\/jail.local<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Edit the configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/fail2ban\/jail.local\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Modify the following values:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bantime  = 1d\nfindtime  = 10m\nmaxretry = 3<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"301\" data-attachment-id=\"3782\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-105\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-29.png?fit=1011%2C381&amp;ssl=1\" data-orig-size=\"1011,381\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-29.png?fit=800%2C301&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-29.png?resize=800%2C301&#038;ssl=1\" alt=\"\" class=\"wp-image-3782\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-29.png?w=1011&amp;ssl=1 1011w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-29.png?resize=300%2C113&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-29.png?resize=768%2C289&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In case that your are using IPTABLES as firewall, then, the following configuration should be pointing iptables:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"168\" data-attachment-id=\"3783\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-106\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-30.png?fit=660%2C168&amp;ssl=1\" data-orig-size=\"660,168\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-30.png?fit=660%2C168&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-30.png?resize=660%2C168&#038;ssl=1\" alt=\"\" class=\"wp-image-3783\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-30.png?w=660&amp;ssl=1 660w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-30.png?resize=300%2C76&amp;ssl=1 300w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Then, we will enable the protection for the SSH service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>enabled = true<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"196\" data-attachment-id=\"3784\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-107\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-31.png?fit=843%2C207&amp;ssl=1\" data-orig-size=\"843,207\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-31.png?fit=800%2C196&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-31.png?resize=800%2C196&#038;ssl=1\" alt=\"\" class=\"wp-image-3784\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-31.png?w=843&amp;ssl=1 843w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-31.png?resize=300%2C74&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-31.png?resize=768%2C189&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart fail2ban<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After sometime check the IPs banned:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fail2ban-client get sshd ignoreip<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"112\" data-attachment-id=\"3785\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/image-108\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-32.png?fit=1681%2C235&amp;ssl=1\" data-orig-size=\"1681,235\" data-comments-opened=\"1\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-32.png?fit=800%2C112&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-32.png?resize=800%2C112&#038;ssl=1\" alt=\"\" class=\"wp-image-3785\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-32.png?w=1681&amp;ssl=1 1681w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-32.png?resize=300%2C42&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-32.png?resize=768%2C107&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-32.png?resize=1536%2C215&amp;ssl=1 1536w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/image-32.png?w=1600&amp;ssl=1 1600w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">4. Proof of Concept<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The proof of concept does not include how to avoid EDR or AV. We will focus on the delivery of the payload through phishing and how the infrastructure has been deployed. Also, we will see how to perform a phishing with GoPhish, where we will simulate two different scenarios where the user receives an email where he should introduce his credentials and other case is, basically, that the user need to download a critical update but in reality the Havoc agent to control the objective.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">During the process of this proof of concept we will check also the headers of the email and the traffic generated by our C2 agent to see that everything is encrypted.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope you enjoy this PoC:<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe class=\"youtube-player\" title=\"YouTube video player\" width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/ilXxbeKSHBk?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=es-ES&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">5. Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see, deploy a red team infrastructure is not that easy and it is much complex when you want to deploy it secure. Also, I would say that we can add more secure improvement to our infrastructure like adding one more server like syslog with a dashboard to collect all the log and be more active monitoring our infrastructure. Obviously, we should deploy all the software customized for our necessity.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for visiting the post. I hope you enjoy the port and the video. Remember to follow me on my social networks:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Linkedin<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Twitter<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Github<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hack The Box<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to a new post, where we are going to see how to deploy a secure Red Team infrastructure. We will se how to deploy legit services to perform phishing &#8230;<\/p>\n","protected":false},"author":1,"featured_media":3764,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":false,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3,7],"tags":[330,546,28,544,545,548,41,71,344,549,547],"class_list":["post-3759","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-guias","category-seguridad-informatica","tag-c2","tag-gophish","tag-hacking","tag-havoc","tag-havoc-c2","tag-infrastructure","tag-pentesting","tag-phishing","tag-red-team","tag-red-team-infrastructure","tag-redirectors"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Deploying Secure Red Team Infrastructure - Hardsoft Security<\/title>\n<meta name=\"description\" content=\"Deploying Secure Red Team Infrastructure with legit services to perform phishing and hide our C2 traffic through HTTPS protocol.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deploying Secure Red Team Infrastructure - Hardsoft Security\" \/>\n<meta property=\"og:description\" content=\"Deploying Secure Red Team Infrastructure with legit services to perform phishing and hide our C2 traffic through HTTPS protocol.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/\" \/>\n<meta property=\"og:site_name\" content=\"Hardsoft Security\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/HardSoftDavid\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-25T13:03:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-16T16:50:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1467\" \/>\n\t<meta property=\"og:image:height\" content=\"754\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"david\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DavidDeMaya\" \/>\n<meta name=\"twitter:site\" content=\"@DavidDeMaya\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"david\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/\"},\"author\":{\"name\":\"david\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/#\\\/schema\\\/person\\\/dfe289b1e4ae2daf72695e85a8b3dd7a\"},\"headline\":\"Deploying Secure Red Team Infrastructure\",\"datePublished\":\"2024-12-25T13:03:49+00:00\",\"dateModified\":\"2025-01-16T16:50:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/\"},\"wordCount\":1446,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/hardsoftsecurity.es\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/redteam-1.png?fit=1467%2C754&ssl=1\",\"keywords\":[\"C2\",\"GoPhish\",\"hacking\",\"Havoc\",\"Havoc C2\",\"infrastructure\",\"pentesting\",\"phishing\",\"Red Team\",\"Red Team Infrastructure\",\"Redirectors\"],\"articleSection\":[\"Gu\u00edas\",\"Seguridad inform\u00e1tica\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/\",\"url\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/\",\"name\":\"Deploying Secure Red Team Infrastructure - Hardsoft Security\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/hardsoftsecurity.es\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/redteam-1.png?fit=1467%2C754&ssl=1\",\"datePublished\":\"2024-12-25T13:03:49+00:00\",\"dateModified\":\"2025-01-16T16:50:32+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/#\\\/schema\\\/person\\\/dfe289b1e4ae2daf72695e85a8b3dd7a\"},\"description\":\"Deploying Secure Red Team Infrastructure with legit services to perform phishing and hide our C2 traffic through HTTPS protocol.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/hardsoftsecurity.es\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/redteam-1.png?fit=1467%2C754&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/hardsoftsecurity.es\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/redteam-1.png?fit=1467%2C754&ssl=1\",\"width\":1467,\"height\":754},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2024\\\/12\\\/25\\\/deploying-secure-red-team-infrastructure\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\\\/\\\/hardsoftsecurity.es\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deploying Secure Red Team Infrastructure\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/#website\",\"url\":\"https:\\\/\\\/hardsoftsecurity.es\\\/\",\"name\":\"Hardsoft Security\",\"description\":\"Chasing (In)Security\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/hardsoftsecurity.es\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/#\\\/schema\\\/person\\\/dfe289b1e4ae2daf72695e85a8b3dd7a\",\"name\":\"david\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g\",\"caption\":\"david\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Deploying Secure Red Team Infrastructure - Hardsoft Security","description":"Deploying Secure Red Team Infrastructure with legit services to perform phishing and hide our C2 traffic through HTTPS protocol.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/","og_locale":"es_ES","og_type":"article","og_title":"Deploying Secure Red Team Infrastructure - Hardsoft Security","og_description":"Deploying Secure Red Team Infrastructure with legit services to perform phishing and hide our C2 traffic through HTTPS protocol.","og_url":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/","og_site_name":"Hardsoft Security","article_publisher":"https:\/\/www.facebook.com\/HardSoftDavid","article_published_time":"2024-12-25T13:03:49+00:00","article_modified_time":"2025-01-16T16:50:32+00:00","og_image":[{"width":1467,"height":754,"url":"https:\/\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png","type":"image\/png"}],"author":"david","twitter_card":"summary_large_image","twitter_creator":"@DavidDeMaya","twitter_site":"@DavidDeMaya","twitter_misc":{"Escrito por":"david","Tiempo de lectura":"11 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/#article","isPartOf":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/"},"author":{"name":"david","@id":"https:\/\/hardsoftsecurity.es\/#\/schema\/person\/dfe289b1e4ae2daf72695e85a8b3dd7a"},"headline":"Deploying Secure Red Team Infrastructure","datePublished":"2024-12-25T13:03:49+00:00","dateModified":"2025-01-16T16:50:32+00:00","mainEntityOfPage":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/"},"wordCount":1446,"commentCount":0,"image":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?fit=1467%2C754&ssl=1","keywords":["C2","GoPhish","hacking","Havoc","Havoc C2","infrastructure","pentesting","phishing","Red Team","Red Team Infrastructure","Redirectors"],"articleSection":["Gu\u00edas","Seguridad inform\u00e1tica"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/","url":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/","name":"Deploying Secure Red Team Infrastructure - Hardsoft Security","isPartOf":{"@id":"https:\/\/hardsoftsecurity.es\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/#primaryimage"},"image":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?fit=1467%2C754&ssl=1","datePublished":"2024-12-25T13:03:49+00:00","dateModified":"2025-01-16T16:50:32+00:00","author":{"@id":"https:\/\/hardsoftsecurity.es\/#\/schema\/person\/dfe289b1e4ae2daf72695e85a8b3dd7a"},"description":"Deploying Secure Red Team Infrastructure with legit services to perform phishing and hide our C2 traffic through HTTPS protocol.","breadcrumb":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/#primaryimage","url":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?fit=1467%2C754&ssl=1","contentUrl":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?fit=1467%2C754&ssl=1","width":1467,"height":754},{"@type":"BreadcrumbList","@id":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/12\/25\/deploying-secure-red-team-infrastructure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/hardsoftsecurity.es\/"},{"@type":"ListItem","position":2,"name":"Deploying Secure Red Team Infrastructure"}]},{"@type":"WebSite","@id":"https:\/\/hardsoftsecurity.es\/#website","url":"https:\/\/hardsoftsecurity.es\/","name":"Hardsoft Security","description":"Chasing (In)Security","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hardsoftsecurity.es\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Person","@id":"https:\/\/hardsoftsecurity.es\/#\/schema\/person\/dfe289b1e4ae2daf72695e85a8b3dd7a","name":"david","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g","caption":"david"}}]}},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7xGFx-YD","jetpack-related-posts":[{"id":2873,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2023\/03\/29\/como-funciona-covenant-c2\/","url_meta":{"origin":3759,"position":0},"title":"\u00bfC\u00f3mo funciona Covenant C2?","author":"david","date":"marzo 29, 2023","format":false,"excerpt":"Buenas a tod@s, como es deuda, hoy os traigo la continuaci\u00f3n del post anterior de Covenant C2, en este post, vamos hablar de como se utiliza Covenant C2 para poder realizar una infecci\u00f3n de un equipo para posteriormente, tener un control total del equipo v\u00edctima. Antes de comenzar, si no\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2023\/03\/image-24.png?fit=1200%2C685&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2023\/03\/image-24.png?fit=1200%2C685&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2023\/03\/image-24.png?fit=1200%2C685&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2023\/03\/image-24.png?fit=1200%2C685&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2023\/03\/image-24.png?fit=1200%2C685&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2862,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2023\/03\/17\/que-es-covenant-c2\/","url_meta":{"origin":3759,"position":1},"title":"\u00bfQu\u00e9 es Covenant C2?","author":"david","date":"marzo 17, 2023","format":false,"excerpt":"\u00a1Buenas a tod@s! \u00bfAlguna vez te has preguntado c\u00f3mo los ciber-delincuentes o equipos de red team pueden controlar tu ordenador y tus dispositivos sin que te des cuenta? La respuesta est\u00e1 en los servidores C2. Hoy vamos a hablar sobre uno de los servidores C2 m\u00e1s utilizados: Covenant C2. Te\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2023\/03\/image-11.png?fit=1200%2C983&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2023\/03\/image-11.png?fit=1200%2C983&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2023\/03\/image-11.png?fit=1200%2C983&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2023\/03\/image-11.png?fit=1200%2C983&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2023\/03\/image-11.png?fit=1200%2C983&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2411,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2021\/02\/26\/como-hacer-phishing-via-email-poc\/","url_meta":{"origin":3759,"position":2},"title":"C\u00f3mo hacer phishing v\u00eda email. PoC.","author":"david","date":"febrero 26, 2021","format":false,"excerpt":"Hola a tod@s, para este nuevo post de Hardsoft Security os traigo \"C\u00f3mo hacer phishing v\u00eda email\", donde vamos a ver el caso de uso m\u00e1s t\u00edpico de un ataque phishing. Este ataque consistir\u00e1 en montar un servidor web que contendr\u00e1 la p\u00e1gina web como tal del propio phishing, simulando\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2021\/01\/Portada-Phishing-1920x1441-1.jpg?fit=1200%2C901&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2021\/01\/Portada-Phishing-1920x1441-1.jpg?fit=1200%2C901&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2021\/01\/Portada-Phishing-1920x1441-1.jpg?fit=1200%2C901&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2021\/01\/Portada-Phishing-1920x1441-1.jpg?fit=1200%2C901&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2021\/01\/Portada-Phishing-1920x1441-1.jpg?fit=1200%2C901&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":983,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/19\/phishing-con-setoolkit-a-traves-de-internet\/","url_meta":{"origin":3759,"position":3},"title":"&#8220;Phishing&#8221; Con Setoolkit A Trav\u00e9s De Internet.","author":"david","date":"junio 19, 2016","format":false,"excerpt":"Hola a todos anteriormente ya os hab\u00eda traigo una gu\u00eda de como realizar un \"phishing\" de Facebook manualmente, hoy os traigo como realizar un \"phishing\" mediante la herramienta Setoolkit, con conexi\u00f3n a este \"phishing\" a trav\u00e9s de internet. \"Phishing\" Con Setoolkit A Trav\u00e9s De Internet: \u00a0 \u00a0 \u00a0 Gracias por\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Phishing-Scam_iStock_000017435282Medium.jpg?fit=1197%2C705&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Phishing-Scam_iStock_000017435282Medium.jpg?fit=1197%2C705&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Phishing-Scam_iStock_000017435282Medium.jpg?fit=1197%2C705&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Phishing-Scam_iStock_000017435282Medium.jpg?fit=1197%2C705&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Phishing-Scam_iStock_000017435282Medium.jpg?fit=1197%2C705&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":949,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/05\/22\/como-hacer-un-phishing-de-facebook-kali-linux\/","url_meta":{"origin":3759,"position":4},"title":"Como hacer un &#8220;Phishing&#8221; de Facebook. Kali Linux.","author":"david","date":"mayo 22, 2016","format":false,"excerpt":"Como hacer un \"Phishing\" de Facebook. Kali Linux. Hola a todos hoy vengo a mostraros como hacer un \"Phishing\" de Facebook. Es muy sencillo, solo ten\u00e9is que seguir los pasos que os muestro en la siguiente gu\u00eda. Muchas gracias por visitar Hardsoft Security - \"In-Seguridad Inform\u00e1tica\". Bueno aqu\u00ed os dejo\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2015\/10\/ingeniera-social-1-638.jpg?fit=638%2C479&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2015\/10\/ingeniera-social-1-638.jpg?fit=638%2C479&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2015\/10\/ingeniera-social-1-638.jpg?fit=638%2C479&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":1332,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2017\/07\/31\/hacking-basico-13-phishing-a-traves-de-internet-kali-linux\/","url_meta":{"origin":3759,"position":5},"title":"Phishing a trav\u00e9s de internet. Kali Linux &#8211; Hacking B\u00e1sico 13.","author":"david","date":"julio 31, 2017","format":false,"excerpt":"Hola buenas, hoy os traigo una gu\u00eda para saber como realizar un phishing a trav\u00e9s de internet, en este caso utilizo kali linux con la herramienta setoolkit. Aqu\u00ed os dejo el v\u00eddeo: Hacking B\u00e1sico 13. Phishing a trav\u00e9s de internet. Kali Linux. Servicio de copias de seguridad, visita backup.hardsoftsecurity.es Saludos,\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Phishing-Scam_iStock_000017435282Medium.jpg?fit=1197%2C705&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Phishing-Scam_iStock_000017435282Medium.jpg?fit=1197%2C705&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Phishing-Scam_iStock_000017435282Medium.jpg?fit=1197%2C705&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Phishing-Scam_iStock_000017435282Medium.jpg?fit=1197%2C705&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Phishing-Scam_iStock_000017435282Medium.jpg?fit=1197%2C705&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_likes_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/12\/redteam-1.png?fit=1467%2C754&ssl=1","_links":{"self":[{"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/posts\/3759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/comments?post=3759"}],"version-history":[{"count":8,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/posts\/3759\/revisions"}],"predecessor-version":[{"id":3797,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/posts\/3759\/revisions\/3797"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/media\/3764"}],"wp:attachment":[{"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/media?parent=3759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/categories?post=3759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/tags?post=3759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}