<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.3">Jekyll</generator><link href="https://td00k.github.io//feed.xml" rel="self" type="application/atom+xml" /><link href="https://td00k.github.io//" rel="alternate" type="text/html" /><updated>2023-08-13T12:22:37+00:00</updated><id>https://td00k.github.io//feed.xml</id><title type="html">td00k</title><subtitle>A blog about technology and stuff related</subtitle><entry><title type="html">Hack The Box | Sau Write Up</title><link href="https://td00k.github.io//Sau/" rel="alternate" type="text/html" title="Hack The Box | Sau Write Up" /><published>2023-07-30T17:48:00+00:00</published><updated>2023-07-30T17:48:00+00:00</updated><id>https://td00k.github.io//Sau</id><content type="html" xml:base="https://td00k.github.io//Sau/">&lt;h2 id=&quot;sau-dont-really-find-any-possible-association-from-the-name-but-it-is-flagged-as-really-easy-by-the-community-is-that-really-easy&quot;&gt;Sau? Don’t really find any possible association from the name but it is flagged as really easy by the community. &lt;del&gt;Is that really easy?&lt;/del&gt;&lt;/h2&gt;

&lt;h3 id=&quot;recon&quot;&gt;Recon&lt;/h3&gt;
&lt;style&gt;body {text-align: justify}&lt;/style&gt;

&lt;p&gt;The recon started with the usual nmap where it was found 2 ports open and one filtered.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Sau/nmap.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And actually on tcp port 55555 a HTTP service was found - by checking the page:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Sau/basquets1.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The first action done before even explore the page was search what request-baskets was - https://github.com/darklynx/request-baskets.
After checking what it was, why not search for a possible security flaw and in fact that version was found to be vulnerable to a SSRF - from the info on this page: https://github.com/advisories/GHSA-58g2-vgpg-335q&lt;/p&gt;

&lt;p&gt;By going into the references, the following page https://notes.sjtu.edu.cn/s/MUUhEymt7 was in fact very helpful to understand what the vulnerability was about and also, how to explore it. 
Since no interaction was done with the application so far, it was difficult to not trying at the same time that the &lt;em&gt;how to&lt;/em&gt; was being read. Altough the final outcome was not a prompt reverse shell, it was feeling worthy to follow the steps and so, the basket was created:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Sau/basket2.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;With &lt;em&gt;mycrazybasquet&lt;/em&gt; it was possible to start the PoC for the SSRF. As a paranteses, SSRF (Server-Side Request Forgery) happens when a threat actor tricks a server to acess/request unintended resources by somehow crafting a request. On this case, the framework used has a feature to forward the traffic which was explorer and SSRF was achieved.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Sau/basket3.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And, after the configuraiton is done, when accessing the basket created the following page pops-up:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Sau/mailtrail.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And… Same approach, Google is always a good idea so after just pasting &lt;em&gt;Maltrail v0.53&lt;/em&gt;, the attention went to an OS command injection vulnerability: https://github.com/spookier/Maltrail-v0.53-Exploit &amp;amp; https://huntr.dev/bounties/be3c5204-fbd9-448d-b97c-96a8d2941e87/. After digging in on the how the vulnerability was found and explored, is PoC time.&lt;/p&gt;

