Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

Plex Media Server Local Privilege Escalation (Windows)

High

Synopsis

The Plex Update Service ("Plex Update Service.exe") contains a flaw that allows a local attacker to execute arbitrary Python code with SYSTEM privileges. The service exposes functionality over an ALPC port that can be invoked by a local, unauthenticated attacker.

The service is defined as such:

[
uuid(631c7d9c-1797-42f9-8e96-367a9ee58887),
version(1.0),
]
interface DefaultIfName
{

void Proc0(
	[in][string] wchar_t* arg_1);

long Proc1(
	[in][string] wchar_t* arg_1);

long Proc2(
	[in][string] wchar_t* arg_1, 
	[out]long *arg_2);
}

Specifically, Proc2 will execute a given executable if it is signed by Plex, even if it is not a legitimate update file. PlexScriptHost.exe (a Python interpreter) happens to be signed by Plex, and if a file named 'sitecustomize.py' is located in the current working directory, it will be executed when PlexScriptHost is launched. This is expected behavior for Python interpreters, and it can be abused to execute arbitrary code contained in sitecustomize.py.

Proof of Concept

https://github.com/tenable/poc/tree/master/plex/plex_media_server/tra_2020_25

Run the PoC and notice that the process is launched as SYSTEM. You will need to inspect the task list.

Launch RpcClient.exe to execute a command of your choosing, or by default execute the Windows Calculator. Below will add a new user.

> RpcClient.exe "net user /add scooby"

Below is a log entry in Plex Update Service.log showing a successful exploitation attempt.

Mar 31, 2020 14:05:05.324 [4796] DEBUG - Install() from UpdateInterface: C:\Users\lowpriv\Documents\RpcClient\RpcClient\Release\PlexScriptHost.exe
Mar 31, 2020 14:05:05.324 [4796] DEBUG - CheckBundle() from UpdateInterface: C:\Users\lowpriv\Documents\RpcClient\RpcClient\Release\PlexScriptHost.exe
Mar 31, 2020 14:05:05.324 [4796] DEBUG - Checking Certificate of installer: C:\Users\lowpriv\Documents\RpcClient\RpcClient\Release\PlexScriptHost.exe
Mar 31, 2020 14:05:05.324 [4796] DEBUG - Certificate integrity verified
Mar 31, 2020 14:05:05.324 [4796] DEBUG - HTTP requesting GET https://plex.tv/api/pmscert/profile
Mar 31, 2020 14:05:05.839 [4796] DEBUG - HTTP 200 response from GET https://plex.tv/api/pmscert/profile
Mar 31, 2020 14:05:05.839 [4796] DEBUG - Certificate identity verified
Mar 31, 2020 14:05:05.839 [4796] DEBUG - Create Process Success! Waiting for process to complete.
Mar 31, 2020 14:05:05.932 [4796] DEBUG - Installer exit code:  2 - The system cannot find the file specified.

Solution

Upgrade to 1.18.2 or newer. Additionally, Plex Media Server versions 1.19.1.2701 & 1.19.2.2702 (and newer) features additional hardening in the updater infrastructure to protect against future vulnerabilities

Disclosure Timeline

03/31/2020 - Tenable reports vulnerability
03/31/2020 - Plex is looking at the issue. They were able to download the PoC.
04/01/2020 - Tenable acknowledges.
04/03/2020 - Plex proposes a fix strategy. Also notifies me of bounty payout.
04/06/2020 - Tenable acknowledges fix strategy. Asks about anticipated patch release date.
04/07/2020 - Some back-and-forth on bounty specifics.
04/07/2020 - Plex hopes to release a patch before the end of the month. Nothing firm yet.
04/07/2020 - Tenable acknowleges.
04/07/2020 - More bounty specifics.
04/20/2020 - Plex sends a link to a beta update package. Asks if I will confirm the fix.
04/21/2020 - Tenable confirms that the package fixes the vulnerability. Exploit no longer works.

All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.

Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.

For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.

If you have questions or corrections about this advisory, please email [email protected]

Risk Information

CVE ID: CVE-2020-5740
Tenable Advisory ID: TRA-2020-25
Credit:
Chris Lyne
CVSSv2 Base / Temporal Score:
7.2 / 5.6
CVSSv2 Vector:
(AV:L/AC:L/Au:N/C:C/I:C/A:C)
Affected Products:
Plex Media Server (Windows) prior to 1.18.2
Risk Factor:
High

Advisory Timeline

04/21/2020 - Advisory released
04/24/2020 - Updated fix version
04/27/2020 - Added reference to Plex forum post
04/30/2020 - Updating vuln version and solution