/

CVE-2026-32267

Severity:

CRITICAL RISK

(9.8)

Improper Authorization in Craft CMS UsersController

CVE-2026-32267

Analyzed

Vulnerability type

Category:

Improper Authorization

CWE:

CWE-863

Impact:

Privilege Escalation to Administrator

Severity:

CRITICAL RISK

(9.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 contains an improper authorization flaw in the user impersonation flow, where a low-privilege or shared-URL user can abuse the UsersController->actionImpersonateWithToken endpoint to become an administrator.

When an attacker can obtain or trigger a valid impersonation token without appropriate privilege checks, they can escalate to full admin access and take over the CMS instance.

Affected context

The vulnerability appears in Craft CMS installations that:

  • Run affected 4.x or 5.x versions where UsersController->actionImpersonateWithToken is exposed
  • Use shared URLs or tokenized links that allow limited access for low-privilege or unauthenticated users
  • Rely on user impersonation features without strict server-side permission enforcement

It becomes relevant in deployments where support, preview, or account-sharing workflows use impersonation tokens and assume those tokens cannot grant higher privileges than the current user.

Exploit preconditions

  • Attack surface: Web application (HTTP endpoints of Craft CMS).
  • Required access: A low-privilege account, or access to a shared URL that grants limited, token-based access.
  • Trigger point: Invoking UsersController->actionImpersonateWithToken with a crafted or existing impersonation token.
  • Why exploitation is possible: The impersonation endpoint does not sufficiently validate that the caller is authorized to impersonate the targeted account, allowing token-based escalation from a constrained context to administrator privileges.

Why this happens

This issue stems from improper authorization checks around user impersonation, mapping to CWE-863: Improper Authorization.

The actionImpersonateWithToken logic trusts the presence and validity of an impersonation token but does not rigorously tie that token to the requester's current privileges or intended scope.

As a result, a low-privilege or shared-URL user can leverage a token to impersonate an administrator, bypassing normal access-control rules.

Conceptually, this is an authorization bug where a high-privilege action (impersonating an admin) is gated only by token possession rather than by a combination of identity, role, and context-aware permission checks.

Potential impact

  • Full administrative access to the Craft CMS instance.
  • Creation, modification, or deletion of content and site configuration.
  • Management of user accounts, including adding or removing admin users.
  • Access to sensitive data stored in the CMS, including private content and configuration secrets.
  • Installation or modification of plugins and templates that could introduce additional security risks.
  • Lateral movement into integrated services if the CMS is used as a control plane or integration hub.

General mitigation guidance

Mitigation focuses on enforcing strict, role-aware authorization for impersonation and token-based access:

  • Treat impersonation as a high-risk capability that is restricted to explicitly privileged roles (e.g., admins with a dedicated permission).
  • Bind impersonation tokens to both the issuer and the target account, ensuring the requester cannot use tokens beyond their own effective privileges.
  • Make impersonation tokens short-lived, single-use, and tightly scoped to specific actions or views instead of granting full account control.
  • Validate, on every impersonation request, that the caller's current session and role are allowed to impersonate the requested user.
  • Reduce reliance on broadly scoped shared URLs; where necessary, constrain them to read-only or narrowly defined operations.
  • Apply the principle of least privilege in user and role design so that accidental escalation paths are minimized even if a token is misused.

How teams detect issues like this

Effective detection strategies include:

  • Reviewing controller actions handling impersonation or token-based login for:
  • Missing role checks before switching identities
  • Logic that trusts token possession without validating caller privileges
  • Flows where low-privilege or unauthenticated contexts can reach impersonation endpoints
  • Using static analysis rules to flag patterns such as:
  • Account context changes (impersonate, switchUser, loginAs) without adjacent authorization checks.
  • Implementing logging and monitoring for:
  • Impersonation events, especially those originating from shared URLs or non-admin accounts.
  • Sudden privilege changes or admin-level activity from previously low-privilege users.
  • Enforcing security review of features involving:
  • Magic links, shared URLs, or token-based access mechanisms.
  • Administrative workflows that act "on behalf of" another user.
  • Leveraging automated application security testing tools that:
  • Exercise token-based and impersonation endpoints.
  • Attempt privilege escalation from low-privilege sessions.

Sources

SourceLink
github.comgithub.com/craftcms/cms/commit/6301e217c5f15617d939c432cb770db50af14b33
github.comgithub.com/craftcms/cms/security/advisories/GHSA-cc7p-2j3x-x7xf

Frequently asked

questions

Yes. An attacker with access to a low-privilege account or a shared URL can exploit the flaw remotely over HTTP, without needing local system access.

Not strictly. An authenticated low-privilege user can exploit it, and an unauthenticated attacker may also do so if they are given or can obtain a shared URL that grants them a token-based session.

The safest pattern is to enforce explicit authorization checks around all impersonation and token-based flows, allowing only trusted roles to perform user impersonation and binding tokens to both the issuer's privileges and the target account. Tokens should also be tightly scoped and short-lived.

Design access control around clear, centralized policies:

  • Treat impersonation and login-as features as privileged operations.
  • Require explicit permissions and contextual checks before changing identity.
  • Include token-based access flows in threat modeling and security reviews.
  • Add automated tests that try to perform admin-level actions from low-privilege or token-only sessions.
Find out what's already
exploitable in your codebase.