<?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 KatchauBerg on Medium]]></title>
        <description><![CDATA[Stories by KatchauBerg on Medium]]></description>
        <link>https://medium.com/@kevinlima138?source=rss-22afb5e5fc15------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MtX5Q4lIS37WYv4jn0Ygdg.jpeg</url>
            <title>Stories by KatchauBerg on Medium</title>
            <link>https://medium.com/@kevinlima138?source=rss-22afb5e5fc15------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 08:04:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kevinlima138/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[TryHackMe — Recruit Write-up]]></title>
            <link>https://medium.com/@kevinlima138/tryhackme-recruit-write-up-ba4f388fb62d?source=rss-22afb5e5fc15------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba4f388fb62d</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[web-penetration-testing]]></category>
            <category><![CDATA[cybersecurity-training]]></category>
            <dc:creator><![CDATA[KatchauBerg]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 14:18:30 GMT</pubDate>
            <atom:updated>2026-04-27T16:10:47.107Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F-mgWwEKcxBbAbzKE4sKXw.png" /></figure><p><strong>Author:</strong> KatchauBerg <br><strong>Platform:</strong> TryHackMe</p><h3>Challenge Analysis &amp; Passive Reconnaissance</h3><p>A careful reading of the challenge description already provides valuable information before even opening a browser. The challenge describes a <strong>recruitment web application</strong> with two distinct access levels: HR and Administrator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*wVqrxyxCsvvCpXha3plZTA.png" /></figure><p>With that in mind, I decided to start with <strong>passive reconnaissance</strong>, manually exploring the web interface before resorting to automated tools. This decision was intentional:</p><blockquote><em>In a real environment with an active SOC, tools like nmap, nikto, or dirbuster generate easily detectable logs. The passive approach reduces noise and allows information gathering without triggering alerts.</em></blockquote><h3>API Enumeration — LFI Discovery</h3><p>While browsing the application, I found a button linking to the API documentation — accessible <strong>without authentication</strong>. Public APIs with no access control are rich sources of information about the application’s internal structure.</p><p>The documentation exposed a single endpoint:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sazr_M1BkJsnA4qhRry-kQ.png" /></figure><pre>GET /file.php?cv=&lt;URL&gt;</pre><p>The cv parameter accepts a URL as input. This immediately raised two hypotheses:</p><ul><li><strong>RFI (Remote File Inclusion):</strong> the server makes a request to an external URL</li><li><strong>LFI (Local File Inclusion):</strong> the server reads a local file using schemes like file://</li></ul><h3>🔍 RFI Test</h3><p>To validate the RFI hypothesis, I sent an external URL pointing to a random image. The response was:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dBGUjDmkBhbbjUCXfnyxmw.png" /></figure><pre>&quot;Only Local Files are allowed&quot;</pre><p>RFI hypothesis discarded. However, the error message confirmed that the server <strong>processes the URL internally</strong>, indicating LFI.</p><h3>Internal File Reading via LFI</h3><p>With LFI confirmed, the natural first target would be /etc/passwd to enumerate system users. However, the response was:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*FeurCaEa1eC_ZBUnyFFVSw.png" /></figure><pre>&quot;Access Denied&quot;</pre><p>The server has some access control blocking sensitive OS files. I redirected focus to <strong>application source files</strong>, which typically reside at /var/www/html/ on Linux servers running PHP.</p><h3>🔍 Exploitation</h3><pre>GET /file.php?cv=file:///var/www/html/config.php</pre><p>The file was returned successfully, exposing <strong>hardcoded</strong> credentials in the source code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*T9hyjfgyXwxxzIU31DqUxg.png" /></figure><pre>$HR_PASSWORD = &#39;hrpassword123&#39;;</pre><blockquote><em>⚠️ Storing credentials in plaintext inside configuration files is a critical security violation. The correct approach is to use environment variables or secret managers such as HashiCorp Vault or AWS Secrets Manager.</em></blockquote><h3>HR Panel Access</h3><p>With the password in hand, I still needed a username. The configuration file didn’t expose one. The options were:</p><ol><li><strong>Brute force</strong> on the login page — discarded due to the noise it would generate in a real environment with active monitoring</li><li><strong>Contextual inference</strong> — since this is an HR portal, I tried obvious credentials based on the application’s context</li></ol><p>I tested the username hr combined with the discovered password.</p><p>✅ <strong>Access granted.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zcIYxAKAMKYG7WYfLxDYbA.png" /></figure><p><strong>🚩 Flag 1 obtained.</strong></p><h3>SQL Injection on the Dashboard</h3><p>Authenticated as HR, I mapped the available features. The dashboard displayed a candidates table with a search bar — search fields are classic SQL Injection targets, as they frequently build dynamic queries by directly concatenating user input into the SQL statement without proper sanitization.</p><h3>🔍 SQLi Confirmation</h3><p>I inserted a single quote to break the SQL syntax:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1WgfhCIt5u3WtFWvdfN2ag.png" /></figure><pre>GET /dashboard.php?search=&#39;</pre><p>The application returned a verbose MySQL error:</p><pre>You have an error in your SQL syntax; check the manual that corresponds<br>to your MySQL server version for the right syntax to use near &#39;%&#39;&#39; at line 1</pre><p>This confirmed three critical pieces of information:</p><ul><li>✅ SQL Injection present</li><li>✅ Database engine: <strong>MySQL</strong></li><li>✅ Verbose errors exposed in production</li></ul><h3>🔍 Manual Enumeration — Database Name</h3><p>Observing the dashboard table with <strong>4 visible columns</strong>, I built the appropriate UNION SELECT payload:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mBonK1lGoxIWZiJ8AhENKQ.png" /></figure><pre>&#39; UNION SELECT database(),NULL,NULL,NULL-- -</pre><p>Result: recruit_db</p><h3>🔍 Automation with sqlmap</h3><p>With the database identified, I used sqlmap to automate table and data extraction:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*J-376Q9IMlm_Sgu3CmUYKA.png" /></figure><pre># List tables<br>sqlmap -u &quot;http://TARGET/dashboard.php?search=test&quot; \<br>  --cookie=&quot;PHPSESSID=&lt;session&gt;&quot; \<br>  -D recruit_db --tables --batch</pre><pre># Dump users table<br>sqlmap -u &quot;http://TARGET/dashboard.php?search=test&quot; \<br>  --cookie=&quot;PHPSESSID=&lt;session&gt;&quot; \<br>  -D recruit_db -T users --dump --batch</pre><p>The users table returned credentials stored in <strong>plaintext</strong>, including the administrator&#39;s credentials.</p><blockquote><em>⚠️ Passwords should never be stored in plaintext. The correct approach is to use secure hashing algorithms such as bcrypt or Argon2.</em></blockquote><h3>Admin Access</h3><p>With the administrator credentials extracted from the database, I accessed the application’s admin panel.</p><p>✅ <strong>Logged in as administrator.</strong></p><p><strong>🚩 Flag 2 obtained.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0O_k2u3CWubtoVnR1047yw.png" /></figure><p>Vulnerability Impact Mitigation LFI via URL parameter Internal server file read Validate and sanitize input; block file:// and php:// schemes Unauthenticated public API Attack surface exposure Enforce authentication on all sensitive documentation Hardcoded credentials Plaintext password exposure Use environment variables or secret managers Verbose errors in production Database information disclosure Disable display_errors in production environments SQL Injection Full database dump Use Prepared Statements and parameterized queries Plaintext passwords in database Full account compromise Hash passwords with bcrypt or Argon2</p><h3>References</h3><ul><li><a href="https://owasp.org/www-community/attacks/Server_Side_Request_Forgery">OWASP SSRF</a></li><li><a href="https://owasp.org/www-community/attacks/SQL_Injection">OWASP SQL Injection</a></li><li><a href="https://owasp.org/www-project-web-security-testing-guide/">OWASP LFI</a></li><li><a href="https://sqlmap.org/">sqlmap Documentation</a></li><li><a href="https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html">OWASP Secrets Management</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba4f388fb62d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>