<?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"><channel><title><![CDATA[MHD </ >]]></title><description><![CDATA[Passionate about  security and automation]]></description><link>https://mhdhussein.com</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 10:11:30 GMT</lastBuildDate><atom:link href="https://mhdhussein.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Nibbles | Hack the box]]></title><description><![CDATA[Executive Summary
The administrator password was easily guessable which allows any user to gain access to the administration dashboard. Having that access the attacker can leverage the fact that the blog is running a version that is out of date. Any ...]]></description><link>https://mhdhussein.com/nibbles-hack-the-box</link><guid isPermaLink="true">https://mhdhussein.com/nibbles-hack-the-box</guid><category><![CDATA[pentesting]]></category><category><![CDATA[Write Up]]></category><category><![CDATA[#HackTheBox]]></category><category><![CDATA[hackthebox machine]]></category><dc:creator><![CDATA[Mohammed Hussain]]></dc:creator><pubDate>Sat, 30 Sep 2023 09:54:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1696020570314/2a532a7a-4a5e-4a23-a22b-501cb0a3712c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-executive-summary">Executive Summary</h2>
<p>The administrator password was easily guessable which allows any user to gain access to the administration dashboard. Having that access the attacker can leverage the fact that the blog is running a version that is out of date. Any attacker could utilize the vulnerabilities within the blog to gain access to the host running the blog and run commands on it. Moreover, the user within the server has access to run a specific file as the super admin user ( root ) which can allow the attacker to control the server with no limits.</p>
<h3 id="heading-recon">Recon</h3>
<p>first let's add the IP of the target to the host file and name it nibbles.htb</p>
<pre><code class="lang-plaintext">&lt;target-ip&gt; nibbles.htb
</code></pre>
<p>Before throwing any nmap scans at the target it is a good practice to just go to the browser and try to browse to it. this will allow us to discover if port 80 is open without making any scans.</p>
<p>Doing so shows that indeed port 80 is open and we are greeting with a simple <strong>hello world string</strong></p>
<p>doing a curl on it shows us some interesting information</p>
<pre><code class="lang-bash">curl -L http://nibbles.htb <span class="hljs-comment"># -L to follow any redirections</span>
</code></pre>
<p>we found the following comment</p>
<pre><code class="lang-html"><span class="hljs-comment">&lt;!-- /nibbleblog/ directory. Nothing interesting here! --&gt;</span>
</code></pre>
<p>going to that page we find the homepage of the nibbleblog</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1696066681974/9dc9caa2-ca3e-4d24-82b3-ec2794e8508a.png" alt class="image--center mx-auto" /></p>
<h4 id="heading-running-scans">Running scans</h4>
<p>now that we found the page lets run some scans.</p>
<ol>
<li><p>running Nmap to find other ports</p>
</li>
<li><p>scanning the site with gobuster to find interesting directories</p>
</li>
</ol>
<p><strong><em>gobuster</em></strong></p>
<p>running gobuster like</p>
<pre><code class="lang-bash">gobuster dir -u http://nibbles.htb/nibbleblog/ -w /usr/share/wordlists/dirb/common.txt
</code></pre>
<p>this shows that there is an admin.php page</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1696066725589/4bdff71b-311c-409b-a90a-88af8eb46a06.png" alt class="image--center mx-auto" /></p>
<p>Also the <em>/admin</em> path leads to showing some interesting folders that should not be visible by anyone</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1696066790459/19b9e533-3e37-46fc-a182-430fa0ea2e1f.png" alt class="image--center mx-auto" /></p>
<p>Also, there is another folder called <em>/content</em> which is interesting</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1696066805376/988750f8-e34d-4b06-b4b0-2bb7625a6be2.png" alt class="image--center mx-auto" /></p>
<p>Let's enumerate to find out if we can find any legit user names or passwords</p>
<p><strong>bingo</strong> going to the <em>/content/private</em> we found the <em>users.xml</em> file which gives us a few important clues</p>
<ol>
<li><p><em>there is a user called admin</em></p>
</li>
<li><p><em>there is a rate limit so if we try many times we will get locked out so we cannot throw hydra at it and brute force the login.</em></p>
</li>
</ol>
<p><strong>Attempting login</strong></p>
<p>I tried to manually guess the password of the admin user and we found that it is <strong><em>nibbles</em></strong></p>
<p>logging into the admin area we found that the version of nibblesblog running is <strong>4.0.3</strong></p>
<h3 id="heading-vulnerabilities">Vulnerabilities</h3>
<p>searching for this version we can quickly find that there is a file upload vulnerability <a target="_blank" href="https://www.exploit-db.com/exploits/38489">https://www.exploit-db.com/exploits/38489</a> with a metasploit module <a target="_blank" href="https://www.rapid7.com/db/modules/exploit/multi/http/nibbleblog_file_upload/">https://www.rapid7.com/db/modules/exploit/multi/http/nibbleblog_file_upload/</a></p>
<p>exploit description <a target="_blank" href="https://packetstormsecurity.com/files/133425/NibbleBlog-4.0.3-Shell-Upload.html">https://packetstormsecurity.com/files/133425/NibbleBlog-4.0.3-Shell-Upload.html</a></p>
<h4 id="heading-nmap-result">Nmap Result</h4>
<p>The Nmap scan took a while but found only 2 ports open <em>80 and 22</em> finding the service version with the default scripts we find that the target is running</p>
<pre><code class="lang-plaintext">22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.2
80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))
</code></pre>
<p><strong>Apache 2.4.18</strong> doing a searchsploit on version 2.4 we find a <strong>buffer overflow exploit on version 2.4.x</strong></p>
<pre><code class="lang-plaintext">multiple/webapps/51193.py
</code></pre>
<p><a target="_blank" href="https://www.exploit-db.com/exploits/51193">https://www.exploit-db.com/exploits/51193</a> <em>Note: this exploit requires a path to a .lua file which we don't have at the moment</em></p>
<p><strong>OpenSSH 7.2p2</strong> doing a searchsploit on openssh with this version we find a vulnerability that allows us to enumerate usernames <a target="_blank" href="https://www.exploit-db.com/exploits/40136">https://www.exploit-db.com/exploits/40136</a> we can also use metasploit module for this <a target="_blank" href="https://www.rapid7.com/db/modules/auxiliary/scanner/ssh/ssh_enumusers/">https://www.rapid7.com/db/modules/auxiliary/scanner/ssh/ssh_enumusers/</a></p>
<h3 id="heading-exploitation">Exploitation</h3>
<h5 id="heading-file-upload-vulnerability">File Upload Vulnerability</h5>
<p>Following the description in <a target="_blank" href="https://packetstormsecurity.com/files/133425/NibbleBlog-4.0.3-Shell-Upload.html">https://packetstormsecurity.com/files/133425/NibbleBlog-4.0.3-Shell-Upload.html</a></p>
<pre><code class="lang-txt">
When uploading image files via the "My image" plugin - which isdelivered with NibbleBlog by default - , NibbleBlog 4.0.3 keeps theoriginal extension of uploaded files. This extension or the actual filetype are not checked, thus it is possible to upload PHP files and gaincode execution.
</code></pre>
<p>we can utilize the php reverse shell file located in /usr/share/web-shells and updating our IP <strong>Note: the above reverse shell did not work ( the shell keeps hanging )so we utilized a simple shell with cmd and then url encoded the reverse temp shell and passed it to get a revshell</strong> address to get a shell then we can start a netcat listener in our machine</p>
<pre><code class="lang-bash">nc -lvnp 1234
</code></pre>
<p>once we visit the image.php we will get a shell now we visit</p>
<pre><code class="lang-plaintext">
http://nibbles.htb/nibbleblog/content/private/plugins/my_image/image.php
</code></pre>
<p>now we need to stabilize our shell we run</p>
<pre><code class="lang-bash"><span class="hljs-built_in">which</span> python
</code></pre>
<p>and we could not find Python on the server we run</p>
<pre><code class="lang-bash"><span class="hljs-built_in">which</span> python3
</code></pre>
<p>and bingo, it is there so we run</p>
<pre><code class="lang-bash">python3 -c <span class="hljs-string">'import pty;pty.spawn("/bin/bash")'</span>
</code></pre>
<p>and we get a better shell however we still have to do more. we click ctrl+Z to background it and then</p>
<pre><code class="lang-bash">stty raw -<span class="hljs-built_in">echo</span>; <span class="hljs-built_in">fg</span>
</code></pre>
<p>then we hit enter twice and now we have a stable shell.</p>
<h4 id="heading-local-enumaration">Local enumaration</h4>
<p>now that we are on the server we need to enumerate to find more information</p>
<p>running</p>
<pre><code class="lang-bash">whoami
</code></pre>
<p>we found that we are running as the <em>nibbler</em> user</p>
<p>we go to the home folder of <em>nibbler</em> user and we find the user.txt which contains the user flag. we can also find a zip file called <a target="_blank" href="http://personal.zip">personal.zip</a> so we unzip it.</p>
<p>Now Running</p>
<pre><code class="lang-bash">sudo -l
</code></pre>
<p>we find out that we can run <em>/home/nibbler/personal/stuff/monitor.sh</em> as root with <strong>NO Password</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1696066990938/7f5d9f1b-412a-4c62-a155-2264b12c4817.png" alt class="image--center mx-auto" /></p>
<p>Now all we have to do is add the line</p>
<pre><code class="lang-plaintext">/bin/bash
</code></pre>
<p>to <a target="_blank" href="http://monitor.sh">monitor.sh</a> and run it with sudo. it will not ask for a password and we will drop in a shell with root access.</p>
]]></content:encoded></item></channel></rss>