CTF - Kioptrix Level 3 - Walkthrough Step by Step - Yeah Hub
CTF - Kioptrix Level 3 - Walkthrough Step by Step - Yeah Hub
com/ctf-kioptrix-level-3-walkthrough/
Chơi game v
Facebook Gaming trên m
ngay.
Facebook®
1 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
CTF CHALLENGES
Kioptrix: Level 1.2 (Level 3) is the third VM of the Kioptrix series which can be found here. The kioptrix
VMs are intended for anyone who wants to start getting into pentesting or want to pursue the OSCP
exam.
Size – 452MB
Start your Kioptrix 1.2 Machine in your Vmware and run the netdiscover tool from your Kali Linux
machine.
2 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
You’ll get the complete list of all hosts attached to your network. So your Target IP of machine Kioptrix
is 192.168.36.131.
Important thing with this challenge. Once you find the IP (DHCP Client) edit your hosts file and point it
to kioptrix3.com
There’s a web application involved, so to have everything nice and properly displayed you really need to
this.
Type the following command to edit the host file and add the following piece of code into it.
Once we open up and edit the hosts file, make sure it looks similar to below:
127.0.0.1 localhost
127.0.0.1 kali
192.168.36.131 kioptrix3.com
If you are using windows, then the host file path is C:\Windows\System32\drivers\etc\hosts.
3 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
Let’s run Nmap to see what ports/services are open on running Kioptrix VM.
From above output, you can see that Only Port 80 and Port 22 are open. Port 80 is used by HTTP
Service with Apache 2.2.8 version and Port 22 is used by SSH with OpenSSH 4.7p1 version.
So let’s go ahead and browse to the website by entering the IP address of the machine in our browser
i.e. http://192.168.36.131/.
4 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
It seems to be a dynamic application running on Port 80 with one blog page and a login page.
Let’s start nikto to see if we can’t find any misconfigurations and vulnerabilities.
Phpmyadmin was the first thing where we stucked by first look – used for DB Management located at
http://192.168.36.131/phpmyadmin/.
Later on what we’ll see with Phpmyadmin, let’s more explore the web application. So Under Blog page,
we found one more interesting link i.e. http://kioptrix3.com/gallery
5 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
After browsing that album page we saw that in one of the links we were able to sort the photos by
certain values.
6 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
The thing that really caught our eye here was the “id” parameter in the URL. So we attempted to inject
a single quote ( ‘ ) to try and see if the application was vulnerable to SQL Injection.
And YES! Its vulnerable to SQL Injection because it throws the error –
“You have an error in SQL syntax, check the manual that corresponds to your MySQL server version for
the right syntax to use near ” order by parentid, sort, name” at line 1 Could not select category”
So your first step is to find the number of columns. The easiest way to do this is writing “order by ”
column number and we add “- -” after the number. So we are going to inject a query for getting the
error. Now, what we do is arrange all the columns in order.
7 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
We will do this until it shows up in the unknown columns. If it shows the unknown column error on N,
that means it has the total number of Columns N-1 because it shows the content in order by N-1 so in
this case, the number of columns are 6.
Now that we have the number of columns we need to get the column numbers that we can grab
information from. We can do that by adding a “–” before the “1” replacing the “order by #” with “union
all select” and columns number.
Our link should look like that: http://kioptrix2.com/gallery/gallery.php?id=-1 union all select
1,2,3,4,5,6–
8 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
We found that column 2 and 3 are vulnerable so we will use them to get the database version and
some other information like username etc. We can find other information by using a few things. One
thing every person should keep in mind is: The more information you have, the more powerful you will
be.
Let’s take column 3, so our link should look like that: http://kioptrix3.com/gallery/gallery.php?id=-1
union all select 1,@@version,database(),4,5,6–
In our case we got 5.0.51a-3ubuntu5.4 so we can continue to enumerate table names. If the version of
SQL is more than 5.0.0, it means it has the schema.
9 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
To do it we need to replace database() with group_concat(table_name) and add after the last columns
number from information_schema.tables where table_schema=database() and add the “–” in the
end .
Nice! We now are able to see all the tables stored in the database! The dev_accounts looks really
promising, let’s go ahead and see if we can”t find out the columns contained in that table.
The CHAR() section in the SQL Query is actually the dev_accounts table name. This needs to be done
otherwise the SQL Query will fail.
Here we’ve converted the dev_accounts text into ASCII format with the help of “http://www.unit-
conversion.info/texttools/ascii/” website and added “table_name=char(100, 101, 118, 95, 97, 99, 99,
111, 117, 110, 116, 115)–” at the end of the URL.
10 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
Our final attack is to get the data because we have table name, columns name, and database name.
Now we search for the columns named “username” and “password“.
Remove everything after the 1 and add: “from dev_accounts–” And replace
“group_concat(column_name)” with “group_concat(username,0x3a,password)“.
Here, 0x3a is the ASCII value of a ( : ) so we can separate the username from the password and our final
URL will be: http://kioptrix3.com/gallery/gallery.php?id=-1 union select
1,group_concat(username,0x3a,password),3,4,5,6 FROM dev_accounts–
dreg:0d3eccfb887aabd50f243b3f155c0f85, loneferret:5badcaf789d3d1d09794d8f021f40f0e
11 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
You can also use a ready-made SQL Exploitation tool for breaking into DB called as SQLMAP.
Now next step is to crack the Hashes with the help of MD5 Decrypter.
12 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
Furthermore, you can also use “hash-identifier” tool to verify the hash type whether its MD5, SHA1 or
any other.
To Crack the hash, you can also use hashcat tool which is pre-installed in Kali Linux machine.
And run the following command to crack the hashes with HASHCAT.
13 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
Let’s SSH into the Kioptrix Machine with our newly found credentials with user loneferret.
14 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
Okay, at this point we need to escalate our privileges to root! we already did some initial
reconnaissance of the Kioptrix Machine via SSH and stumbled across the following.
The file CompanyPolicy.README seems to be interesting file, Let’s view the contents of this file with
the help of CAT command.
It seemed that the user we were currently logged in as had sudo permissions to the xterm-256color
text editor. Initially, we can attempt to edit the /etc/sudoers file so we can elevate our privileges – so
let’s do just that!
If for some reason you get an error when trying to run sudo ht then just export xtrem-color as a TERM
like we did below.
15 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
From here press ALT+, then with your arrow keys navigate to Open, and then press Enter.
Once you press Open, you will be promoted to enter a file name. Type in /etc/sudoers to open the
sudoers file for editing.
16 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
After the file is open, let’s add /bin/sh right after /usr/local/bin/ht, and don’t forget the comma!
Once you did that press ALF+F > Save > then CTRL+Z to exit.
17 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
WOW! you logged in but it only shows information_schema database which is no use for us.
18 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
And finally type run to start the exploit and Bingo! 1 Shell Session has been opened.
19 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
Here the interesting file is gconfig.php which seems to be a database configuration file having DB
username and DB password.
20 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
Now you’ve full access to the Database section through which you can add/manage/delete any user.
Tagged ctf challeneges, ctf kioptrix level 3, ctf kioptrix level 3 walkthrough, ctf writeups, kioptrix series, kioptrix walkthrough,
vulnhub challenge, vulnhub writeups, vulnhun walkthrough
H4ck0
Step by step hacking tutorials about wireless cracking, kali linux, metasploit, ethical
hacking, seo tips and tricks, malware analysis and scanning.
https://www.yeahhub.com/
21 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
RELATED ARTICLES
Search … Search
RECENT ARTICLES
Virtual Numbers: Why It’s The Next Big Thing In Every Industry
22 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
23 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
24 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
Snuggle up to H
Stress less. Sleep soundly.
Now 30% o�.
Headspace
Snuggle up to H
Stress less. Sleep soundly.
Now 30% o�.
Headspace
DISCLAIMER
25 of 26 5/13/2021, 4:30 PM
CTF – Kioptrix Level 3 – Walkthrough step by step - Yeah Hub https://www.yeahhub.com/ctf-kioptrix-level-3-walkthrough/
Yeahhub.com does not represent or endorse the accuracy or reliability of any information’s, content or advertisements
contained on, distributed through, or linked, downloaded or accessed from any of the services contained on this
website, nor the quality of any products, information’s or any other material displayed,purchased, or obtained by you
as a result of an advertisement or any other information’s or offer in or in connection with the services herein.
RECENT COMMENTS
web root on Top 20 High Profile Creation Backlink Sites – 2018 Update
LATEST ARTICLES
26 of 26 5/13/2021, 4:30 PM