<?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 Gladwin Mohlamonyane on Medium]]></title>
        <description><![CDATA[Stories by Gladwin Mohlamonyane on Medium]]></description>
        <link>https://medium.com/@g.mohlamonyane?source=rss-1c79c0e9b729------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*s_CrpoeYpWbhPjU7.</url>
            <title>Stories by Gladwin Mohlamonyane on Medium</title>
            <link>https://medium.com/@g.mohlamonyane?source=rss-1c79c0e9b729------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 15:05:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@g.mohlamonyane/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[A journey up the SkyTower]]></title>
            <link>https://medium.com/@g.mohlamonyane/a-journey-up-the-skytower-1d40194f1540?source=rss-1c79c0e9b729------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d40194f1540</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[sudoers]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[sql-injection]]></category>
            <dc:creator><![CDATA[Gladwin Mohlamonyane]]></dc:creator>
            <pubDate>Thu, 26 Mar 2020 12:23:13 GMT</pubDate>
            <atom:updated>2020-03-26T12:56:05.615Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1jfr7CwxXF5C9wEC-vG8rA.jpeg" /><figcaption>Bet the view is nice up there</figcaption></figure><p>I’ve been training under F-Secure as an associate information security consultant for a few months now and figured that documenting my learning progress would be a good idea, this was also highly encouraged by my mentor and trainer. A very good resource for learning and testing your skills are the virtual machines you can find on <a href="https://www.vulnhub.com/">vulnhub</a>.</p><p>Vulnhub offers a plethora of vulnerable virtual machines for penetration testers to hone their skills through.</p><p>SkyTower is the first walk through I will be publishing through Medium; however, this will only be the first of many.</p><p>I will be using VirtualBox to host both my testing host and the SkyTower virtual machine. They will both interact through an host only network that I have setup through VirtualBox.</p><p>Both the test VM and the target VM(SkyTower) need to be on the same network to communicate. It is advised that the network that your challenge VM is on does have internet access.</p><p>To know how to interact with the target we need to find its IP address on our network and enumerate services that are externally exposed by it. There are two Nmap commands to run that will achieve this, the first being a host discovery scan that will help us find the target and the second being a port scan on the discovered host to enumerate the exposed services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*WW6Chfzn_6c-_hNyFIC56w.png" /><figcaption>host discovery</figcaption></figure><p>The first scan uses ICMP packets to get a response from the different hosts on the network without scanning their ports, this helps us because we will know which host is up if it responds to the packet saving us time by only confirming that a host is up.</p><p>There are only three hosts on my network with the first being the router. We can identify the target by finding out our IP on this network through the use of a command such as <strong>ip addr </strong>or <strong>ifconfig</strong>. These commands will list your network interfaces and the IP addresses our host is associated with on their respective networks.</p><p>The next command to run will inform us on the exposed ports/services on the host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*1CpBxSXYcWlHtzZ1ECe3GA.png" /><figcaption>port scan</figcaption></figure><p>The output tells us that there are two open services and one that is filtered. We can interact with the open services directly through tools such as the browser, BurpSuite, curl and proxychains.</p><p>We can see what the website being served on port 80 will give us through the browser by entering the target IP address into the browser or giving the IP a name to resolve to through the <strong>/etc/hosts</strong> file and entering that name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*qWiWY6dW3nHdaIQqNoCMZA.png" /><figcaption>The Skytech login page</figcaption></figure><p>When visiting the hosted website, we a greeted by a login page. Since we don’t have anything else that was interesting, the first thing to do is to check if this web page is vulnerable to an SQL or NoSQL injection attack.</p><p>BurpSuite will be used to intercept requests we make on the browser to the application. This will help us change our requests and monitor the different responses we get from the application.</p><p>We will first try to insert a single quotation mark into the email field while the browser is set up to use BurpSuite as its proxy. Once we submit the request it is sent to BurpSuite first where we can see or modify it and then send it to its intended destination.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*eAKNTBZ4gwlLvgMhfoVAxg.png" /><figcaption>SQL Injection test</figcaption></figure><p>The application responds with an error proving our theory of it being vulnerable to an injection attack. We can assume what the SQL query we are injecting might actually look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*OKjuqUkay_4kllA3JwWWow.png" /><figcaption>SQL Injection Error Response</figcaption></figure><p>Based on the error we received, we are given some information on the query and the SQL server we are injecting into. The error message informs us that we are working with a MySQL server and that our query is similar to:</p><blockquote>SELECT user FROM table WHERE email=’email’ AND password=’password’;</blockquote><p>This query is vulnerable and we will exploit this vulnerability by injecting into the email parameter by commenting out its closing quote and adding anything that will resolve to true in the password paramter.</p><p>The resulting query should look like the following:</p><blockquote>SELECT user FROM table WHERE email=’<strong>\’ AND password=</strong>’-’’;</blockquote><p>The bold text is part of the email parameter. This means that the sub string “AND password” has become part of the email parameter. The value of the password parameter is set to a line comment followed by a closing quotation.</p><p>The value for the password parameter we can use must be either a minus, addition or multiplication symbol. This works because we are performing arithmetic on the two strings and they resolve to something similar to <strong>True</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*PmGtE5benfD-a1NArM0qhw.png" /><figcaption>SQL Injection Success</figcaption></figure><p>The response from a successful injection resulted in the the disclosure of the first user’s ssh credentials on the server. The only problem now is figuring out how to interact with the ssh server. During our port scan of the target, the ssh server’s port was filtered meaning that we probably would not be able to connect to it directly.</p><p>The proxy server on port 3128 could help with the discovery of services on the target from the perspective of the proxy. We can use proxychains to help us interact with the proxy and run network commands on the target, this is simply a matter of configuring proxychains to use the proxy through its configuration file.</p><p>Once proxychains is setup, you’ll notice that you can’t use programs like nmap with it because of the actual request being made by nmap over proxychains. Squid proxy will reject a request with the CONNECT method unless it is followed by an authentication attempt.</p><p>Squid proxy does let us authenticate through ssh and we can execute commands through it as well. The next command to run is to attempt to connect to the target through ssh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*k7KcPPL6BfeB-zd78-CRlQ.png" /><figcaption>authenticated as John</figcaption></figure><p>Using the credentials we were given through the SQL injection exploit, we are able to authenticate to the server and have a shell instance. This is because we ran <strong>/bin/sh</strong> in interactive mode, meaning that the command is still active and we are able to execute other commands on the server.</p><p>Once a shell instance was gained on the server we can investigate possible methods of privilege escalation and in doing so we find that the MySQL server allows for authentication as the root user with the default password root. Using this, we are able to extract information from the database such as the login credentials of the other users on the table being used for the web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*QHeJOcuVMWsV3i9OSCB88g.png" /><figcaption>Getting user credentials</figcaption></figure><p>We now have credentials for another user and can ssh to the target as that user. This will allow us to see what the other user is capable of doing and seeing on the host.</p><p>We’ll attempt to login as Sara and see what she can do by using the <strong>sudo -l</strong> command to see if her account can perform any tasks as the root user without providing a password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*gr39tYiM4L21iFXX9IJu3g.png" /><figcaption>Sara’s sudo commands</figcaption></figure><p>The commands that the user sara can perform as root are that she can list files and print the contents of any file to the standard output. The problem is that her commands are rather specific. She can list the files in the <strong>/accounts </strong>directory and she can print the contents of files in that directory; however, she can not just use the cat or ls command directly as root.</p><p>This is not a problem however, because we can append an argument after the required strings. This means that if we wanted to print the contents of the shadow file we would have to add the path of the shadow file as an argument after the accounts directory argument.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*a6B0sxtBXniGhDDMXI9t6Q.png" /><figcaption>shadow file contents</figcaption></figure><p>Being able to print the contents of the shadow file is something only root can do. We can now use both of the commands she can perform as the root user to look into the <strong>/root/ </strong>directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*coZ6MnuLJThVFbdTqcAM1Q.png" /><figcaption>read the root flag</figcaption></figure><p>Using these commands, we successfully listed the files in the root users directory and we managed to print the contents of the flag.</p><p>The last step is to see if the flag is legitimate. We will use ssh over proxychains yet again and provide the credentials for root that we were given through sara’s account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*Tt3bp48KmdM19DUKsANKOA.png" /><figcaption>root</figcaption></figure><p>The credentials in the flag are legitimate and we have completed the task of obtaining root on the target.</p><p>To end things off, this is only the first challenge VM I will post a walkthrough for. I will try to be more active and put more material on this platform to improve my skills and hopefully help others who might be going on the same journey as myself.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d40194f1540" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>