<?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 DRDohvaken on Medium]]></title>
        <description><![CDATA[Stories by DRDohvaken on Medium]]></description>
        <link>https://medium.com/@drdohvaken?source=rss-de87559b11a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BuP2tEZoCtmOFSEdcPvh-A.jpeg</url>
            <title>Stories by DRDohvaken on Medium</title>
            <link>https://medium.com/@drdohvaken?source=rss-de87559b11a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:57:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@drdohvaken/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[Hack The Box — Previse]]></title>
            <link>https://medium.com/@drdohvaken/hack-the-box-previse-26e3ffa11769?source=rss-de87559b11a------2</link>
            <guid isPermaLink="false">https://medium.com/p/26e3ffa11769</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[previse]]></category>
            <dc:creator><![CDATA[DRDohvaken]]></dc:creator>
            <pubDate>Fri, 15 Apr 2022 08:24:22 GMT</pubDate>
            <atom:updated>2022-04-15T08:31:50.653Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack The Box — Previse</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*OVBYXZXS9ZhoH4kX" /></figure><p><strong>Introduction</strong></p><p>This is the 1st of what I hope will be at least a bi-weekly series of blogs. Although this will be a hard journey, my thirst for knowledge will allow me to progress both in my career and personally.</p><p>My first post is on the Previse machine, which is considered Easy within HTB.</p><p>HTB otherwise known as Hack the Box is an online training platform for penetration testing practice using gamified machines to essentially ‘hack’.</p><p>I have attempted to make it as understandable as I could, it will improve over time as my skills in both blogging and pen testing do.</p><p>Without further ado, let’s go.</p><p><strong>Start-Up</strong></p><p>Assigned 10.10.11.104 to previse.htb within the /etc/hosts file. Meaning that the local machine associates previse.htb to the IP address 10.10.11.104, before the DNS (Domain Name System) is referenced.</p><p><strong>Enumeration</strong></p><p>To start off I used nmap to scan the IP address.</p><p>Nmap — A network scanner used to discover hosts and services on a computer network by sending packets and analysing the responses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/0*_iLUvSvdZ_ibKf3W" /></figure><p>sV — This perimeter is used to detect the service and version running on the different discovered ports.</p><p>Based off of the nmap scan, I determined that a web server was being hosted. This is due to ports 22 and 80 being open.</p><p>Port 22 — Secure Socket Shell (SSH), used for remote login and command-line execution.<br>Port 80 —Hyper Text Transfer Protocol (HTTP), used for communication between web servers and web browsers.</p><p>Using <a href="https://www.exploit-db.com/">https://www.exploit-db.com/</a> I determined whether any of the versions of the services were vulnerable. I was unable to find anything.</p><p>I decided to enumerate the web server.</p><p>The index page of the host redirected me to login.php.</p><p>Viewing the source code of the login.php gave me the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qthV-klr9UNeFMdE" /></figure><p>I was unable to find any interesting information that may be helpful. Due to the fact that the index page of the web server automatically directed me to the login.php page, I attempted to curl directly to it instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/0*_BKTugyleLu85bbf" /></figure><p><strong>Exploitation</strong></p><p>Based off of the response from the web server, I examined an accounts.php file. Lets try access this.</p><p>Using burpsuite and in the inbuilt browser I attempted to connect to the login.php page. I was able to send the request to the repeater to get the correct format:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/0*ejjI4N6D84QPjKOI" /></figure><p>From here I tried GET to the accounts.php page. I receive the following response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/0*bYaUVnIXZcycwgW1" /></figure><p>GET — A request set to the server by the web client when requesting data.<br>POST — A request set to the server by the web client when sending data.</p><p>It looks like it accepts username and passwords.</p><p>I made sure to change GET /login.php to POST /login.php as I am sending data.</p><p>Examining the code I was able to find the fields in which it wants a username, password and confirm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/0*yVLg4jPgGbLvOM1t" /></figure><p>I added these to my request. Using the body parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/0*19cjjNRqIwbsYGOr" /></figure><p>I sent the request. SUCCESS. Account created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/0*sl9XoGjNu1XWKHxM" /></figure><p>From here I can try access the login and access some of the uploaded files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dnsDVwrq3Ov6bIU6" /></figure><p>I downloaded the sitebackup.zip to examine the source code of the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/0*wb6A88c7HoNWDL-2" /></figure><p>I’ll check the config.php file first.</p><p>Looks like I have the root user. Possibly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/0*a3kN_o82E9beWg0V" /></figure><p>I decide to keep looking if there is anything else.</p><p>In the logs.php file I found an interesting section of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/0*zuZX8C2ReHv0uAD4" /></figure><p>Looks like it is used to execute code. I’ll try send a POST request to logs.php using burp.</p><p>Using the browser in burp, I logged into the user I created and then attempted to access logs.php.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/0*SCm9EJueEiEpWV0r" /></figure><p>I sent the request to the repeater and see that it was successful. From the previous code examination I could see that the ‘delim’ parameter is used.</p><p>I am going to try create a reverse payload using netcat. I use the following to listen to port 4444 on my attacking machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/0*g4ovLFw-nviwEAZP" /></figure><p>Netcat — Networking tool used for reading from and writing to network connections using TCP or UDP.<br>TCP — Transmission Control Protocol, a communications standard that enables applications and devices to exchange messages over a network. It is designed to ensure the successful delivery of data and messages over the network. <br>UDP — User Datagram Protocol, a communications standard similar to TCP. However it is focused on establishing low-latency connections. This is done by not checking whether previous data sent had been received (which TCP does) using agreements between the communicating devices/applications.</p><p>I attempted it from here but I was using the wrong logs page. I needed to access file_logs.php from the dashboard. I found the GET request the same way.</p><p>I attempted the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/0*AJKD8mQQOCVQ4n31" /></figure><p>However examining the log code again and the page, it seemed like I had to choose one of the 3 options. I chose comma. As a delimiter had to be used.</p><p>However I found that I was POSTing to the wrong location, I was originally in the right location. The log file.</p><p>I had to submit a POST request using the log file to get the correct information within the repeater. Then I changed the delim again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cuu-lcCkQdRp5nf2" /></figure><p>As you can see above I was able to receive a ping on my tcpdump. Thus I can execute code on the host. I will now try to receive a reverse shell.</p><p>tcpdump — Analyses and displays packets being transmitted or received on a host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UnNDG9e-9EmrsDs9" /></figure><p>Using python <em>python -c “import pty; pty.spawn(‘/bin/bash’)”</em> I was able to stabilise the root shell I received.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/0*WyDo-2C3gvMTjChU" /></figure><p>I then attempted to connect to the mysql database that I found the credentials for earlier.</p><p>MySQL — An open-source database system, commonly used by web servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/0*sk-F_L9zE_T6_GFO" /></figure><p>Next I found the following information in the accounts table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/0*DYTc1jdxbYuXoTSA" /></figure><p><em>$1$🧂llol$DQpmdvnb7EeuO6UaqRItf.</em></p><p>I copied the hash that I received for the m4lwhere account into a txt file. Then proceeded to use hashcat to try crack the hash.</p><p>Hash — Produced by mapping data of arbitrary length to a fixed length. This is commonly used on passwords to ensure they are not displayed in plain text. A password can be used in the hashing process to secure the password further with encryption.<br>HashCat — Password/hash cracker program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/0*uRdgaaTm577Uujty" /></figure><p>I was able to successfully crack the hash to produce the password <em>ilovecody112235!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*mqSU7s_g-g6carZJ" /></figure><p>Using su I was able to login into the m4lwhere user with the password I accessed in the last step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/219/0*SkKR8IP9-WjA_7Uv" /></figure><p>I am now m4lwhere.</p><p>Using the following I get the user.txt.</p><p>ls — Linux command to display directories and files in the current working directory.<br>cd — Command used to move the current working directory to the specified directory.<br>cat — Used to read a file into the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/0*pkmqtHrQbnIQSFM4" /></figure><p>92185a7caf20453cc1cda7d69a0311cd is the user.txt</p><p>Using sudo -l I can see what the user m4lwhere is able to execute as sudo/root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/0*sJzDWaGFNqOx8Vdg" /></figure><p>Using cat I can examine the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/0*TZfrUQ_W3s5lDhKO" /></figure><p>I was stuck here so followed the next steps from <a href="https://pingback.com/nap0/previse-writeup-hackthebox1">https://pingback.com/nap0/previse-writeup-hackthebox1</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/0*iPDHN7IokzW0aYfF" /></figure><p>From here I was granted root privilege and gained the root.txt file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*jhL7nHXUS7G1ZuuhbA-4zw.png" /></figure><p><strong>Notes</strong></p><p>This is my first ever blog post of this type, so I know that I have a lot to work on. If you would like a further in-depth walkthrough of the machine let me know. In addition, contact me if you have any questions or tips on how I can lay out my blog posts.</p><p>Thanks for reading and hopefully I am able to help at least one person out there while I am on my journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26e3ffa11769" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>