<?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>Web Exploitation on Alexander Roca</title><link>https://alexanderroca.dev/tags/web-exploitation/</link><description>Recent content in Web Exploitation on Alexander Roca</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 19 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://alexanderroca.dev/tags/web-exploitation/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></channel></rss>