PHP Phar Remote Code Execution Vulnerability
This content has been archived
This article no longer conforms to NHS Digital's standards for cyber alerts, and may contain outdated or inaccurate information. Use of this information contained in this page is at your own risk
Summary
Threat details
PHP has the capability to serialize values including objects, generating a text representation that does not lose the value's type or structure. The unserialize method converts such a string of text back into a PHP value. Untrusted strings must not be passed to unserialize because it can load and execute object code automatically.
When a PHP application uses the phar:// stream wrapper to access phar archives, any metadata in the archive is immediately unserialised. This enables an attacker to execute code if they can place a valid phar archive onto a target system and trigger a file operation on it using a phar:// path.
Methods have been discovered to exploit this vulnerability in a variety of PHP web applications, including content management systems such as WordPress and Typo3. So far, these have required the attacker to be authenticated on the targeted system.
Remediation steps
Last edited: 17 February 2020 12:52 pm