CVE-2024-42356
JSON

8.3high

Shopware vulnerable to Server Side Template Injection in Twig using Context functions

Severity
8.3high CVSS:3.1 by GitHub_M
Exploit likelihood
0.65% (higher than 52% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-35jp-8cgg-p4wj

Description

Shopware is an open commerce platform. Prior to versions 6.6.5.1 and 6.5.8.13, the `context` variable is injected into almost any Twig Template and allows to access to current language, currency information. The context object allows also to switch for a short time the scope of the Context as a helper with a callable function. The function can be called also from Twig and as the second parameter allows any callable, it's possible to call from Twig any statically callable PHP function/method. It's not possible as customer to provide any Twig code, the attacker would require access to Administration to exploit it using Mail templates or using App Scripts. Update to Shopware 6.6.5.1 or 6.5.8.13 to receive a patch. For older versions of 6.1, 6.2, 6.3 and 6.4 corresponding security measures are also available via a plugin.

Affected

Product or packageVersionsReported by
shopware shopware<= 6.5.8.12, >= 6.6.0.0, <= 6.6.5.0, up to 6.5.8.12, from 6.6.0.0 up to 6.6.5.0, before 6.5.8.13, from 6.6.0.0 before 6.6.5.1CVE List, NVD
shopware/core (Packagist)before 6.5.8.13, from 6.6.0.0 before 6.6.5.1GitHub Advisory Database
shopware/platform (Packagist)before 6.5.8.13, from 6.6.0.0 before 6.6.5.1GitHub Advisory Database

All scores

GitHub_M8.3high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:L
GitHub8.3high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:L
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N
NVD7.2high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-94CWE-1336

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.

What each source says

CVE List

Shopware is an open commerce platform. Prior to versions 6.6.5.1 and 6.5.8.13, the `context` variable is injected into almost any Twig Template and allows to access to current language, currency information. The context object allows also to switch for a short time the scope of the Context as a helper with a callable function. The function can be called also from Twig and as the second parameter allows any callable, it's possible to call from Twig any statically callable PHP function/method. It's not possible as customer to provide any Twig code, the attacker would require access to Administration to exploit it using Mail templates or using App Scripts. Update to Shopware 6.6.5.1 or 6.5.8.13 to receive a patch. For older versions of 6.1, 6.2, 6.3 and 6.4 corresponding security measures are also available via a plugin.

GitHub Advisory Database
Impact

The context variable is injected into almost any Twig Template and allows to access to current language, currency information. The context object allows also to switch for a short time the scope of the Context as a helper with a callable function.

Example call from PHP:

$context->scope(Context::SYSTEM_SCOPE, static function (Context $context) use ($mediaService, $media, &$fileBlob): void {
    $fileBlob = $mediaService->loadFile($media->getId(), $context);
});

This function can be called also from Twig and as the second parameter allows any callable, it's possible to call from Twig any statically callable PHP function/method.

It's not possible as customer to provide any Twig code, the attacker would require access to Administration to exploit it using Mail templates or using App Scripts.

Patches

Update to Shopware 6.6.5.1 or 6.5.8.13

Workarounds

For older versions of 6.1, 6.2, 6.3 and 6.4 corresponding security measures are also available via a plugin. For the full range of functions, we recommend updating to the latest Shopware version.

NVD (es)

Shopware es una plataforma de comercio abierta. Antes de las versiones 6.6.5.1 y 6.5.8.13, la variable `context` se inyecta en casi cualquier plantilla Twig y permite acceder al idioma actual y a la información de moneda. El objeto de contexto también permite cambiar durante un breve período el alcance del Contexto como ayuda con una función invocable. La función también se puede llamar desde Twig y como el segundo parámetro permite cualquier función invocable, es posible llamar desde Twig cualquier función/método PHP estáticamente invocable. Como cliente, no es posible proporcionar ningún código Twig; el atacante necesitaría acceso a la Administración para explotarlo utilizando plantillas de correo o App Scripts. Actualice a Shopware 6.6.5.1 o 6.5.8.13 para recibir un parche. Para versiones anteriores de 6.1, 6.2, 6.3 y 6.4, las medidas de seguridad correspondientes también están disponibles a través de un complemento.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-42356 changed 2024-08-09CVE Terms of Use
GitHub Advisory DatabaseGHSA-35jp-8cgg-p4wj changed 2024-08-12CC-BY-4.0
NVDCVE-2024-42356 changed 2026-06-17Public domain