# n8n privilege escalation and code execution in Token Exchange module

Source: https://junglewise.ai/threats/n8n-privilege-escalation-and-code-execution-in-token-exchange-module-e189b3bb  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-22. Updated: 2026-07-22  
License: CC BY 4.0 with a link back

Severity: high · CVSS 8.9 · Published 2026-07-22

n8n is a popular workflow automation tool used to connect different software services. A security flaw in its token exchange system allows low-privileged users to gain full administrative control over the platform. This could lead to unauthorized data access, the creation or deletion of user accounts, and in some configurations, the ability for an attacker to run malicious code on the server.

Technologies: [N8n](https://junglewise.ai/threats/technologies/n8n). Vendors: [N8n](https://junglewise.ai/threats/vendors/n8n).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** High severity, with a CVSS score of 8.9, published 22 July 2026.

**Which products and versions are affected?** N8n < 2.29.8, < 2.30.1.

**Is there a fix for This vulnerability?** A patch was published on 2026-07-22: Fixes confirmed in versions 2.29.8 and 2.30.1 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network, in a network appliance.

**Am I affected?** Check whether you run N8n at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

n8n suffers from improper privilege management (CWE-269) in its Token Exchange module. The application assigns all Public API key scopes to JWTs issued through this module regardless of the user's actual role. An attacker with low-privileged access who can provide a valid external JWT from a trusted issuer can obtain an access token with administrative rights. This allows for role escalation, user management, and, if unverified Community Packages are enabled, remote code execution (RCE). The vulnerability is present when both the Token Exchange and Public API features are enabled. It has been patched in versions 2.29.8 and 2.30.1.

## Affected products

- n8n-io n8n < 2.29.8, < 2.30.1

## Timeline

- 2026-07-08: advisory: Original advisory GHSA-777w-rpr6-c52h published
- 2026-07-22: disclosed: CVE-2026-65595 published and duplicate advisory GHSA-wq64-hcrf-8m56 released
- 2026-07-22: patched: Fixes confirmed in versions 2.29.8 and 2.30.1

## References

- [https://github.com/n8n-io/n8n/security/advisories/GHSA-777w-rpr6-c52h](https://github.com/n8n-io/n8n/security/advisories/GHSA-777w-rpr6-c52h)
- [https://www.vulncheck.com/advisories/n8n-before-privilege-escalation-via-token-exchange](https://www.vulncheck.com/advisories/n8n-before-privilege-escalation-via-token-exchange)

## Related threats

- [n8n path traversal in Databricks node](https://junglewise.ai/threats/cve-2026-119557-n8n-from-2-14-0-through-2-46-3-contains-a-path-traversal)
- [n8n remote code execution in deprecated Function nodes](https://junglewise.ai/threats/cve-2026-119408-n8n-before-2-42-6-2-43-x-before-2-43-3-and-3-x-before-3-0-1)
- [n8n Slack Trigger SSRF and token exfiltration](https://junglewise.ai/threats/cve-2026-118679-n8n-before-1-123-83-2-41-4-and-2-42-1-contains-a-server-side)
- [n8n prototype pollution in workflow history compaction](https://junglewise.ai/threats/cve-2026-118678-n8n-before-2-41-4-and-2-42-x-before-2-42-1-contains-a-prototype)
- [n8n Local Gateway deep-link missing confirmation re-pairing](https://junglewise.ai/threats/cve-2026-118677-n8n-before-2-41-4-and-2-42-x-before-2-42-1-contains-a-missing)
