GHSA-4V5G-8PQ2-32M2

GHSA-4V5G-8PQ2-32M2 is a medium-severity insecure deserialization vulnerability in typo3/phar-stream-wrapper (composer), affecting versions >= 1.0.0, < 2.0.1. It is fixed in 2.0.1, 3.0.1.

Summary

Insecure deserialization is a vulnerability which occurs when untrusted data is used to abuse the logic of an application. In July 2018, the vulnerability of insecure deserialization when executing Phar archives was addressed by removing the known attack vector in the TYPO3 core. For more details read the corresponding TYPO3 advisory.

In addition, a new interceptor was introduced to protect possible (but unknown) vulnerabilities in 3rd party components like TYPO3 extensions. Basically, the PharStreamWrapper intercepts direct invocations of Phar archives and allows or denies further processing based on individual rules.

Recently, the PharStreamWrapper was extracted from the TYPO3 core and released as standalone package under the MIT license. It is now available for any PHP driven project.

The stream wrapper overwrites the existing Phar handling of PHP, applies its own assertions and then restores the native PHP Phar handling for the corresponding commands (e.g. file_exists, include, fopen) to continue processing. After that, the native PHP Phar handling gets disabled and is overwritten by the logic of the PharStreamWrapper again. This is the only way to control invocations of Phar archives as PHP only allows a single handler for each corresponding stream.

We were informed that exception and error handlers in custom applications (e.g. TYPO3 extensions) sometimes didn't return to the original operating sequence of the PharStreamWrapper. A possible consequence was that the unprotected native PHP Phar handling remained active and therefore became vulnerable for the basic issue of insecure deserialization again.

Examples
Take a look at the following examples showing how the handling is by-passed in custom application code.

Scenario A: Exception thrown from code organized in a Phar archive

try {
    include('phar://path-to-archive/good-archive.phar');
} catch (\Throwable $throwable) {
    // not doing much here, continue execution
}
// the insecure value can be anything that is or was user-submitted
// and cannot be trusted in terms of security, $_GET is just used as example
$insecureValue = $_GET['path'];
// the value might be 'phar://path-to-archive/malicious-archive.phar'
file_exists($insecureValue);

Scenario B: Errors converted to exceptions and thrown when interacting with archive contents

// set error handler in order to convert errors to exceptions
set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontext) {
   throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
});
// interacting with Phar archive
try {
   $resource = opendir('phar://path-to-archive/good-archive.phar/non-existing-path/');
   closedir($resource);
} catch (\Throwable $throwable) {
   // not doing much here, continue execution
}
// the insecure value can be anything that is or was user-submitted
// and cannot be trusted in terms of security, $_GET is just used as example
$insecureValue = $_GET['path'];
// the value might be 'phar://path-to-archive/malicious-archive.phar'
file_exists($insecureValue);

Impact

Untrusted serialized data is processed by a deserializer that can instantiate arbitrary objects or execute code as a side effect. Typical impact: arbitrary code execution or logic abuse.

Affected versions

typo3/phar-stream-wrapper (>= 1.0.0, < 2.0.1) typo3/phar-stream-wrapper (>= 3.0.0, < 3.0.1)

Security releases

typo3/phar-stream-wrapper → 2.0.1 (composer) typo3/phar-stream-wrapper → 3.0.1 (composer)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

See it in your environment

Remediation advice

Upgrade the following packages to resolve this vulnerability:

typo3/phar-stream-wrapper to 2.0.1 or later; typo3/phar-stream-wrapper to 3.0.1 or later

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is GHSA-4V5G-8PQ2-32M2? GHSA-4V5G-8PQ2-32M2 is a medium-severity insecure deserialization vulnerability in typo3/phar-stream-wrapper (composer), affecting versions >= 1.0.0, < 2.0.1. It is fixed in 2.0.1, 3.0.1. Untrusted serialized data is processed by a deserializer that can instantiate arbitrary objects or execute code as a side effect.
  2. Which versions of typo3/phar-stream-wrapper are affected by GHSA-4V5G-8PQ2-32M2? typo3/phar-stream-wrapper (composer) versions >= 1.0.0, < 2.0.1 is affected.
  3. Is there a fix for GHSA-4V5G-8PQ2-32M2? Yes. GHSA-4V5G-8PQ2-32M2 is fixed in 2.0.1, 3.0.1. Upgrade to this version or later.
  4. Is GHSA-4V5G-8PQ2-32M2 exploitable, and should I be worried? Whether GHSA-4V5G-8PQ2-32M2 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  5. What actually determines whether GHSA-4V5G-8PQ2-32M2 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  6. How do I fix GHSA-4V5G-8PQ2-32M2?
    • Upgrade typo3/phar-stream-wrapper to 2.0.1 or later
    • Upgrade typo3/phar-stream-wrapper to 3.0.1 or later

Other vulnerabilities in typo3/phar-stream-wrapper

Stop the waste.
Protect your environment with Kodem.