GHSA-mrvp-7wmx-5m4h
Contao: Path traversal in the images controller
Quick fix
GHSA-mrvp-7wmx-5m4h — contao/core-bundle: upgrade to the fixed version with the command below.
composer require contao/core-bundle:^5.3.50Details
`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/`.
Are you affected?
Enter the version of the package you're using.
Affected packages
4.1.0Fixed in: 5.3.50composer require contao/core-bundle:^5.3.505.4.0-RC1Fixed in: 5.7.12composer require contao/core-bundle:^5.7.12References
- https://github.com/contao/contao/security/advisories/GHSA-mrvp-7wmx-5m4h[WEB]
- https://github.com/contao/contao/commit/867c055122fdf12220f973f862082037b695b9bd[WEB]
- https://github.com/contao/contao[PACKAGE]
- https://github.com/contao/contao/releases/tag/5.3.50[WEB]
- https://github.com/contao/contao/releases/tag/5.7.12[WEB]
Check it before you install it
One call answers whether to add this package: known advisories, CISA KEV, and whether the name is a hallucinated or freshly squatted one. No key needed to try it.
curl -s https://vdb.ai.kr/v1/ai/check-packages \
-H 'Content-Type: application/json' \
-d '{"packages":["pkg:composer/contao/core-bundle"]}'