NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · n8n

CVE-2026-65595: n8n: Privilege Escalation and Code Execution via Full Public API Key Scope Assignment to Token Exchange JWTs

highCVSS 4.0 8.9GHSA-777w-rpr6-c52h

n8n's Token Exchange module issued JWT access tokens carrying every Public API key scope, whatever the user's real role. A low-privileged user with a valid external JWT can call administrator-only Public API operations: change roles, create and delete users, and install community packages for code execution. Fixed in n8n 2.29.8 and 2.30.1.

Published Jul 22, 2026 · Analysis Oct 25, 2026

What an attacker can do

Token Exchange swaps a trusted external JWT for an n8n access token. The tokens it issued were assigned all Public API scopes, not scopes limited by the acting user's role. So a member could use the token to reach admin-only Public API calls such as role escalation, user creation and user deletion.

The attacker needs an external JWT accepted by a configured trusted key. Both the Token Exchange feature and the Public API must be on (N8N_TOKEN_EXCHANGE_ENABLED=true and N8N_ENV_FEAT_TOKEN_EXCHANGE=true).

Two further conditions widen the damage. Role escalation also requires an Advanced Permissions license. Code execution comes through community package installation, which requires N8N_COMMUNITY_PACKAGES_ENABLED=true and N8N_UNVERIFIED_PACKAGES_ENABLED=true. With those set, the attacker installs a malicious unverified package, and its code runs on the n8n host.

The result can be a new admin account, deleted users, or code execution as the n8n process, with access to stored credentials. The CVSS 4.0 score is 8.9. This is separate from CVE-2026-59208, which covers issuer confusion in the same module.

Who is affected

The n8n npm package before 2.29.8, and 2.30.0 before 2.30.1. Only instances with Token Exchange and the Public API both enabled are affected, and the attacker must be able to get a JWT trusted by a configured issuer key.

npm ls n8n

For Docker, check the image tag and the environment for the two Token Exchange variables.

n8n

Ecosystem
npm
Affected
>= 2.30.0, < 2.30.1
Fixed in
2.30.1
Check
npm ls n8n

n8n

Ecosystem
npm
Affected
< 2.29.8
Fixed in
2.29.8
Check
npm ls n8n

How to fix it

Upgrade to n8n 2.29.8 or 2.30.1, or later.

npm install [email protected]

Temporary mitigations from the advisory, which do not fully remediate the risk:

  • Set N8N_TOKEN_EXCHANGE_ENABLED=false or N8N_ENV_FEAT_TOKEN_EXCHANGE=false.
  • If Token Exchange must stay on, limit Public API access to trusted clients at the network level.
  • Set N8N_UNVERIFIED_PACKAGES_ENABLED=false to close the code execution path.

How to tell if you were hit

Review Public API calls made with exchanged tokens, looking for admin operations by users who are not admins: role changes, user creation or deletion. List users and roles and confirm that each change was intended. If unverified community packages are allowed, check the installed package list for packages nobody on your team added, and review the n8n host for unexpected child processes.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

JWTs issued through the Token Exchange module were assigned all Public API key scopes, regardless of the acting user's actual role. A low-privileged user who could obtain a valid external JWT trusted by a configured issuer could therefore use the resulting access token to invoke administrator-only Public API operations, such as role escalation, user creation, and user deletion.

The issue only affects instances where the Token Exchange feature and the Public API are enabled (N8N_TOKEN_EXCHANGE_ENABLED=true, N8N_ENV_FEAT_TOKEN_EXCHANGE=true) and the attacker can obtain an external JWT accepted by a configured trusted key. Role escalation additionally requires an Advanced Permissions license; Community Package installation additionally requires N8N_COMMUNITY_PACKAGES_ENABLED=true and N8N_UNVERIFIED_PACKAGES_ENABLED=true.

Patches

The issue has been fixed in n8n version 2.30.1 and 2.29.8. Users should upgrade to this version or later to remediate the vulnerability.

Workarounds

If upgrading is not immediately possible, administrators should consider the following temporary mitigations:

  • Disable the Token Exchange feature by setting N8N_TOKEN_EXCHANGE_ENABLED=false or N8N_ENV_FEAT_TOKEN_EXCHANGE=false.
  • If Token Exchange cannot be disabled, restrict Public API access at the network level to trusted clients only.
  • Disable unverified Community Package installation by setting N8N_UNVERIFIED_PACKAGES_ENABLED=false to eliminate the code execution path.

These workarounds do not fully remediate the risk and should only be used as short-term mitigation measures.

Credited to odgrso.

Questions

Is CVE-2026-65595 exploitable if Token Exchange is off?

No. The advisory says it only affects instances where Token Exchange and the Public API are enabled.

How does it lead to code execution?

Through community package installation. That needs N8N_COMMUNITY_PACKAGES_ENABLED=true and N8N_UNVERIFIED_PACKAGES_ENABLED=true, so the attacker can install an unverified package.

Does the attacker need a valid token?

Yes, a valid external JWT accepted by a configured trusted key. A low-privileged user with such a token is enough.

Which versions fix it?

n8n 2.29.8 and 2.30.1. Versions before 2.29.8, and 2.30.0, are affected.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More n8n vulnerabilities

All n8n entries