Jul 22, 2026·6 min read·38 visits
The n8n Token Exchange module blindly assigns full Public API scopes to exchanged tokens. This allows low-privileged users with a valid external JWT to escalate to administrative status and achieve remote code execution via community package installations.
CVE-2026-65595 is a high-severity privilege escalation vulnerability in the Token Exchange module of the n8n visual workflow automation platform. Due to an validation omission, the system unconditionally maps all Public API scopes to session tokens exchanged through trusted Identity Providers, entirely bypassing user-specific role checks.
The vulnerability designated as CVE-2026-65595 is a security flaw in the Token Exchange module of the n8n visual workflow automation platform. This module allows the application to exchange valid external JSON Web Tokens (JWTs) for internal session credentials. When the system processes these exchanges, it fails to evaluate the identity or authorization levels of the requesting entity, resulting in an improper privilege management condition.
The vulnerability is exploitable under specific deployment conditions. Both the Token Exchange feature and the Public API must be actively enabled. When these prerequisites are met, any authenticated user with permissions sufficient to obtain a valid trusted external JWT can escalate their privileges. This allows the executing security principal to bypass role-based access controls and perform high-privilege operations.
Ultimately, an attacker who successfully exploits this flaw achieves administrative capabilities within the n8n environment. If the configuration allows unverified Community Packages to be installed, the security boundary of the host platform can also be breached. This extends the impact of the flaw to potential remote code execution on the underlying server container.
The root cause of CVE-2026-65595 lies within the credential translation logic of the n8n Token Exchange module. When n8n receives an external JWT issued by a trusted Identity Provider (IdP), the application is designed to verify the integrity and origin of the credential. While the cryptographic signature of the token is successfully validated against the trust store, the flaw occurs during the authorization scope mapping phase.
During the construction of the internal n8n session token, the application code unconditionally binds all Public API key scopes to the session context. This mapping occurs without querying the database for the user's local role assignments. The system assumes that any token processed through the trusted exchange pathway should be granted absolute access to the Public API endpoints.
Because the system skips local role verification, there is no differentiation between low-privileged users and platform administrators during the exchange process. This omission directly leads to CWE-269 (Improper Privilege Management). The resulting internal session token is issued with maximum privileges, granting administrative power to any authenticated user regardless of their intended access limits.
To understand the implementation flaw, it is necessary to examine the authorization flow during credential processing. The application logic fails to restrict the generated scopes based on the identity context extracted from the token claims. Below is a conceptual representation of the vulnerable scope assignment sequence.
// Vulnerable Scope Assignment Logic
async function processTokenExchange(externalJwt: JwtClaims): Promise<InternalToken> {
// Confirm the identity provider signature is valid
await crypto.verifySignature(externalJwt);
// Vulnerability: Unconditionally maps administrative scopes to the session
const assignedScopes = PublicApi.getAllScopes();
return TokenService.sign({
sub: externalJwt.subject,
scopes: assignedScopes
});
}The corrected implementation implements strict validation against the local database context before generating the scopes. The application verifies the user's role and restricts the scopes to match the user's actual permissions.
// Patched Scope Assignment Logic
async function processTokenExchange(externalJwt: JwtClaims): Promise<InternalToken> {
// Confirm the identity provider signature is valid
await crypto.verifySignature(externalJwt);
// Retrieve local user data to identify authorization boundaries
const userRecord = await db.users.find({ id: externalJwt.subject });
if (!userRecord) {
throw new UnauthorizedError('Subject mapping failed');
}
// Restrict scopes based on the verified database role
const assignedScopes = PublicApi.getScopesForRole(userRecord.role);
return TokenService.sign({
sub: externalJwt.subject,
scopes: assignedScopes
});
}By querying the local database, the patched code ensures that privilege levels are strictly tied to actual user roles. This prevents arbitrary users from acquiring administrative scopes through the exchange module.
An attack sequence targeting CVE-2026-65595 requires the attacker to have low-privileged access to an identity provider trusted by the n8n platform. The attacker first requests and receives a standard, valid JWT from the external trusted identity provider. This token contains standard claims confirming the attacker's low-privileged identity.
The attacker then sends an HTTP POST request to the n8n token exchange endpoint, supplying the legitimate external JWT. The vulnerable Token Exchange module validates the token's cryptographic signature and issues an internal session token. Due to the lack of role verification, the returned session token is populated with full Public API administrative scopes.
Using this privileged internal token, the attacker targets administrative endpoints in the n8n Public API. The attacker can issue API calls to escalate their own account permissions, create a new administrator account, or delete existing workflows. If the deployment allows community packages, the attacker can leverage the Public API to install an unverified package containing arbitrary command execution payloads.
The impact of successful exploitation is critical, leading to a complete compromise of the n8n deployment. With full Public API access, an attacker can modify workflows, read database credentials stored in connection configurations, and export sensitive system data. This exposes the entire automation footprint of the target organization.
Furthermore, the downstream impacts include potential remote code execution on the server hosting the n8n instance. This scenario becomes viable if the instance allows unverified Community Packages to be installed. An attacker can deploy a custom node module containing arbitrary shell commands, which run with the system privileges of the n8n process.
The CVSS v4.0 score of 8.9 reflects the high severity of this vulnerability, particularly due to the low complexity of execution once initial access is established. Although the vulnerability requires specific configuration parameters, the potential for immediate transition from privilege escalation to host compromise underscores the risk to production environments.
Remediation of CVE-2026-65595 requires updating the n8n application to a patched version. Administrators should deploy n8n version 2.29.8 or 2.30.1 immediately depending on their release track. These versions enforce strict database checks to ensure that exchanged tokens only receive scopes corresponding to the user's configured role.
For environments where patching cannot be immediately scheduled, several temporary workarounds should be applied to eliminate the attack surface. Disabling the Token Exchange feature completely prevents incoming JWTs from being processed. If the Public API is not required for business operations, disabling it prevents the execution of administrative API calls using escalated tokens.
To prevent privilege escalation from transitioning into remote code execution, administrators must disable the installation of unverified Community Packages. This can be configured by setting the appropriate application environment variables. Restricting network access to administrative endpoints further reduces the risk of exploitation by unauthorized external actors.
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:L/SA:L| Product | Affected Versions | Fixed Version |
|---|---|---|
n8n n8n | < 2.29.8 | 2.29.8 |
n8n n8n | >= 2.30.0, < 2.30.1 | 2.30.1 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-269 (Improper Privilege Management) |
| Attack Vector | Network |
| CVSS v4.0 Score | 8.9 |
| Vulnerability Type | Privilege Escalation and Remote Code Execution |
| Exploit Status | None / Proof-of-Concept not publicly released |
| CISA KEV Status | Not Listed |
The software does not properly assign or restrict privileges, or it fails to check that the user has the necessary privileges to perform a requested action.
A critical memory handling vulnerability exists in the pageant crate, a workspace component of the Rust-based russh SSH client library, during communication with the PuTTY Pageant SSH agent on Windows systems. Prior to version 0.2.3, the library's shared memory parsing logic blindly trusted a peer-controlled, 32-bit big-endian response length field. This allows local attackers running within the same user session to trigger out-of-bounds reads or execute an out-of-memory crash of the client application.
A validation bypass vulnerability exists in Fastify web framework prior to version 5.12.2. The flaw stems from shallow normalization of header validation schemas, which fails to lowercase nested or conditional schema rules (like JSON Schema dependencies or dependentRequired) defined in mixed or canonical casing. Consequently, because Node.js normalizes incoming HTTP request headers to lowercase, the compiled validator fails to match these headers against the un-normalized mixed-case schema triggers, silently skipping conditional checks and allowing unauthenticated attackers to bypass authorization or security headers.
CVE-2026-84469 is a high-severity request validation bypass vulnerability in the Fastify Node.js web framework. In versions prior to 5.12.2, Fastify uses loose truthiness checks to decide whether to compile request schemas. When a component (such as the body) is explicitly configured with a boolean 'false' schema—which under JSON Schema Draft 7 acts as a 'deny-all' constraint—Fastify's internal logic evaluates this as a falsy value and skips compilation entirely. This allows unauthenticated remote attackers to send arbitrary payloads to these endpoints, bypassing validation checks and directly executing backend route handlers.
An authentication bypass vulnerability in the Fastify web framework allows remote attackers to access private custom not-found handlers by submitting requests with malformed URLs. This bypasses the typical request lifecycle and its associated authorization hooks.
An API contract mismatch in the Fastify web framework allows remote attackers to bypass schema validation when asynchronous schema validators are used. When a route uses async validation, the validator resolves with the raw request body. If the body contains a root-level key named 'value', the validation runner interprets this as a synchronous wrapper envelope, extracting and promoting the unvalidated nested content to the root level of request.body.
An improper neutralization of input during web page generation (CWE-79) vulnerability exists in the server-side rendering JSX engine (hono/jsx) of the Hono web framework prior to version 4.13.7. The flaw enables unauthenticated remote attackers to execute arbitrary JavaScript in the victim's browser context by supplying unescaped HTML characters into user-controlled fields rendered within specific boundary components, context providers, or direct server-side utilities.