/

CVE-2026-25497

Severity:

HIGH RISK

(8.8)

Broken Authorization / Insecure Direct Object Reference

CVE-2026-25497

Analyzed

Vulnerability type

Category:

Broken Authorization / Insecure Direct Object Reference

CWE:

CWE-639

Impact:

Privilege Escalation and Unauthorized Data Access/Modification

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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 saveAsset GraphQL 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 saveAsset mutation.
  • 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 saveAsset where 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.

Sources

SourceLink
github.comgithub.com/craftcms/cms/commit/ac7edf868c1a81fd9c4dc49d3b3edf1cce113409
github.comgithub.com/craftcms/cms/releases/tag/5.8.22
github.comgithub.com/craftcms/cms/security/advisories/GHSA-fxp3-g6gw-4r4v

Frequently asked

questions

Exploitation is limited to authenticated users who can access the GraphQL API and have write permissions to at least one asset volume. Within that scope, however, a user may be able to affect assets in any other volume, including restricted ones, depending on configuration.

No. The attacker only needs a non-admin account with write access to a single asset volume and the ability to execute the saveAsset mutation. They do not require direct access rights to the targeted volumes.

The safest approach is to always perform authorization against the concrete resource after it has been loaded. In practice, this means: load the asset by ID, confirm its volume (and any other relevant attributes), and only then proceed if the current user has explicit rights for that specific asset and its volume.

Preventing similar issues involves institutionalizing object-level access control: design APIs so that permission checks are centralized, always tied to the actual resource instance, and enforced uniformly. Combine this with secure coding standards, mandatory code review focused on access control logic, and automated checks that flag resource operations that do not clearly validate user permissions on the targeted object.

Find out what's already
exploitable in your codebase.