/

CVE-2026-65016

Severity:

HIGH RISK

(8.8)

Privilege Escalation (CWE-639) in n8n SSO Role Provisioning

CVE-2026-65016

Analyzed

Vulnerability type

Category:

Authorization / Privilege Escalation

CWE:

CWE-639

Impact:

Privilege Escalation to Full Instance Ownership

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

A privilege escalation flaw in n8n's Enterprise SSO instance-role provisioning allows certain SSO-authenticated users to be mapped directly to the powerful global:owner role.

If an attacker can influence the IdP-issued instance-role claim while SSO role provisioning is enabled, they may be provisioned as an instance owner and gain full administrative control over the n8n instance.

A privilege escalation flaw in n8n's Enterprise SSO instance-role provisioning allows certain SSO-authenticated users to be mapped directly to the powerful global:owner role.

If an attacker can influence the IdP-issued instance-role claim while SSO role provisioning is enabled, they may be provisioned as an instance owner and gain full administrative control over the n8n instance.

Affected context

This vulnerability occurs in n8n deployments that:

  • Use Enterprise SSO for authentication, and
  • Have instance-role provisioning enabled via N8N_SSO_SCOPES_PROVISION_INSTANCE_ROLE, and
  • Rely on IdP-supplied role claims to assign n8n global roles.

In this context, the SSO provisioning logic does not explicitly block assignment of the global:owner role, allowing a role claim that resolves to global:owner to be accepted and provisioned. The issue does not affect paths that already implement explicit owner-role rejection (such as the token-exchange identity path).

This vulnerability occurs in n8n deployments that:

  • Use Enterprise SSO for authentication, and
  • Have instance-role provisioning enabled via N8N_SSO_SCOPES_PROVISION_INSTANCE_ROLE, and
  • Rely on IdP-supplied role claims to assign n8n global roles.

In this context, the SSO provisioning logic does not explicitly block assignment of the global:owner role, allowing a role claim that resolves to global:owner to be accepted and provisioned. The issue does not affect paths that already implement explicit owner-role rejection (such as the token-exchange identity path).

Exploit preconditions

  • Attack surface: n8n Enterprise SSO login endpoint where instance-role claims are consumed.
  • Required access: Ability to authenticate via the configured IdP to the target n8n instance.
  • IdP control: The attacker must be able to control or meaningfully influence the instance-role claim value issued by the IdP (e.g., through misconfigured group/attribute mappings, self-assignable roles, or compromised IdP administration).
  • Feature flags/config: Enterprise SSO must be enabled and N8N_SSO_SCOPES_PROVISION_INSTANCE_ROLE turned on for instance-role provisioning.
  • Why exploitation is possible: The provisioning logic maps IdP role claims directly to n8n global roles and does not enforce a restriction on the global:owner role, allowing an attacker-controlled claim to escalate privileges to instance owner.
  • Attack surface: n8n Enterprise SSO login endpoint where instance-role claims are consumed.
  • Required access: Ability to authenticate via the configured IdP to the target n8n instance.
  • IdP control: The attacker must be able to control or meaningfully influence the instance-role claim value issued by the IdP (e.g., through misconfigured group/attribute mappings, self-assignable roles, or compromised IdP administration).
  • Feature flags/config: Enterprise SSO must be enabled and N8N_SSO_SCOPES_PROVISION_INSTANCE_ROLE turned on for instance-role provisioning.
  • Why exploitation is possible: The provisioning logic maps IdP role claims directly to n8n global roles and does not enforce a restriction on the global:owner role, allowing an attacker-controlled claim to escalate privileges to instance owner.

Why this happens

The underlying issue is an authorization design flaw aligning with CWE-639: Authorization Bypass Through User-Controlled Key.

The SSO provisioning path treats an IdP-supplied role claim as a trusted selector for high-privilege n8n global roles without sufficient server-side constraints. Unlike the token-exchange identity path, which explicitly rejects owner-role assignment, the instance-role provisioning logic fails to enforce a denylist or policy that prevents direct mapping to global:owner. This creates a situation where a user, by manipulating or benefiting from misconfigured IdP role attributes, can have their account provisioned with an administrative role that should only be assigned through tightly controlled administrative workflows.

The underlying issue is an authorization design flaw aligning with CWE-639: Authorization Bypass Through User-Controlled Key.

The SSO provisioning path treats an IdP-supplied role claim as a trusted selector for high-privilege n8n global roles without sufficient server-side constraints. Unlike the token-exchange identity path, which explicitly rejects owner-role assignment, the instance-role provisioning logic fails to enforce a denylist or policy that prevents direct mapping to global:owner. This creates a situation where a user, by manipulating or benefiting from misconfigured IdP role attributes, can have their account provisioned with an administrative role that should only be assigned through tightly controlled administrative workflows.

