PatchClock

PHP security digest · 9 Oct 2026

Contao: Path traversal in the images controller

Medium CVE-2026-107844

Package
contao/core-bundle
Fixed in
5.3.50, 5.7.12
Published
Fri 9 Oct 2026, 21:53 LisbonUpdated Mon 26 Oct 2026, 03:27 Lisbon
Installs on Packagist
2M

In plain words

An unauthenticated visitor can use the images controller to read image-typed files under the project directory, including files deliberately kept outside the document root. Reads are limited to extensions allowed by contao.image.valid_extensions; files below the upload directory (files/), including protected member folders, could not be read. The route can also reveal whether arbitrary paths exist, and its 404 message discloses absolute filesystem paths when debug mode is enabled.

Affected versions

PackageAffectedFixed in
contao/core-bundle>= 4.1.0, < 5.3.505.3.50
contao/core-bundle>= 5.4.0-RC1, < 5.7.125.7.12

Am I affected?

Check composer.lock for contao/core-bundle: affected versions are >= 4.1.0, < 5.3.50 and >= 5.4.0-RC1, < 5.7.12; fixes are 5.3.50 and 5.7.12. Review contao.image.valid_extensions and look for files with allowed extensions under the project directory but outside files/, especially outside the document root. Check whether debug mode is enabled for the additional path disclosure. Both Apache with the shipped public/.htaccess and nginx with the documented configuration are affected.

What to do

Check which version you have, then update to a fixed release for your branch (5.3.50, 5.7.12):

composer show contao/core-bundle | grep versions
composer update contao/core-bundle

If your version constraint in composer.json keeps you below a fixed release, raise it first. Whether your configuration is affected, and the exact version ranges, are in the advisory itself.

The advisory's description

ImagesController joins the user controlled {path} onto the configured image target directory with Path::join(), which canonicalises .. segments, and never calls Path::isBasePath() to confirm the result stayed inside that directory. An unauthenticated GET with percent encoded dot segments therefore escapes the directory and the file is returned by BinaryFileResponse. Reads are bounded to the extensions in contao.image.valid_extensions, and paths below the upload directory fail for an unrelated reason, so this is reported as a missing boundary check rather than as a general arbitrary file read. Both Apache with the shipped public/.htaccess and nginx with the documented configuration are affected.

Impact

Any unauthenticated visitor can read files that are deliberately kept outside the document root, anywhere under the project directory, as long as the name ends in one of contao.image.valid_extensions (jpg, jpeg, gif, png, tif, tiff, bmp, svg, svgz, webp). The route also acts as an existence oracle for arbitrary paths, and on a debug enabled instance the 404 message discloses the absolute filesystem path.

Honesty caveat, stated because it lowers the severity. The reporter could not use this to read protected member folders: every path below the upload directory returns 500 for the reason given under Details, so the practically reachable set is image typed files outside files/.

Weakness: CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). Reported by HDWSec.

The advisory

From OSV.dev, which gathers the GitHub Advisory Database, FriendsOfPHP and Drupal security advisories; the summary is theirs. The description, affected versions, weakness and credits are from the GitHub Advisory Database (CC BY 4.0). "In plain words", "Am I affected?" and "If you cannot update yet" are based on that advisory, and checked to name no version it does not.