llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Packagist · typo3/phar-stream-wrapper

GHSA-4V5G-8PQ2-32M2

By-passing Protection of PharStreamWrapper Interceptor

Texto original en inglés · Ver en español

Parche disponible
Descargar PNG JSON
CVSS
—
medium
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche2 versiones2.0.1 · 3.0.1
Exposición899 dDesde la divulgación, 5 jun 2024, 12:30 p. m.
Detección894 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de la severidad declarada por GHSA (media) y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Revisa, agenda, parchea. El clásico de siempre.Para el próximo sprint, sin estrés.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Monitoreo
Detectada
5 jun 24
2 dic 24
17 nov 26
21 nov 26
5 jun 24
16 ene 25
29 ago 25
11 abr 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-4V5G-8PQ2-32M2 divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

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

Rangos afectados

Afectada Corregida
typo3/phar-stream-wrapper≥ 1.0.0 < 2.0.1
typo3/phar-stream-wrapper≥ 3.0.0 < 3.0.1
1.0.0
2.0.1
3.0.0
3.0.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagisttypo3/phar-stream-wrapper
Corregida 2.0.1, 3.0.1 — —
Versiones corregidas2.0.13.0.1
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Otrahttps://github.com/FriendsOfPHP/security-advisories/blob/master/typo3/phar-stream-wrapper/2018-10-18-1.yaml
Otrahttps://typo3.org/security/advisory/typo3-psa-2018-001

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.