MediumGHSA-qh45-9g5p-m2v4
Craft CMS: Unauthorized Deletion of Source Assets During File Replacement
Affected versions
5.0.0-RC1 to before 5.9.21, 4.0.0-RC1 to before 4.17.14 - fixed in 5.9.21Details
We have identified an authorization issue in Craft CMS `AssetsController::actionReplaceFile` that can delete a source asset without source delete permission by supplying both `assetId` and `sourceAssetId`. ### Description Craft CMS’s `craft\\controllers\\AssetsController::actionReplaceFile()` supports replacing a target asset file using another existing asset as the source. The action loads: - `$assetToReplace` from `assetId` - `$sourceAsset` from `sourceAssetId` It then enforces replace permissions using `($assetToReplace ?: $sourceAsset)`. When both IDs are provided, this expression re
Is your site exposed?Run a free passive scan. See your platform, versions and the issues on your surface in under a minute.
Check if my site is affected