Summary
An authorization bypass in n8n's OAuth token endpoint can allow a client approved for one workflow to obtain a valid access token for a different workflow. The issue becomes risky when the client can influence the resource parameter and the consenting user can access the substituted workflow.
Affected context
The vulnerability occurs in n8n deployments using the affected OAuth token flow. The initial access token is bound to the consented resource, but the associated refresh token is not. During refresh, the requested resource is checked only against registered resources rather than against the resource authorized in the original grant.
Exploit preconditions
- Attack surface: OAuth token and refresh-token endpoints
- Required access: A client capable of participating in the OAuth flow and a consenting user with access to multiple workflows
- Trigger point: Refreshing a token while supplying a different registered workflow resource
- Why exploitation is possible: Refresh validation does not verify that the requested resource matches the resource approved in the original authorization grant
Why this happens
The underlying bug is an incomplete authorization relationship between an OAuth refresh token and its originally consented resource. The token endpoint validated that a substituted resource was registered, but did not preserve and enforce the resource binding established during consent. This behavior maps to CWE-863, Missing Authorization, because possession of a valid grant could be used to obtain access beyond the permissions actually approved.
Potential impact
- An attacker could obtain a token for an unapproved workflow
- Unauthorized workflow data access could occur under the consenting user's privileges
- Workflow operations or connected resources may be exposed, depending on granted permissions
- Audit records could incorrectly associate unauthorized access with a legitimate OAuth client
General mitigation guidance
Mitigation generally focuses on preserving authorization context throughout the
complete OAuth token lifecycle.
Common defensive patterns include:
- Binding access and refresh tokens cryptographically or transactionally to the exact consented resource
- Requiring refresh requests to match the resource recorded in the original grant
- Rejecting resource substitutions instead of merely checking resource registration
- Applying least privilege to OAuth clients and workflow permissions
- Minimizing the number of workflows and resources exposed to each client
- Requiring explicit reauthorization when a client requests a different resource
- Maintaining clear, tamper-resistant audit records for consent, refresh, and resource decisions
How teams detect issues like this
Detection can include:
- Static analysis and code review checks for refresh-token validation that compares only resource registration
- Tests confirming that a refresh token cannot be exchanged for a different resource
- Monitoring for refresh requests whose resource differs from the resource recorded at consent time
- Policy enforcement requiring immutable authorization-resource bindings
- Alerts for OAuth clients accessing workflows outside their historical consent scope
Automated security review tools may help identify missing authorization checks, but endpoint-level authorization tests remain important.

