This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Security Advisories » EZSA-2018-009: Do not interpret...

EZSA-2018-009: Do not interpret PHP/PHAR uploads

Publication date : 21/11/2018
Severity : High
Affected versions : ezsystems/ezplatform v2.3.2, v2.2.3, v1.13.4, v1.7.8 and ezsystems/ezpublish-legacy v2018.09.1.2, v2018.06.1.3, v2017.12.4.2, v5.4.12.2, v5.3.12.5
Resolving versions : ezsystems/ezplatform v2.3.2.1, v2.2.3.1, v1.13.4.1, v1.7.8.1 and ezsystems/ezpublish-legacy v2018.09.1.3, v2018.06.1.4, v2017.12.4.3, v5.4.12.3, v5.3.12.6

This security advisory fixes two vulnerabilities in eZ Platform and in Legacy, and we strongly recommend that you install it as soon as possible. The issue is about how uploaded PHP and PHAR files are handled, and consists of two parts: 1. Web server configuration, and 2. Disabling the PHAR stream wrapper. All supported releases are affected.


The sample web server configuration in our documentation can in some cases allow the execution of uploaded PHP/PHAR code. This can be abused to allow priviledge escalation and breach of content access controls, among other things. Please ensure that your web server will not execute files in directories were files may be uploaded, such as web/var/ and ezpublish_legacy/var/

As an example, here is how you can make Apache return HTTP 403 Forbidden for a number of executable file types in your eZ Platform var directory. Please adapt it to your needs. It is then possible to enable logging of HTTP 403 in a separate log file if you wish, you could do this to see if someone is trying to abuse the server.

RewriteEngine On

# disable .php(3) and other extensions in the var directory
RewriteRule ^var/.*(?i)\.(php3?|phar|phtml|sh|exe|pl|bin)$ - [F]

Here is the same configuration, but for the Nginx web server:

location ~ ^/var/.*(?i)\.(php3?|phar|phtml|sh|exe|pl|bin)$ {
  return 403;


PHAR archives may be crafted such that its stream wrapper will execute them without being specifically asked to. With such files, any PHP file operation may cause deserialisation and execution. This may happen even if the file name suffix isn't ".phar". Any site that allows file uploads is at risk. Normally eZ Platform has no need for PHAR support. It's only used by Composer, and that is executed separately from eZ Platform. So one way to avoid this vulnerability is to disable the PHAR stream wrapper within eZ Platform. (If you know you need PHAR support, please consider other means to deal with this vulnerability. For example, enabling the wrapper only in those scripts/bundles that have to deal with such files.)

Disabling the stream wrapper should be done in:

  • eZ Platform (web/app.php)
  • CLI scripts (bin/console)
  • Legacy (index.php and CLI scripts)

To install, use Composer to update to one of the "Resolving versions" mentioned above, or apply these patches manually:

Have you found a security bug in eZ Publish or eZ Platform? See how to report it responsibly here:

36 542 Users on board!

Community Project menu

Proudly Developed with from