&lt;p&gt;Settings changed:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Sau/basket4.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Reverse shell attempt:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Sau/revshell.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;User is now achieved. And after a quick &lt;em&gt;ls&lt;/em&gt;, a interesting file is found: h&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Sau/h.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;On this file, it was possible to see an output of the &lt;em&gt;trail.service&lt;/em&gt; which can be executed as sudo.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Sau/sudo.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So, after some research on Google on this - https://exploit-notes.hdks.org/exploit/linux/privilege-escalation/sudo/sudo-systemctl-privilege-escalation/, which lead into this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Sau/sudo2.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A quick and fun ride :)))&lt;/p&gt;</content><author><name>td00k</name></author><category term="blog" /><category term="infosec" /><category term="hackthebox" /><summary type="html">Sau? Don’t really find any possible association from the name but it is flagged as really easy by the community. Is that really easy?</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://td00k.github.io//assets/images/Sau/sau.jpg" /><media:content medium="image" url="https://td00k.github.io//assets/images/Sau/sau.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Hack The Box | MonitorsTwo Write Up</title><link href="https://td00k.github.io//MonitorsTwo/" rel="alternate" type="text/html" title="Hack The Box | MonitorsTwo Write Up" /><published>2023-07-20T22:48:00+00:00</published><updated>2023-07-20T22:48:00+00:00</updated><id>https://td00k.github.io//MonitorsTwo</id><content type="html" xml:base="https://td00k.github.io//MonitorsTwo/">&lt;h2 id=&quot;monitors-two---are-we-going-to-need-two-monitors-or-two-shells&quot;&gt;Monitors Two - are we going to need two monitors? Or two &lt;del&gt;shells&lt;/del&gt;?&lt;/h2&gt;

&lt;h3 id=&quot;recon&quot;&gt;Recon&lt;/h3&gt;
&lt;style&gt;body {text-align: justify}&lt;/style&gt;

&lt;p&gt;Recon was done through nmap command - port 80 and 22 were found to be open.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/MonitorsTwo/nmap.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So… Let’s see what is deal with the port 80.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/MonitorsTwo/cacti.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Wild Cacti was found and the classical &lt;em&gt;admin:admin&lt;/em&gt; was tested without any success. 
The next shot was assess the version - if it has a known exploit (which happens to be true). With a quick Google search, the following CVE showed up - &lt;em&gt;https://github.com/FredBrave/CVE-2022-46169-CACTI-1.2.22&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Next action was to test the exploit (which was an success!!)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/MonitorsTwo/www-data.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A shell as www-data was granted, after some non-sucessful enumeration on the host - why not test a Linux Privilege Escalation script. LinPeas was the choosen one.
By reviewing the output, a script was flagged - &lt;strong&gt;entry_point.sh&lt;/strong&gt;, which has a connection to a database.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/MonitorsTwo/entrypoint.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After connecting to the DB:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/MonitorsTwo/db.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Hashes? Hum, worth it to call John (for both of them), but only one was picked up by John:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/MonitorsTwo/hashed.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Ok, after this, why not trying login with our friend &lt;em&gt;Marcus&lt;/em&gt;? Voilá, it worked and now the user path is concluded.&lt;/p&gt;

&lt;p&gt;With &lt;em&gt;Marcus&lt;/em&gt; shell and &lt;em&gt;www-data&lt;/em&gt; shell, we have two shells. Two monitors??&lt;/p&gt;

&lt;p&gt;With the user shell, Linpeas.sh was again executed and docker was really in the spotlight. After some google an interesting Docker engine (Moby) vulnerability came to my attention: Moby Docker Engine PrivEsc (CVE-2021-41091).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;CVE-2021-41091 is a flaw in Moby (Docker Engine) that allows unprivileged Linux users to traverse and execute programs within the data directory (usually located at /var/lib/docker) due to improperly restricted permissions. This vulnerability is present when containers contain executable programs with extended permissions, such as setuid. Unprivileged Linux users can then discover and execute those programs, as well as modify files if the UID of the user on the host matches the file owner or group inside the container.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let’s try this then. First on the initial shell:
&lt;img src=&quot;/assets/images/MonitorsTwo/capabilities.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And then, on the second shell (Marcus):
&lt;img src=&quot;/assets/images/MonitorsTwo/root.jpg&quot; alt=&quot;Markdowm Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Another crazyyyy rideeeeeeeeeeeee :)&lt;/p&gt;</content><author><name>td00k</name></author><category term="blog" /><category term="infosec" /><category term="hackthebox" /><summary type="html">Monitors Two - are we going to need two monitors? Or two shells?</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://td00k.github.io//assets/images/MonitorsTwo/MonitorsTwo_1.jpg" /><media:content medium="image" url="https://td00k.github.io//assets/images/MonitorsTwo/MonitorsTwo_1.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>