VDB
Sign up
MEDIUM5.3

GHSA-472v-j2g4-g9h2

Craft CMS has a Path Traversal Vulnerability in AssetsController

Quick fix

GHSA-472v-j2g4-g9h2 — craftcms/cms: upgrade to the fixed version with the command below.

composer require craftcms/cms:^4.17.5

Details

The `AssetsController->replaceFile()` method has a `targetFilename` body parameter that is used unsanitized in a `deleteFile()` call before `Assets::prepareAssetName()` is applied on save. This allows an authenticated user with `replaceFiles` permission to delete arbitrary files within the same filesystem root by injecting `../` path traversal sequences into the filename.

This could allow an authenticated user with `replaceFiles` permission on one volume to delete files in other folders/volumes that share the same filesystem root.

This only affects local filesystems.

Users should update to Craft 4.17.5 or 5.9.11 to mitigate the issue.

Are you affected?

Enter the version of the package you're using.

Affected packages

Packagist/craftcms/cms
Introduced in: 4.0.0-RC1Fixed in: 4.17.5
Fixcomposer require craftcms/cms:^4.17.5
Packagist/craftcms/cms
Introduced in: 5.0.0-RC1Fixed in: 5.9.11
Fixcomposer require craftcms/cms:^5.9.11

References