Skip to content

Commit 3538b84

Browse files
committed
Try to make a better check
1 parent 6e2d297 commit 3538b84

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

modules/auxiliary/scanner/http/apache_mod_cgi_bash_env.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,24 @@ def check_host(ip)
5858
:refs => self.references
5959
)
6060
Exploit::CheckCode::Vulnerable
61+
elsif res
62+
injected_res_code = res.code
6163
else
62-
Exploit::CheckCode::Safe
64+
Exploit::CheckCode::Unknown
6365
end
66+
67+
res = send_request_cgi({
68+
'method' => datastore['METHOD'],
69+
'uri' => normalize_uri(target_uri.path.to_s)
70+
})
71+
72+
if res && injected_res_code == res.code
73+
return Exploit::CheckCode::Safe
74+
elsif res && injected_res_code != res.code
75+
return Exploit::CheckCode::Appears
76+
end
77+
78+
Exploit::CheckCode::Unknown
6479
end
6580

6681
def run_host(ip)

modules/exploits/multi/http/apache_mod_cgi_bash_env_exec.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,25 @@ def check
6969
res = req("echo #{marker}")
7070

7171
if res && res.body.include?(marker * 3)
72-
Exploit::CheckCode::Vulnerable
72+
return Exploit::CheckCode::Vulnerable
73+
elsif res
74+
injected_res_code = res.code
7375
else
74-
Exploit::CheckCode::Safe
76+
return Exploit::CheckCode::Unknown
7577
end
78+
79+
res = send_request_cgi({
80+
'method' => datastore['METHOD'],
81+
'uri' => normalize_uri(target_uri.path.to_s)
82+
})
83+
84+
if res && injected_res_code == res.code
85+
return Exploit::CheckCode::Safe
86+
elsif res && injected_res_code != res.code
87+
return Exploit::CheckCode::Appears
88+
end
89+
90+
Exploit::CheckCode::Unknown
7691
end
7792

7893
def exploit

0 commit comments

Comments
 (0)