contao/core-bundle: Contao: Path traversal in the images controller
What fixes it
- 5.3.50contao/core-bundle, composerGitHub
composer require "contao/core-bundle:^5.3.50" - 5.7.12contao/core-bundle, composerGitHub
composer require "contao/core-bundle:^5.7.12" - 5.3.50contao/core-bundle, PackagistOSV
composer require "contao/core-bundle:^5.3.50" - 5.7.12contao/core-bundle, PackagistOSV
composer require "contao/core-bundle:^5.7.12"
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
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/.
Text from GitHub Advisory Database
Affected versions 106
- contao/core-bundle, composer>= 4.1.0, < 5.3.50GitHub
- contao/core-bundle, composer>= 5.4.0-RC1, < 5.7.12GitHub
- contaoaffected: >= 5.0.0, < 5.3.50CVE List
- contaoaffected: >= 5.4.0-RC1, < 5.7.12CVE List
- contao/core-bundle, Packagistfrom 4.1.0, fixed in 5.3.50OSV
- contao/core-bundle, Packagist4.1.0OSV
- contao/core-bundle, Packagist4.1.1OSV
- contao/core-bundle, Packagist4.1.2OSV
- contao/core-bundle, Packagist4.1.3OSV
- contao/core-bundle, Packagist4.10.0OSV
- contao/core-bundle, Packagist4.10.0-RC1OSV
- contao/core-bundle, Packagist4.10.0-RC2OSV
- contao/core-bundle, Packagist4.10.0-RC3OSV
- contao/core-bundle, Packagist4.10.0-RC4OSV
- contao/core-bundle, Packagist4.10.1OSV
- contao/core-bundle, Packagist4.10.2OSV
- contao/core-bundle, Packagist4.10.3OSV
- contao/core-bundle, Packagist4.10.4OSV
- contao/core-bundle, Packagist4.10.5OSV
- contao/core-bundle, Packagist4.10.6OSV
- contao/core-bundle, Packagist4.10.7OSV
- contao/core-bundle, Packagist4.11.0OSV
- contao/core-bundle, Packagist4.11.0-RC1OSV
- contao/core-bundle, Packagist4.11.0-RC2OSV
- contao/core-bundle, Packagist4.11.1OSV
- contao/core-bundle, Packagist4.11.2OSV
- contao/core-bundle, Packagist4.11.3OSV
- contao/core-bundle, Packagist4.11.4OSV
- contao/core-bundle, Packagist4.11.5OSV
- contao/core-bundle, Packagist4.11.6OSV
- contao/core-bundle, Packagist4.11.7OSV
- contao/core-bundle, Packagist4.11.8OSV
- contao/core-bundle, Packagist4.11.9OSV
- contao/core-bundle, Packagist4.12.0OSV
- contao/core-bundle, Packagist4.12.0-RC1OSV
- contao/core-bundle, Packagist4.12.0-RC2OSV
- contao/core-bundle, Packagist4.12.0-RC3OSV
- contao/core-bundle, Packagist4.12.1OSV
- contao/core-bundle, Packagist4.12.2OSV
- contao/core-bundle, Packagist4.12.3OSV
- contao/core-bundle, Packagist4.12.4OSV
- contao/core-bundle, Packagist4.12.5OSV
- contao/core-bundle, Packagist4.12.6OSV
- contao/core-bundle, Packagist4.12.7OSV
- contao/core-bundle, Packagist4.13.0OSV
- contao/core-bundle, Packagist4.13.0-RC1OSV
- contao/core-bundle, Packagist4.13.0-RC2OSV
- contao/core-bundle, Packagist4.13.0-RC3OSV
- contao/core-bundle, Packagist4.13.1OSV
- contao/core-bundle, Packagist4.13.10OSV
- contao/core-bundle, Packagist4.13.11OSV
- contao/core-bundle, Packagist4.13.12OSV
- contao/core-bundle, Packagist4.13.13OSV
- contao/core-bundle, Packagist4.13.14OSV
- contao/core-bundle, Packagist4.13.15OSV
- contao/core-bundle, Packagistfrom 5.4.0-RC1, fixed in 5.7.12OSV
- contao/core-bundle, Packagist5.4.0OSV
- contao/core-bundle, Packagist5.4.0-RC1OSV
- contao/core-bundle, Packagist5.4.0-RC2OSV
- contao/core-bundle, Packagist5.4.0-RC3OSV
- contao/core-bundle, Packagist5.4.0-RC4OSV
- contao/core-bundle, Packagist5.4.1OSV
- contao/core-bundle, Packagist5.4.10OSV
- contao/core-bundle, Packagist5.4.11OSV
- contao/core-bundle, Packagist5.4.12OSV
- contao/core-bundle, Packagist5.4.13OSV
- contao/core-bundle, Packagist5.4.14OSV
- contao/core-bundle, Packagist5.4.2OSV
- contao/core-bundle, Packagist5.4.3OSV
- contao/core-bundle, Packagist5.4.4OSV
- contao/core-bundle, Packagist5.4.5OSV
- contao/core-bundle, Packagist5.4.6OSV
- contao/core-bundle, Packagist5.4.7OSV
- contao/core-bundle, Packagist5.4.8OSV
- contao/core-bundle, Packagist5.4.9OSV
- contao/core-bundle, Packagist5.5.0OSV
- contao/core-bundle, Packagist5.5.0-RC1OSV
- contao/core-bundle, Packagist5.5.0-RC2OSV
- contao/core-bundle, Packagist5.5.0-RC3OSV
- contao/core-bundle, Packagist5.5.0-RC4OSV
- contao/core-bundle, Packagist5.5.1OSV
- contao/core-bundle, Packagist5.5.10OSV
- contao/core-bundle, Packagist5.5.11OSV
- contao/core-bundle, Packagist5.5.12OSV
- contao/core-bundle, Packagist5.5.13OSV
- contao/core-bundle, Packagist5.5.14OSV
- contao/core-bundle, Packagist5.5.15OSV
- contao/core-bundle, Packagist5.5.16OSV
- contao/core-bundle, Packagist5.5.2OSV
- contao/core-bundle, Packagist5.5.3OSV
- contao/core-bundle, Packagist5.5.4OSV
- contao/core-bundle, Packagist5.5.5OSV
- contao/core-bundle, Packagist5.5.6OSV
- contao/core-bundle, Packagist5.5.7OSV
- contao/core-bundle, Packagist5.5.8OSV
- contao/core-bundle, Packagist5.5.9OSV
- contao/core-bundle, Packagist5.6.0OSV
- contao/core-bundle, Packagist5.6.0-RC1OSV
- contao/core-bundle, Packagist5.6.0-RC2OSV
- contao/core-bundle, Packagist5.6.0-RC3OSV
- contao/core-bundle, Packagist5.6.1OSV
- contao/core-bundle, Packagist5.6.10OSV
- contao/core-bundle, Packagist5.6.11OSV
- contao/core-bundle, Packagist5.6.2OSV
- contao/core-bundle, Packagist5.6.3OSV
- contao/core-bundle, Packagist5.6.4OSV
References 5
- github.com/contao/contao/commit/867c055122fdf12220f973f862082037b695b9bdFixvia CVE List
- github.com/contao/contao/releases/tag/5.3.50Fixvia CVE List
- github.com/contao/contao/releases/tag/5.7.12Fixvia CVE List
- github.com/contao/contao/security/advisories/GHSA-mrvp-7wmx-5m4hAdvisoryvia CVE List
- github.com/advisories/GHSA-mrvp-7wmx-5m4hAdvisoryvia GitHub