# GHSA-3vwr-jj4f-h98x: eZ Publish Remote code execution in file uploads

> Attackers with upload permissions can execute remote code via malicious files if server configuration allows PHP execution in upload directories.

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

## What is GHSA-3vwr-jj4f-h98x?

GHSA-3vwr-jj4f-h98x is a vulnerability in ezsystems/ezpublish-kernel, published on 15 May 2024. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

This Security Advisory is about a vulnerability in the way eZ Platform and eZ Publish Legacy handles file uploads, which can in the worst case lead to remote code execution (RCE), a very serious threat. An attacker would need access to uploading files to be able to exploit the vulnerability, so if you have strict controls on this and trust all who have this permission, you're not affected. On the basis of the tests we have made, we also believe the vulnerability cannot be exploited as long as our recommended vhost configuration is used. Here is the v2.5 recommendation for Nginx, as an example:

https://github.com/ezsystems/ezplatform/blob/2.5/doc/nginx/vhost.template#L31

This vhost template specifies that only the file app.php in the web root is executed, while vulnerable configurations allow execution of any php file. Apache is affected in the same way as Nginx, and is also protected by using the recommended configuration. The build-in webserver in PHP stays vulnerable, as it doesn't use this type of configuration (this webserver should only be used for development, never for production). We cannot be 100% certain our configuration is not vulnerable. We also do not know if all our users use the recommended configuration, so we send out this fix to be on the safe side.

The fix includes a blacklist feature for uploaded filenames, such as ".php". The file types on the blacklist cannot be uploaded. The blacklist is configurable. In eZ Platform you will find it as ezsettings.default.io.file_storage.file_type_blacklist in eZ/Bundle/EzPublishCoreBundle/Resources/config/default_settings.yml in vendors/ezsystems/ezpublish-kernel. In eZ Publish Legacy you will find it as FileExtensionBlackList in settings/file.ini. By default it blocks these file types: php, php3, phar, phpt, pht, phtml, pgif. The fix also inclues a new block against path traversal attacks, though this kind of attack was not reproducible in our tests.

## Which versions are affected by GHSA-3vwr-jj4f-h98x?

6 open source packages ship an affected version, including ezsystems/ezpublish-kernel.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `ezsystems/ezpublish-kernel` | Packagist | From 5.4.0 | 5.4.14.1 |
| `ezsystems/ezpublish-kernel` | Packagist | From 5.4.0 | 5.4.14.1 |
| `ezsystems/ezpublish-kernel` | Packagist | From 6.13.0 | 6.13.6.2 |
| `ezsystems/ezpublish-kernel` | Packagist | From 6.13.0 | 6.13.6.2 |
| `ezsystems/ezpublish-kernel` | Packagist | From 7.5.0 | 7.5.6.2 |
| `ezsystems/ezpublish-kernel` | Packagist | From 7.5.0 | 7.5.6.2 |

## How do I fix GHSA-3vwr-jj4f-h98x?

Upgrade ezsystems/ezpublish-kernel to a fixed version for your release line: 5.4.14.1, 6.13.6.2 or 7.5.6.2.

## Is GHSA-3vwr-jj4f-h98x being exploited?

There is no known exploitation of GHSA-3vwr-jj4f-h98x in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-3vwr-jj4f-h98x and fix it if it is affected.

What it is: GHSA-3vwr-jj4f-h98x is a vulnerability in ezsystems/ezpublish-kernel, published on 15 May 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-3vwr-jj4f-h98x in the wild and no public exploit code.

Affected packages and fixed versions:
- ezsystems/ezpublish-kernel (Packagist): affected from 5.4.0; fixed in 5.4.14.1
- ezsystems/ezpublish-kernel (Packagist): affected from 5.4.0; fixed in 5.4.14.1
- ezsystems/ezpublish-kernel (Packagist): affected from 6.13.0; fixed in 6.13.6.2
- ezsystems/ezpublish-kernel (Packagist): affected from 6.13.0; fixed in 6.13.6.2
- ezsystems/ezpublish-kernel (Packagist): affected from 7.5.0; fixed in 7.5.6.2
- ezsystems/ezpublish-kernel (Packagist): affected from 7.5.0; fixed in 7.5.6.2

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-3vwr-jj4f-h98x/ (Markdown: https://insights.sbomify.com/GHSA-3vwr-jj4f-h98x/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-3vwr-jj4f-h98x

---
From sbomify Insights: https://insights.sbomify.com/GHSA-3vwr-jj4f-h98x/
Summaries are generated and may contain mistakes; the official description above is the record.
