Summary
Craft CMS's GraphQL API contains an authorization flaw where the saveAsset mutation checks permissions against one asset volume but then operates on an asset fetched by ID without ensuring it belongs to that authorized volume.
An authenticated user with write access to any single asset volume can leverage this mismatch to modify or transfer assets in other volumes, including restricted or private volumes they should not be able to access.
Affected context
This vulnerability affects Craft CMS installations that:
- Expose the GraphQL API to authenticated users, and
- Grant users write access to at least one asset volume, and
- Use the
saveAssetGraphQL mutation to manage assets across volumes.
The issue arises in flows where the client can specify or control asset IDs: the authorization is performed against a volume derived from the GraphQL schema, but the subsequent asset lookup by ID is not revalidated to ensure the asset actually resides in that volume. In such conditions, cross-volume asset modification and transfer becomes possible.
Exploit preconditions
- Attack surface: Craft CMS GraphQL API, specifically the
saveAssetmutation. - Required access: Valid authenticated account with write permissions to at least one asset volume and the ability to execute GraphQL mutations.
- Trigger point: Invocation of
saveAssetwhere an attacker supplies the ID of an asset in a different volume than the one for which they are authorized. - Why exploitation is possible: The authorization check is bound to the schema-resolved volume but the subsequent asset retrieval is based solely on the supplied asset ID, without confirming the asset's volume membership. This mismatch is a classic Insecure Direct Object Reference (CWE-639), allowing access to objects (assets) outside the intended authorization scope.
Why this happens
The underlying bug is a broken authorization check caused by separating the authorization decision from the actual resource being acted upon.
In this case, Craft CMS's GraphQL saveAsset mutation:
- Validates that the caller has permission to modify assets in a particular volume inferred from the GraphQL schema, but
- Fetches the target asset by ID and proceeds without verifying that this asset belongs to that authorized volume.
This maps directly to CWE-639: Insecure Direct Object Reference, where an application uses externally supplied identifiers (asset IDs) to access internal objects without confirming that the requester is authorized for those specific objects. The abstract insecure pattern is: authorization is granted on a generic capability or container, but actions are performed on a concrete resource whose relationship to the checked container is not revalidated.
Potential impact
- Unauthorized modification of assets in restricted or private volumes.
- Unauthorized transfer of assets between volumes, potentially exposing sensitive files.
- Privilege escalation from limited asset-volume access to effective control over all asset volumes.
- Confidentiality breaches if private media or documents are moved to publicly accessible volumes.
- Integrity issues through tampering with assets relied on by other systems or public-facing content.
General mitigation guidance
Mitigation focuses on enforcing authorization at the level of the actual resource being operated on and keeping authorization checks tightly coupled to resource resolution.
Defensive patterns include:
- Object-level authorization: Always perform permission checks on the concrete asset instance after it has been loaded, ensuring the asset's volume and ownership are consistent with the caller's privileges.
- Consistency between schema and resource lookup: Ensure that any volume or container resolved from the schema matches the volume or container of the fetched asset, failing the operation if they diverge.
- Least-privilege permissions: Design asset volume permissions such that users and API clients receive only the minimal volumes they need to write to, reducing blast radius if a similar flaw appears.
- Centralized authorization logic: Use shared, well-tested helper functions or middleware for resource-level checks rather than duplicating ad hoc authorization logic per endpoint or mutation.
- Defense-in-depth on asset operations: Apply secondary checks when moving assets between volumes, such as validating both source and destination permissions for the current user.
How teams detect issues like this
Detection efforts can target both code-level issues and anomalous runtime behavior.
Possible strategies:
- Static analysis and code review:
- Search for GraphQL mutations or controllers that:
- Accept resource IDs (e.g., asset IDs) as input, and
- Perform authorization only against a container (volume, folder, project) inferred from route or schema, without rechecking the resource's actual container.
- Flag patterns where authorization precedes resource lookup and is not repeated or validated after the actual resource is loaded.
- Enforce secure coding guidelines that mandate object-level permission checks on every state-changing operation.
- Automated policy enforcement:
- Use custom linters or SAST tools to detect use of direct ID-based lookups without accompanying access checks.
- Implement framework-level hooks that verify a resource's container or owner during asset save/transfer operations.
- Runtime monitoring:
- Log asset modifications and transfers with user identity and volume IDs.
- Alert on unusual cross-volume operations, especially where a user with limited volume access appears to interact with previously unseen volumes.