Potential impact

  • An SSO-authenticated user may be escalated to global:owner for the instance.
  • Attackers could gain full administrative control over workflows, their execution, and scheduling.
  • Existing and new credentials stored in n8n can be viewed, modified, or exfiltrated.
  • User management can be altered, including creating, disabling, or changing roles of other users.
  • Instance-wide configuration, integrations, and security settings can be modified, weakening defenses or enabling persistence.
  • An SSO-authenticated user may be escalated to global:owner for the instance.
  • Attackers could gain full administrative control over workflows, their execution, and scheduling.
  • Existing and new credentials stored in n8n can be viewed, modified, or exfiltrated.
  • User management can be altered, including creating, disabling, or changing roles of other users.
  • Instance-wide configuration, integrations, and security settings can be modified, weakening defenses or enabling persistence.

General mitigation guidance

Effective mitigation focuses on tightening the trust boundary around IdP-issued role claims and enforcing stricter role-mapping policies:

  • Introduce explicit server-side restrictions that prevent SSO or any automated provisioning path from assigning the global:owner role.
  • Separate high-privilege role assignment from automated IdP-driven mappings; require manual, auditable administrative action for instance-owner promotion.
  • Implement an allowlist of roles eligible for SSO-based provisioning, excluding any owner or equivalent high-privilege roles.
  • Harden IdP configurations so that role or group attributes used for n8n mappings cannot be arbitrarily modified by end users and are only managed by trusted administrators.
  • Apply least-privilege principles to role design and avoid overloading roles with permissions beyond what is operationally necessary.

Effective mitigation focuses on tightening the trust boundary around IdP-issued role claims and enforcing stricter role-mapping policies:

  • Introduce explicit server-side restrictions that prevent SSO or any automated provisioning path from assigning the global:owner role.
  • Separate high-privilege role assignment from automated IdP-driven mappings; require manual, auditable administrative action for instance-owner promotion.
  • Implement an allowlist of roles eligible for SSO-based provisioning, excluding any owner or equivalent high-privilege roles.
  • Harden IdP configurations so that role or group attributes used for n8n mappings cannot be arbitrarily modified by end users and are only managed by trusted administrators.
  • Apply least-privilege principles to role design and avoid overloading roles with permissions beyond what is operationally necessary.

How teams detect issues like this

Organizations can detect and monitor for this class of issue using:

  • Configuration reviews: Periodically review n8n SSO configuration, focusing on whether N8N_SSO_SCOPES_PROVISION_INSTANCE_ROLE is enabled and how role mappings are defined.
  • IdP policy audits: Inspect IdP group/attribute mappings that feed into n8n role claims, ensuring only controlled groups map to elevated roles.
  • Logging and alerting: Enable and review authentication and provisioning logs to detect unexpected owner-role assignments or changes in user role distribution.
  • Static and policy checks: Use configuration-as-code, security policy enforcement, or automated review tools to flag high-privilege roles being assigned via automated SSO provisioning paths.

Organizations can detect and monitor for this class of issue using:

  • Configuration reviews: Periodically review n8n SSO configuration, focusing on whether N8N_SSO_SCOPES_PROVISION_INSTANCE_ROLE is enabled and how role mappings are defined.
  • IdP policy audits: Inspect IdP group/attribute mappings that feed into n8n role claims, ensuring only controlled groups map to elevated roles.
  • Logging and alerting: Enable and review authentication and provisioning logs to detect unexpected owner-role assignments or changes in user role distribution.
  • Static and policy checks: Use configuration-as-code, security policy enforcement, or automated review tools to flag high-privilege roles being assigned via automated SSO provisioning paths.

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-35q8-9mj6-wjmf
vulncheck.comvulncheck.com/advisories/n8n-before-privilege-escalation-via-sso-instance-role

Frequently asked

questions

Yes, if the n8n instance is exposed through SSO and the attacker can authenticate via the configured IdP while influencing the role claim, they can attempt exploitation remotely.

Not necessarily. They need the ability to affect the instance-role claim value used for n8n role mapping. This could come from IdP misconfigurations (e.g., user-managed group memberships) or direct IdP admin control. The exact requirement depends on how the IdP and role mappings are configured.

The safest pattern is to prevent automated SSO-based provisioning from ever assigning the global:owner role, ensuring that owner-level access is only granted through explicit administrative workflows with strong change control and auditing.

Treat all externally supplied identity and role attributes as untrusted inputs, enforce strict allowlists for role provisioning, distinguish between ordinary and high-privilege roles in mapping logic, and regularly review IdP and SSO configurations as part of access control governance.

Yes, if the n8n instance is exposed through SSO and the attacker can authenticate via the configured IdP while influencing the role claim, they can attempt exploitation remotely.

Not necessarily. They need the ability to affect the instance-role claim value used for n8n role mapping. This could come from IdP misconfigurations (e.g., user-managed group memberships) or direct IdP admin control. The exact requirement depends on how the IdP and role mappings are configured.

The safest pattern is to prevent automated SSO-based provisioning from ever assigning the global:owner role, ensuring that owner-level access is only granted through explicit administrative workflows with strong change control and auditing.

Treat all externally supplied identity and role attributes as untrusted inputs, enforce strict allowlists for role provisioning, distinguish between ordinary and high-privilege roles in mapping logic, and regularly review IdP and SSO configurations as part of access control governance.

Find out what's already
exploitable in your codebase.