---
title: "TYPO3-PSA-2018-001: By-passing Protection of PharStreamWrapper Interceptor"
url: "https://news.typo3.com/security/advisory/typo3-psa-2018-001"
description: It has been discovered that the protection against insecure deserialization can be by-passed in PharStreamWrapper component.
image: "https://news.typo3.com/_assets/d1e01514e4c4a5b3147940fa2ec50682/Images/og-image-news.jpg"
date: 2026-06-11
modified: 2026-06-11
categories:
  - "Developer & Technology"
  - Public Service Announcement
---

# TYPO3-PSA-2018-001: By-passing Protection of PharStreamWrapper Interceptor

- [Developer & Technology](https://news.typo3.com/article/category/developer-technology)
- Security / [Public Service Announcement](https://news.typo3.com/article/category/security/public-service-announcement)

TYPO3-PSA-2018-001: By-passing Protection of PharStreamWrapper Interceptor
==========================================================================

18 October 2018

![A laptop screen displaying a list of security advisories](https://news.typo3.com/typo3temp/assets/_processed_/d/c/csm_security_blog_default_77f8e86036.webp)

It has been discovered that the protection against insecure deserialization can be by-passed in PharStreamWrapper component.

- ![](https://news.typo3.com/typo3temp/assets/t3g/blog/gravatar/b8266fdc667b773926c59081862ab148.jpeg)[Oliver Hader](https://news.typo3.com/article/author/oliver-hader)

- **Component type:** PharStreamWrapper (package [typo3/phar-stream-wrapper](https://packagist.org/packages/typo3/phar-stream-wrapper))
- **Release date:** October 18, 2018
- **Impact:** By-passing protection against insecure deserialization
- **Affected versions:** v2.0.0 and v3.0.0 of the package

Announced at <https://github.com/TYPO3/phar-stream-wrapper/wiki/TYPO3-PSA-2018-001>

Problem description
-------------------

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](https://typo3.org/security/advisory/typo3-core-sa-2018-002/).

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);
```

Solution
--------

The PharStreamWrapper package was therefore further enhanced to address this issue. The two given scenarios are now handled. After each invocation the native PHP Phar handling now gets overwritten and then disabled again.

The PharStream Wrapper [package is available for any PHP driven project for download](https://github.com/TYPO3/phar-stream-wrapper/).

Users who downloaded the previous version are advised to upgrade to versions 3.0.1 (for PHP v7.0 and later) and 2.0.1 (for PHP v5.3 and later) to keep their projects safe.

As the vulnerability exists primarily in theory and there have been no public reports or findings on how it can be exploited in production environments, this public service announcement has been been published instead of releasing new TYPO3 versions.

Download
--------

Please either upgrade to versions v3.0.1 and v2.0.1 manually or ensure Composer dependencies are raised to the mentioned new versions.

- <https://github.com/TYPO3/phar-stream-wrapper/releases/tag/v3.0.1>
- <https://github.com/TYPO3/phar-stream-wrapper/releases/tag/v2.0.1>
- <https://packagist.org/packages/typo3/phar-stream-wrapper>

Credits
-------

Credits go to [Martin Auswöger](https://github.com/ausi) of the Contao Security Team who reported the vulnerability and provided according security fixes.

General advice
--------------

Follow the recommendations that are given in the [TYPO3 Security Guide](https://docs.typo3.org/typo3cms/CoreApiReference/Security/Index.html#security). Please subscribe to the [typo3-announce mailing list](http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-announce).

![](https://news.typo3.com/typo3temp/assets/t3g/blog/gravatar/cc7cba9757f98fbe05023a139119df74.jpeg)

About the Author

[Oliver Hader](https://news.typo3.com/article/author/oliver-hader)

Core Developer at TYPO3 GmbH,Hof, Germany

[Website](https://typo3.com)[Twitter](https://twitter.com/ohader)[LinkedIn](https://www.linkedin.com/in/oliverhader/)[Xing](https://www.xing.com/profile/Oliver_Hader)

Oliver started to work with TYPO3 in 2005 and was fascinated by the product and its universe. Since 2007 he is member of the TYPO3 Core Team. After going back to university in 2014 for achieving a postgraduate master degree in internet web science, he is now researching on advanced web technology topics in general and for TYPO3 in particular.

In his spare time, Oliver loves to go cycling cross-country in the uplands around Hof (Germany) in northern Bavaria - at the region where he's living as well.

[More posts by this author](https://news.typo3.com/article/author/oliver-hader)