{"id":109,"date":"2017-04-22T03:08:16","date_gmt":"2017-04-22T03:08:16","guid":{"rendered":"http:\/\/kibilogic.com\/?p=109"},"modified":"2017-04-22T14:36:10","modified_gmt":"2017-04-22T14:36:10","slug":"sickos-1-1-vulnhub-challenge","status":"publish","type":"post","link":"https:\/\/kibilogic.com\/?p=109","title":{"rendered":"Sickos 1.1 &#8211; vulnhub challenge"},"content":{"rendered":"<p>After reading quite a few <a href=\"https:\/\/www.offensive-security.com\/information-security-certifications\/oscp-offensive-security-certified-professional\/\">OSCP <\/a>reviews, I have decided that I should take some time and start plugging away at some challenges. OSCP is a hands-on certification unlike the other certs out there, and I feel like I should immerse myself into preparing as much as I can before I sign on for it. <\/p>\n<p>I\u2019m setting a goal of a minimum of 10 <a href=\"https:\/\/www.vulnhub.com\/\">vulnhub<\/a> challenges before I make the plunge with the expectation that I will do considerably more than the minimum. <\/p>\n<p>The OSCP does not necessarily make any assumptions or require any experience but I\u2019ve read enough and heard first hand that it is not a \u201cwalk in the park\u201d and with a mantra of \u201ctry harder\u201d when you hit a bump in the road, I want to at least start off with some challenges beforehand.<\/p>\n<p>I start things off with sickos 1.1 and these are my notes. The final part of OSCP is a writeup, so for each challenge I do, I plan to conclude with a writeup. <\/p>\n<p>This is all about preparing for the OSCP.<\/p>\n<p>Here goes.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>The first thing I do is find the machine on my network. <\/p>\n<p>nmap -sS -O 192.168.1.0\/24<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nmapScan1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nmapScan1-300x109.png\" alt=\"\" width=\"300\" height=\"109\" class=\"alignnone size-medium wp-image-144\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nmapScan1-300x109.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nmapScan1.png 623w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Found the machine, now I need to know more about the software and versions.<\/p>\n<p>nmap -A -T4 -p- 192.168.1.4<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nmapScan2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nmapScan2-300x175.png\" alt=\"\" width=\"300\" height=\"175\" class=\"alignnone size-medium wp-image-145\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nmapScan2-300x175.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nmapScan2-768x448.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nmapScan2.png 792w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>At this point, I use nikto to see if it can help with identifying known vulnerabilities. <\/p>\n<p>nikto -h 192.168.1.4 -useproxy http:\/\/192.168.1.4:3128<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nikto.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nikto-300x82.png\" alt=\"\" width=\"300\" height=\"82\" class=\"alignnone size-medium wp-image-146\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nikto-300x82.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nikto-768x210.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/nikto.png 817w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Great, I know that OpenSSH (port 22) and Squid HTTP Proxy (port 3128) are running and the OS is a version of linux (3.2 -4.4)<\/p>\n<p>There is also a robots.txt file and a possible shellshock vulnerability in  \/cgi-bin\/status.<\/p>\n<p>First thing I look at is the robots.txt file<\/p>\n<p>I configure the browser (ice weasel) to use manual proxy 192.168.1.4 port 3128<\/p>\n<p>Then navigate to 192.168.1.4\/robots.txt in the browser.<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/robotstxt.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/robotstxt.png\" alt=\"\" width=\"291\" height=\"236\" class=\"alignnone size-full wp-image-113\" \/><\/a> <\/p>\n<p>I see there is a reference to wolfcms and I navigate to 192.168.1.4\/wolfcms in the browser.<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcms.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcms-300x261.png\" alt=\"\" width=\"300\" height=\"261\" class=\"alignnone size-medium wp-image-114\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcms-300x261.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcms.png 680w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I have no idea what wolfcms is or does but I see things are posted by the Administrator.<\/p>\n<p>I do a google search \u201cwolf cms admin\u201d and the first thing to pop up is this:<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcmsSearch.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcmsSearch-300x195.png\" alt=\"\" width=\"300\" height=\"195\" class=\"alignnone size-medium wp-image-115\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcmsSearch-300x195.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcmsSearch-768x499.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcmsSearch.png 789w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a> <\/p>\n<p>I immediately find that there are a couple of suggestions related to getting the admin link, \/admin and \/?admin. <\/p>\n<p>I try both and turns out that the \/?admin worked. <\/p>\n<p>I now have the admin login page<\/p>\n<p> <a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfAdminLogin.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfAdminLogin-300x162.png\" alt=\"\" width=\"300\" height=\"162\" class=\"alignnone size-medium wp-image-116\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfAdminLogin-300x162.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfAdminLogin-768x415.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfAdminLogin.png 940w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The username and password default password was admin\/admin\u2026this was a guess based on the information and multiple warnings about changing the admin password.<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/adminURL.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/adminURL-300x178.png\" alt=\"\" width=\"300\" height=\"178\" class=\"alignnone size-medium wp-image-117\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/adminURL-300x178.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/adminURL-768x455.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/adminURL.png 794w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The admin:admin works and I browse through all four tabs. <\/p>\n<p>I notice that in the final &#8220;files&#8221; tab (green tab) it allows for uploading files.  <\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfadmin.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfadmin-300x76.png\" alt=\"\" width=\"300\" height=\"76\" class=\"alignnone size-medium wp-image-120\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfadmin-300x76.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfadmin-768x193.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfadmin-1024x258.png 1024w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfadmin.png 1433w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Wolfcms runs php and I have upload access. Let\u2019s see if I can some how get a reverse shell. <\/p>\n<p>Using metasploit is my first thought but from what I read the OSCP cert provides limitation for using it. <\/p>\n<p>I need to do as much without metasploit. I don&#8217;t want to handicap myself. <\/p>\n<p>So, a script it is.<\/p>\n<p>I go with php-reverse-shell, a script that can be uploaded to a web server running php.\u00a0<\/p>\n<p>The script opens an outbound TCP connection from the webserver to a host and port of your choice and bounds to the TCP connection for an interactive shell. <\/p>\n<p>Using <a href=\"http:\/\/pentestmonkey.net\/tools\/web-shells\/php-reverse-shell\">Pentestmonkey\u2019s php-reverse-shell<\/a>, I upload the file and make the necessary changes as indicated (&#8220;CHANGE THIS&#8221;). <\/p>\n<p>I only changed the ip address to my (attacker) machine, I left the port as 1234.<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/phpReverseShell.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/phpReverseShell-300x184.png\" alt=\"\" width=\"300\" height=\"184\" class=\"alignnone size-medium wp-image-119\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/phpReverseShell-300x184.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/phpReverseShell.png 395w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a> <\/p>\n<p>I changed the permissions on the php file from 644 to 777 for everyone.<\/p>\n<p> <a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/phpPermissions.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/phpPermissions-300x209.png\" alt=\"\" width=\"300\" height=\"209\" class=\"alignnone size-medium wp-image-118\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/phpPermissions-300x209.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/phpPermissions.png 667w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>On my machine, I set up netcat to listen for a connection<\/p>\n<p>nc -lvp 1234<\/p>\n<p>I searched to see where the php file was uploaded.<\/p>\n<p>find . -name php-reverse-shell.php <\/p>\n<p>I run the reverse-shell script by navigating to its location in the browser<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcmsLaunchReverseShell.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcmsLaunchReverseShell-300x70.png\" alt=\"\" width=\"300\" height=\"70\" class=\"alignnone size-medium wp-image-121\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcmsLaunchReverseShell-300x70.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcmsLaunchReverseShell-768x179.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/wolfcmsLaunchReverseShell.png 813w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a> <\/p>\n<p>That works. <\/p>\n<p> <a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/reverseShellListener.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/reverseShellListener-300x112.png\" alt=\"\" width=\"300\" height=\"112\" class=\"alignnone size-medium wp-image-122\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/reverseShellListener-300x112.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/reverseShellListener.png 497w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I\u2019m in, now I start looking into how I might escalate the privileges<\/p>\n<p>I check for other user accounts on the machine<\/p>\n<p>\tcat \/etc\/passwd<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/catEtcPasswd.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/catEtcPasswd-300x198.png\" alt=\"\" width=\"300\" height=\"198\" class=\"alignnone size-medium wp-image-142\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/catEtcPasswd-300x198.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/catEtcPasswd.png 720w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I check to see if there are any interesting files (configuration, php, etc) related to wolfcms.<\/p>\n<p>Generally, the root directory for web servers is located in the \/var\/www directory. <\/p>\n<p>\tls -l \/var\/www<br \/>\n        ls -l \/var\/www\/wolfcms<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/lsVarWWW.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/lsVarWWW-300x130.png\" alt=\"\" width=\"300\" height=\"130\" class=\"alignnone size-medium wp-image-123\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/lsVarWWW-300x130.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/lsVarWWW.png 537w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I check to see what services are running as root<\/p>\n<p>ps aux | grep root<\/p>\n<p>I check to see what applications are installed.<\/p>\n<p>\tls -alh \/usr\/bin<\/p>\n<p>I check to see if there are any cron jobs scheduled<\/p>\n<p>\tcrontab -l<br \/>\n\tls -al \/etc\/ | grep cron<\/p>\n<p>After enumerating these things, I focus on the users &#8220;root&#8221; and &#8220;sickos&#8221;.<\/p>\n<p>From listing the services I know that ssh is available.<\/p>\n<p>One of the interesting files in the \/var\/www\/wolfcms directory ended up being a config.php with what appeared to be login information<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/john123.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/john123-300x129.png\" alt=\"\" width=\"300\" height=\"129\" class=\"alignnone size-medium wp-image-124\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/john123-300x129.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/john123.png 606w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Armed with this information, I tried to ssh in from my machine.<\/p>\n<p>ssh root@192.168.1.4 didn\u2019t work<\/p>\n<p>But ssh sickos@192.168.1.4 did with the password john@123<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/sshSickos.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/sshSickos-300x32.png\" alt=\"\" width=\"300\" height=\"32\" class=\"alignnone size-medium wp-image-125\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/sshSickos-300x32.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/sshSickos-768x81.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/sshSickos.png 813w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I quickly check to see if the user &#8220;sickos&#8221; has sudo privileges<\/p>\n<p>\tsudo -l<\/p>\n<p>Yep, feeling excited. I logged in as root.<\/p>\n<p>\tsudo -s<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/sudoRoot.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/sudoRoot-300x59.png\" alt=\"\" width=\"300\" height=\"59\" class=\"alignnone size-medium wp-image-126\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/sudoRoot-300x59.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/sudoRoot.png 372w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>And with that, I navigated to the \/root directory and viola!<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/winning.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/winning-300x125.png\" alt=\"\" width=\"300\" height=\"125\" class=\"alignnone size-medium wp-image-127\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/winning-300x125.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2017\/04\/winning.png 571w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I went with the lowest hanging fruit but considering that there is a shellshock vulnerability, I&#8217;m guessing that is another path. I also found a connect.py file that could be yet another option. But this worked first. I will plan to revisit this again at some time to see where the others lead. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>After reading quite a few OSCP reviews, I have decided that I should take some time and start plugging away at some challenges. OSCP is a hands-on certification unlike the other certs out there, and I feel like I should immerse myself into preparing as much as I can before I sign on for it. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[8],"tags":[],"class_list":["post-109","post","type-post","status-publish","format-standard","hentry","category-pentesting"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"bridgette","author_link":"https:\/\/kibilogic.com\/?author=1"},"uagb_comment_info":9,"uagb_excerpt":"After reading quite a few OSCP reviews, I have decided that I should take some time and start plugging away at some challenges. OSCP is a hands-on certification unlike the other certs out there, and I feel like I should immerse myself into preparing as much as I can before I sign on for it.&hellip;","_links":{"self":[{"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/posts\/109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kibilogic.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=109"}],"version-history":[{"count":36,"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/posts\/109\/revisions"}],"predecessor-version":[{"id":139,"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/posts\/109\/revisions\/139"}],"wp:attachment":[{"href":"https:\/\/kibilogic.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kibilogic.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kibilogic.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}