Średnia

By-passing Protection of PharStreamWrapper Interceptor

  • Ujawniono: 05.06.2024
  • Aktualizacja: 11.10.2026 10:22

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

Czego dotyczy

Kliknij technologię, aby zobaczyć wszystkie dotyczące jej podatności.

PlatformaPaczkaPodatne wersjePoprawka w wersji
Paczka Composer typo3/phar-stream-wrapper >= 1.0.0, < 2.0.1, >= 3.0.0, < 3.0.1 2.0.1, 3.0.1

Odnośniki

Ocena CVSS -
Słabość (CWE)
CWE-502
Platforma
Composer
Paczka
typo3/phar-stream-wrapper
Ujawniono
05.06.2024
Aktualizacja
11.10.2026 10:22

Źródła i licencje

OSV / GitHub Advisory Database - GHSA-4v5g-8pq2-32m2 - CC BY 4.0

Historia podatności: typo3/phar-stream-wrapper

Wszystkie opisane podatności tej paczki (Paczka Composer), od najnowszej. Widać, czy to jednorazowa wpadka, czy paczka, której trzeba pilnować.

Wszystkich wpisów
3
Pierwsza → ostatnia
05.2019 06.2024
Bez poprawki
0
Wykorzystywana w atakach
0

Rozkład istotności

  • Krytyczna 2
  • Średnia 1

Ujawnienia w latach

  1. 2019: 1
  2. 2020: 0
  3. 2021: 0
  4. 2022: 1
  5. 2023: 0
  6. 2024: 1
  7. 2025: 0
  8. 2026: 0
  1. By-passing Protection of PharStreamWrapper Interceptor ten wpis
    Średnia ghsa-4v5g-8pq2-32m2 >= 1.0.0, < 2.0.1, >= 3.0.0, < 3.0.1 2.0.1, 3.0.1
  2. Krytyczna · 9.8 CVE-2019-11830 >= 2.0.0, < 2.1.1, >= 3.0.0, < 3.1.1 2.1.1, 3.1.1
  3. Krytyczna · 9.8 CVE-2019-11831 >= 2.0.0, < 2.1.1, >= 3.0.0, < 3.1.1 2.1.1, 3.1.1

Dowiedz się, które podatności dotyczą Twojej aplikacji

Po podłączeniu integracji DockRay i włączeniu raportowania oprogramowania DockRay porównuje zgłoszone wersje komponentów ze znanymi podatnościami i powiadamia o potwierdzonych dopasowaniach. Zakres zależy od obsługiwanej technologii i dostępnych biuletynów.

Podłącz swoją aplikację
Newsletter DockRay

Bezpieczeństwo aplikacji w Twojej skrzynce

Najważniejsze podatności, konkretne zalecenia i praktyczne wskazówki dla Twoich aplikacji. Wybierz technologie i śledź to, co ma znaczenie dla Twojego projektu.

  • Codzienne zestawienie nowych podatności, także krytycznych.
  • Powiadomienia o ważnych aktualizacjach.
  • Praktyczne porady o bezpieczeństwie i monitoringu aplikacji.

Pozostaw puste, aby otrzymywać informacje o wszystkich technologiach.

Zapis jest bezpłatny. Wypiszesz się jednym kliknięciem w wiadomości.