Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve check for BASH HTTP modules #3897

Merged
merged 3 commits into from
Sep 26, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 additions & 2 deletions modules/auxiliary/scanner/http/apache_mod_cgi_bash_env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,25 @@ def check_host(ip)
:name => self.name,
:refs => self.references
)
Exploit::CheckCode::Vulnerable
return Exploit::CheckCode::Vulnerable
elsif res && res.code == 500
injected_res_code = res.code
else
Exploit::CheckCode::Safe
return Exploit::CheckCode::Safe
end

res = send_request_cgi({
'method' => datastore['METHOD'],
'uri' => normalize_uri(target_uri.path.to_s)
})

if res && injected_res_code == res.code
return Exploit::CheckCode::Unknown
elsif res && injected_res_code != res.code
return Exploit::CheckCode::Appears
end

Exploit::CheckCode::Unknown
end

def run_host(ip)
Expand Down
19 changes: 17 additions & 2 deletions modules/exploits/multi/http/apache_mod_cgi_bash_env_exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,25 @@ def check
res = req("echo #{marker}")

if res && res.body.include?(marker * 3)
Exploit::CheckCode::Vulnerable
return Exploit::CheckCode::Vulnerable
elsif res && res.code == 500
injected_res_code = res.code
else
Exploit::CheckCode::Safe
return Exploit::CheckCode::Safe
end

res = send_request_cgi({
'method' => datastore['METHOD'],
'uri' => normalize_uri(target_uri.path.to_s)
})

if res && injected_res_code == res.code
return Exploit::CheckCode::Unknown
elsif res && injected_res_code != res.code
return Exploit::CheckCode::Appears
end

Exploit::CheckCode::Unknown
end

def exploit
Expand Down