Oct 10, 2026·5 min read·26 visits
Unauthenticated path traversal in Contao ImagesController permits arbitrary reading of localized files matching allowed extensions and system directory probing.
A path traversal vulnerability (CWE-22) in Contao CMS allows unauthenticated remote attackers to bypass directory boundary restrictions in ImagesController and access files within the project directory.
A path traversal vulnerability exists within the dynamic image processing sub-system of Contao CMS. The flaw is located in the ImagesController component (core-bundle/src/Controller/ImagesController.php), which processes image resizing and serving requests derived from URL parameters.
When a request targets an image asset, ImagesController resolves the user-supplied {path} route parameter against a designated image target directory. Because the component fails to enforce directory boundary checks on the resolved path, relative directory traversal sequences allow the canonical path to reference locations higher up in the application filesystem hierarchy.
This vulnerability is accessible to unauthenticated remote attackers over HTTP or HTTPS endpoints handling image transformations. Although file retrieval is limited to file extensions allowed by the system configuration, an attacker can enumerate local files, verify filesystem structures, or trigger verbose debug errors that reveal absolute filesystem paths.
The underlying security weakness stems from an inadequate validation step prior to instantiating image processing objects. In affected Contao releases, ImagesController utilizes the Symfony Path::join() utility to combine the base target directory ($this->targetDir) with the client-provided path parameter ($path).
While Path::join() normalizes dot segments such as . and .., it does not restrict the canonicalized output path to the base directory prefix. As a result, if $path contains parent directory traversals like ../.., Path::join() produces an absolute path outside the intended target directory scope.
Because the controller previously passed this path directly into $this->imageFactory->create(), the system attempted to access and process the target file without validating ownership or location relative to $this->targetDir. The missing safeguard is the invocation of Path::isBasePath($this->targetDir, $path), which verifies that the resolved path resides strictly within the target base path.
Analysis of the vulnerable implementation in core-bundle/src/Controller/ImagesController.php shows that the path parameter was joined inline during factory creation:
// Vulnerable code in core-bundle/src/Controller/ImagesController.php
public function __invoke(string $path): Response
{
try {
try {
// Path::join resolves '..' but does not restrict output to $this->targetDir
$image = $this->imageFactory->create(Path::join($this->targetDir, $path));
} catch (\InvalidArgumentException $exception) {
throw new NotFoundHttpException($exception->getMessage(), $exception);
}The security patch introduced in commit 867c055122fdf12220f973f862082037b695b9bd resolves the target path prior to processing and enforces explicit boundary checking via Path::isBasePath():
// Patched code in core-bundle/src/Controller/ImagesController.php
public function __invoke(string $path): Response
{
// Step 1: Pre-join and normalize the path
$path = Path::join($this->targetDir, $path);
// Step 2: Validate that the resolved path stays within $this->targetDir
if (!Path::isBasePath($this->targetDir, $path)) {
throw new NotFoundHttpException('Image does not exist');
}
try {
try {
// Step 3: Pass normalized, validated path to the image factory
$image = $this->imageFactory->create($path);
} catch (\InvalidArgumentException $exception) {
throw new NotFoundHttpException($exception->getMessage(), $exception);
}Unit tests were added in core-bundle/tests/Controller/ImagesControllerTest.php to confirm that passing ../dummy.jpg triggers a NotFoundHttpException without invoking ImageFactoryInterface::create().
An attack against CVE-2026-107844 involves sending a crafted HTTP GET request to routes managed by ImagesController. Prerequisites for exploitation include network access to the application endpoints and knowledge of target paths relative to the image storage location.
An attacker supplies path traversal payloads embedded in the route parameter, such as /assets/images/../../system/config/config.png. If the requested file exists and its extension matches allowed entries in contao.image.valid_extensions, the controller processes the file and returns it inside a Symfony BinaryFileResponse object.
If the target file extension is not permitted, the system returns an error response; however, distinct response codes and execution timings allow attackers to differentiate between existing files, missing files, and unpermitted file formats. In environments where application debug features are active, detailed error stacks return absolute system filesystem paths.
The CVSS v3.1 base score for CVE-2026-107844 is evaluated at 5.3 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N). The vulnerability exhibits high exploitability due to its unauthenticated remote nature and low attack complexity.
Impact is constrained primarily to Confidentiality (C:L). An attacker cannot modify files (I:N) or trigger denial of service conditions directly (A:N). Furthermore, scope remains unchanged (S:U) because traversal cannot breach host kernel boundaries or container isolates beyond web server process permissions.
Threat classification aligns with MITRE ATT&CK techniques T1083 (File and Directory Discovery) and T1005 (Data from Local System). While EPSS metrics place likelihood of automated exploitation at a low baseline, exposure risks remain elevated for deployments disclosing debug information.
Remediation requires updating the contao/contao dependency to a patched version. Environments running Contao 5.3.x must update to 5.3.50 or higher, and environments running Contao 5.7.x must update to 5.7.12 or higher.
Execute the following Composer command in the project root directory to retrieve updated package dependencies:
composer update contao/contao --with-dependenciesFor environments where immediate maintenance updates cannot be performed, Web Application Firewall (WAF) filtering rules should be deployed to detect and block URL-encoded traversal sequences such as %2e%2e%2f, %2e%2e/, and ..%2f within target image routing URIs.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
Contao CMS Contao | >= 5.0.0, < 5.3.50 | 5.3.50 |
Contao CMS Contao | >= 5.4.0-RC1, < 5.7.12 | 5.7.12 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) |
| CVSS v3.1 Score | 5.3 (Medium) |
| CVSS Vector | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N |
| Attack Vector | Network (Unauthenticated HTTP/HTTPS GET requests) |
| EPSS Score | 0.00312 (22.18th percentile) |
| Impact | Partial Information Disclosure / Local File Enumeration |
| Exploit Status | Proof of Concept / Public Commit Diffs Available |
| CISA KEV Status | Not Listed |
The software uses external input to construct a pathname that should be restricted to a directory within a restricted parent directory, but does not properly neutralize special elements such as '..' sequences.
Canonical LXD and LXC Incus contain an arbitrary file write vulnerability (CWE-73 / CWE-59) in the `/1.0/instances/<name>/exec` REST API endpoint. When an instance is unpacked from an image archive, top-level symbolic links are extracted directly onto the host filesystem within the instance storage directory. If a crafted image includes a symbolic link named `exec-output` pointing to an arbitrary host path, invoking the execution endpoint with `record-output: true` causes the privileged host daemon to follow the symlink and write command output files directly to the target host directory. An authenticated attacker with permissions to import images and execute commands can exploit this flaw to write controlled content to sensitive host directories such as `/etc/cron.d`, resulting in arbitrary code execution on the host as `root`.
CVE-2026-48749 (tracked as GHSA-vghh-5rfx-xhq8 for LXD and GHSA-2q3f-q5pq-g8wv for Incus) is a critical container escape vulnerability in the Canonical LXD and Linux Containers Incus system container managers. By importing a specially crafted container image archive containing duplicate tar member headers, an authenticated attacker can replace the instance rootfs directory with a symbolic link pointing to the underlying host root filesystem. When performing file operations on a stopped container, the privileged forkfile helper binary resolves the symbolic link without confinement and chroots directly into the host filesystem, granting arbitrary root-level file read and write access.
GHSA-fmc8-p6q7-75cc (associated with CVE-2026-48755) is a critical argument injection vulnerability in Canonical LXD (github.com/canonical/lxd). The vulnerability occurs during instance and storage volume backup operations when processing the user-supplied compression_algorithm configuration parameter. While LXD validates the primary executable token against an allowlist of supported compression binaries, it fails to sanitize or restrict subsequent tokens parsed via shellquote.Split. These additional arguments are passed directly to exec.Command. An authenticated attacker with privileges to trigger backups can inject command-line flags for utilities like zstd to read staged files from a container filesystem and write them to arbitrary paths on the underlying host filesystem, such as /etc/cron.d/, achieving root-level arbitrary code execution on the host.
A critical path traversal vulnerability caused by improper input validation (CWE-20) exists in the direct image download handler of Canonical LXD and Linux Containers Incus. When an authenticated user requests an image import using the URL source type, the daemon reads the image fingerprint from an untrusted HTTP response header (`Incus-Image-Hash` or `LXD-Image-Hash`) without validating that it conforms to a SHA-256 format. This unvalidated string is concatenated directly into a filesystem path via `filepath.Join` prior to file creation and cryptographic verification, allowing directory traversal sequences to write arbitrary files on the host filesystem as root.
CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.
An operating system command injection vulnerability (CWE-78) exists in GeoNode versions prior to 5.1.0. The vulnerability occurs in the vector upload processing pipeline when handling user-supplied geospatial files. By supplying a crafted layer name containing shell metacharacters, an authenticated attacker with basic data upload privileges can execute arbitrary commands on the underlying server or container hosting the GeoNode application and Celery worker processes.