# GHSA-7336-ghhp-f2qj: Shopware Remote Code Execution Vulnerability

> Attackers can execute arbitrary code in Shopware if custom templates improperly handle field data, requiring a patch to secure the application.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 May 2024

## What is GHSA-7336-ghhp-f2qj?

GHSA-7336-ghhp-f2qj is a code injection vulnerability in shopware/shopware, published on 21 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Under certain circumstances, it’s possible to execute an unauthorized foreign code in Shopware in versions prior to 5.2.16. One possible threat is if a template that doesn’t derive from the Shopware standard has been completely copied. Themes or plugins that execute or overwrite the following template code are vulnerable.

- Affected file: emotion.tpl

Path template file "Emotion template": templates / _default / frontend / forms / elements.tpl
Path template file "Responsive template": themes/Frontend/Bare/frontend/forms/elements.tpl

The complete line beginning with: `{eval var=$sSupport.sFields[$sKey]...` should be exchanged with the following:

```
{$sSupport.sFields[$sKey]|replace:'{literal}':''|replace:'{/literal}':''|replace:'%*%':"{s name='RequiredField' namespace='frontend/register/index'}{/s}"}
```

## Which versions are affected by GHSA-7336-ghhp-f2qj?

2 open source packages ship an affected version, including shopware/shopware.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `shopware/shopware` | Packagist | From 5.2.15 | 5.2.16 |
| `shopware/shopware` | Packagist | From 5.2.15 | 5.2.16 |

## How do I fix GHSA-7336-ghhp-f2qj?

Upgrade shopware/shopware to 5.2.16 or later.

## Is GHSA-7336-ghhp-f2qj being exploited?

There is no known exploitation of GHSA-7336-ghhp-f2qj in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-7336-ghhp-f2qj and fix it if it is affected.

What it is: GHSA-7336-ghhp-f2qj is a code injection vulnerability in shopware/shopware, published on 21 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-7336-ghhp-f2qj in the wild and no public exploit code.

Affected packages and fixed versions:
- shopware/shopware (Packagist): affected from 5.2.15; fixed in 5.2.16
- shopware/shopware (Packagist): affected from 5.2.15; fixed in 5.2.16

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-7336-ghhp-f2qj/ (Markdown: https://insights.sbomify.com/GHSA-7336-ghhp-f2qj/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-7336-ghhp-f2qj

---
From sbomify Insights: https://insights.sbomify.com/GHSA-7336-ghhp-f2qj/
Summaries are generated and may contain mistakes; the official description above is the record.
