# GHSA-XJXQ-PJ7H-G676: TUS Upload Authorization Bypass Allows Cross-User File Overwrite

- Database: GitHub
- Severity: CVSS 7.1 (High)
- Published: 2026-08-05
- Modified: 2026-12-02

## Tracked as

- [CVE-2026-142071](https://cve.now/CVE-2026-142071.md): Directus 10.13.0 before 12.1.0 Cross-User File Overwrite via TUS Upload replace\_id Metadata

## Affected versions

- directus (npm): from 10.13.0, fixed in 12.1.0

## Description

## Summary

On Directus instances with the TUS resumable upload endpoint enabled (`TUS_ENABLED=true`), the endpoint did not enforce item level authorization on the file targeted by an upload replacement. An authenticated user holding `create` and `update` permission on `directus_files` could overwrite any other user's file, both its stored contents and its `directus_files` record, by naming the victim's file id in the `Upload-Metadata` header of a new upload.

This is a variant of [GHSA-qqmv-5p3g-px89](https://github.com/directus/directus/security/advisories/GHSA-qqmv-5p3g-px89). The fix for that advisory added an item level access check for the `id` upload metadata key, but the upload completion handlers acted on a second, adjacent metadata key (`replace_id`) that was never validated against the caller. An upload supplying only `replace_id` was evaluated as an ordinary `create` against the caller's own permissions, while the completion path resolved and rewrote the referenced record using internal services that run without accountability.

The same upload path also lacked two guards that the regular `/files` endpoint applied to a client supplied `filename_disk`: storage path normalization and the filename uniqueness check. That gave a second route to clobbering another user's stored object, and, on deployments where the extensions or temporary directory sits inside the configured storage location, to writing into those directories.

## Impact

- **Cross-user file overwrite.** The attacker needs only their own create and update permission on `directus_files` plus the target file's id. File ids are not secrets: they appear in asset URLs, relational payloads, and ordinary API responses.
- **Metadata rewrite at elevated privilege.** The victim's record was updated by an internal service instantiated without accountability, so per field permissions and item level rules on the victim's record did not apply. Attacker controlled `filename_download`, `filesize`, `type`, and extracted `metadata` replaced the original values.
- **Content substitution under the original owner's identity.** The record's `id` and `uploaded_by` were preserved, so any consumer that trusts the record's owner (published content referencing an asset by id, CDN cached asset URLs, email templates, documents attached to records) served the attacker's content in place of the original.
- **Loss of the original data.** The previously stored object and its generated thumbnails were deleted as part of the replacement, so the original content was not recoverable from Directus.

No credential disclosure and no direct code execution were identified, and reading another user's file content was not part of this issue.

## Affected versions

- Package: `directus` (npm), and the corresponding `directus/directus` container images
- Affected: `>= 10.13.0, < 12.1.0`
- Patched: `12.1.0`

Preconditions: `TUS_ENABLED=true` (this is not the default) and an attacker role whose policy grants `create` and `update` on `directus_files`.

The affected metadata handling was introduced together with TUS support in 10.13.0. Versions below 11.16.1 are additionally affected by GHSA-qqmv-5p3g-px89. The fix was not backported, so instances on 11.x need to move to 12.1.0 or later.

## Severity

**High, 7.1**

`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L`

- **AV:N** the TUS endpoint is reachable over the network.
- **AC:L** a single upload creation request with one extra metadata key, no race or special conditions.
- **PR:L** any authenticated role with create and update on `directus_files`, which is a routine grant for content editors.
- **UI:N** no action by the victim is required.
- **S:U** the impact stays within the Directus authorization scope.
- **C:N** the attacker gains no read access to the victim's data.
- **I:H** arbitrary overwrite of another user's file contents and privileged rewrite of its metadata record.
- **A:L** the original stored object and its thumbnails are destroyed, so that asset is lost to legitimate consumers.

This matches the score assigned to GHSA-qqmv-5p3g-px89, which shares the impact class.

## Weaknesses

- **CWE-639:** Authorization Bypass Through User-Controlled Key
- **CWE-863:** Incorrect Authorization

## Workarounds

Set `TUS_ENABLED=false` until you can upgrade. Restricting `create` and `update` on `directus_files` to trusted roles reduces the population able to reach the endpoint but does not remove the issue for those roles.

## Credit

Reported by @tr4ce-ju.

## References

- https://github.com/directus/directus/security/advisories/GHSA-xjxq-pj7h-g676

Page: https://cve.now/GHSA-XJXQ-PJ7H-G676

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
