Skip to main content
Vulnerability Database/CVE-2026-107844

CVE-2026-107844: Contao CMS Path Traversal Vulnerability

CVE-2026-107844 is a path traversal vulnerability in Contao CMS allowing unauthenticated attackers to access files outside intended directories. This post covers the technical details, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-107844 Overview

Contao, an open source content management system (CMS), contains a path traversal vulnerability [CWE-22] in its ImagesController. The flaw affects versions 5.0.0 through 5.3.49 and 5.7.0 through 5.7.11. The controller joins a user-controlled {path} parameter to the configured image target directory using Path::join() but omits a Path::isBasePath() check to confirm the resolved path stays inside that directory. Unauthenticated attackers can submit encoded parent-directory segments to retrieve files from the project directory through BinaryFileResponse when the filename uses an extension listed in contao.image.valid_extensions. The route may also disclose whether arbitrary paths exist, and debug responses can leak absolute filesystem paths.

Critical Impact

Unauthenticated remote attackers can read files outside the image directory and enumerate filesystem paths, exposing limited information from the Contao project directory.

Affected Products

  • Contao CMS versions 5.0.0 through 5.3.49
  • Contao CMS versions 5.7.0 through 5.7.11
  • Deployments using default contao.image.valid_extensions configuration

Discovery Timeline

  • 2026-10-09 - CVE-2026-107844 published to NVD
  • 2026-10-16 - Last updated in NVD database

Technical Details for CVE-2026-107844

Vulnerability Analysis

The vulnerability resides in core-bundle/src/Controller/ImagesController.php. The __invoke(string $path) method constructed the target image path by calling Path::join($this->targetDir, $path) and passed the result directly to $this->imageFactory->create(). Because Path::join() normalizes path separators but accepts .. traversal segments, a crafted path value could resolve to locations outside $this->targetDir.

When the resolved file matched an extension declared in contao.image.valid_extensions, Contao returned the file contents through BinaryFileResponse. The route also behaved differently for existing versus non-existing paths, enabling an attacker to probe filesystem layout. Debug responses, when enabled, further disclosed absolute paths. The advisory notes that files beneath the upload directory were not shown to be readable through this issue.

Root Cause

The root cause is missing canonical path validation. Path::join() combines strings but does not enforce containment within a base directory. Without a follow-up Path::isBasePath() check, user input containing encoded ../ sequences escapes the intended target directory before the image factory loads the file.

Attack Vector

An unauthenticated attacker issues an HTTP request to the images route with a {path} parameter containing URL-encoded parent-directory segments and a filename ending in an allowed image extension. The server resolves the traversal, reads the file from disk, and returns it as a binary response. Secondary impact includes path existence oracles and absolute path disclosure through debug error output.

php
     */
    public function __invoke(string $path): Response
    {
+        $path = Path::join($this->targetDir, $path);
+
+        if (!Path::isBasePath($this->targetDir, $path)) {
+            throw new NotFoundHttpException('Image does not exist');
+        }
+
        try {
            try {
-                $image = $this->imageFactory->create(Path::join($this->targetDir, $path));
+                $image = $this->imageFactory->create($path);
            } catch (\InvalidArgumentException $exception) {
                throw new NotFoundHttpException($exception->getMessage(), $exception);
            }

Source: Contao security patch commit 867c0551. The patch resolves the submitted path first, then validates that it remains inside $this->targetDir before invoking the image factory.

Detection Methods for CVE-2026-107844

Indicators of Compromise

  • HTTP requests to Contao image routes containing ..%2F, %2e%2e%2f, or literal ../ sequences in the path segment.
  • BinaryFileResponse responses returning non-image content such as configuration files or source files with image extensions appended.
  • Elevated 404 response volume to image endpoints suggesting path enumeration attempts.
  • Debug responses from /images/ routes revealing absolute server paths in production logs.

Detection Strategies

  • Inspect web server and reverse proxy access logs for traversal patterns targeting the Contao images route.
  • Correlate repeated requests from the same source IP that iterate directory names or configuration filenames.
  • Flag responses to image endpoints whose Content-Length or MIME type deviates from expected image payload characteristics.

Monitoring Recommendations

  • Enable WAF rules that normalize URL-encoded traversal sequences before routing requests to the Contao application.
  • Alert on any 200 OK response from image routes serving files outside the configured image target directory.
  • Monitor for Symfony debug responses reaching production clients, which indicates misconfiguration amplifying this vulnerability.

How to Mitigate CVE-2026-107844

Immediate Actions Required

  • Upgrade Contao to version 5.3.50 or 5.7.12, which contain the Path::isBasePath() validation fix.
  • Disable Symfony debug mode (APP_ENV=prod, APP_DEBUG=0) in production to prevent absolute path disclosure.
  • Review web server logs for prior exploitation attempts against image routes and rotate any credentials or secrets stored in files that may have been exposed.

Patch Information

Contao maintainers released fixes in Contao 5.3.50 and Contao 5.7.12. The patch, documented in GitHub Security Advisory GHSA-mrvp-7wmx-5m4h, adds a Path::isBasePath() guard that rejects any resolved path outside the configured image target directory with a NotFoundHttpException.

Workarounds

  • Deploy a WAF or reverse proxy rule that blocks requests to Contao image routes containing .., %2e%2e, or backslash sequences in the path parameter.
  • Restrict contao.image.valid_extensions to a minimal set required by the site to reduce exploitable file types.
  • Apply filesystem permissions so the PHP process user cannot read sensitive files outside the webroot that share allowed image extensions.
bash
# Upgrade Contao via Composer to a patched release
composer require contao/core-bundle:^5.3.50 --with-all-dependencies
# or for the 5.7.x branch
composer require contao/core-bundle:^5.7.12 --with-all-dependencies

# Verify debug mode is disabled in production
grep -E '^APP_(ENV|DEBUG)' .env.local
# Expected output:
# APP_ENV=prod
# APP_DEBUG=0

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.