Summary
n8n's dynamic-credential OAuth2 callback does not verify that the browser completing authorization belongs to the user who initiated the flow. A member with access to a resolvable OAuth2 credential may be able to obtain a victim's consent and have the resulting tokens stored under the member's identity, allowing their workflows to act with the victim's authorization.
Affected context
The issue affects n8n's dynamic-credential connect flow, specifically the OAuth2 credential callback. It may arise when the callback accepts authorization without confirming that the completing browser or session belongs to the user who started the flow.
The description identifies affected releases as n8n before 2.45.5, 2.46.x before 2.46.1, and 3.x before 3.0.1.
Exploit preconditions
- Attack surface: The dynamic-credential OAuth2 authorization and callback flow
- Required access: A member account with access to a resolvable OAuth2 credential
- Victim action: The victim must open the provider authorization URL and consent; the described scenario involves a victim without an active n8n session
- Trigger point: The provider redirects to the n8n OAuth2 callback
- Why exploitation is possible: The callback does not adequately verify that the completing browser belongs to the user who initiated the flow
Why this happens
The OAuth2 callback fails to bind completion of an authorization transaction to the initiating user or browser context. This is a missing authentication or authorization check for a security-sensitive function, corresponding to CWE-306. As a result, authorization tokens can be associated with a different n8n identity than the one that initiated the flow.
Potential impact
- A member's workflows may be able to act using the victim's provider-authorized identity
- The victim's connected resources or data may be accessed or modified, depending on granted permissions
- The victim's OAuth2 tokens may be retained under the member's identity and used by workflows
- Activity performed with the connected account may be difficult to distinguish from legitimate victim-authorized use
General mitigation guidance
Defensive designs typically bind every OAuth2 authorization transaction to the initiating user, browser session, and credential context, then verify that binding at callback time. Use unpredictable, single-use transaction state and reject callbacks that lack a valid matching session or transaction.
Reduce reliance on externally supplied authorization URLs, provide clear confirmation of the account and credential being connected, and limit workflow and credential permissions to the minimum necessary. Secure-by-default flows should fail closed when the initiating identity cannot be verified.
How teams detect issues like this
Review OAuth2 callback code for checks that bind authorization state to the initiating user and session, and for paths that store tokens before verifying that binding. Static analysis and code review can flag callbacks that accept identity-sensitive results without authentication or transaction-state validation.
Monitor for authorization transactions where the initiating and completing identities differ, unexpected credential ownership changes, and unusual workflow activity using newly connected credentials. Policy checks can require session-bound, single-use OAuth2 state validation.

