Summary
An authorization flaw in n8n's OAuth reconnect endpoints allowed users with only read access to shared credentials to refresh and overwrite OAuth token material.
When exploited, workflows using the affected credential would execute under the attacker-controlled OAuth identity, enabling data exfiltration and takeover of shared integrations.
Affected context
This vulnerability occurs in n8n instances where OAuth1 or OAuth2 credentials are shared among users and workflows, and where the reconnect endpoints authorize using a read-only permission.
It is relevant in environments that rely on shared OAuth credentials to connect to external services, particularly when multiple users have credential:read access but only a subset should be allowed to modify or refresh those credentials.
Exploit preconditions
- Attack surface: n8n API/UI endpoints responsible for OAuth1/OAuth2 credential reconnect.
- Required access: Authenticated user with credential:read permission on a shared OAuth credential, but without credential:update rights.
- Trigger point: Initiation of an OAuth reconnect flow via the affected endpoints, resulting in new token material being stored.
- Why exploitation is possible: The reconnect endpoints enforce authorization using the read permission instead of update, allowing users with read-only access to alter credential state and overwrite stored OAuth tokens.
Why this happens
The underlying issue is an authorization misconfiguration that maps to CWE-639: Insecure Direct Object Reference (IDOR) in the context of access control.
The OAuth reconnect endpoints relied on a permission intended only for viewing credential data (credential:read) to guard an operation that changes credential state (refreshing and storing new tokens).
This mismatch between the sensitivity of the operation and the enforced permission boundary allowed users who should only observe credential details to perform state-changing actions, effectively bypassing intended privilege separation on shared OAuth integrations.
Potential impact
- Workflows may execute under an attacker-controlled OAuth identity instead of the original owner.
- Data could be exfiltrated from connected external services to attacker-controlled accounts or endpoints.
- Shared integrations can be persistently hijacked, disrupting legitimate workflow behavior.
- Audit trails and activity logs may misleadingly associate actions with the original shared credential rather than the true controlling account.
General mitigation guidance
Effective mitigation focuses on tightening authorization boundaries around credential operations and treating token refresh flows as privileged actions.
Common patterns include:
- Enforcing distinct permissions for reading versus updating credential material, ensuring that reconnect and token mutation operations require explicit update-level rights.
- Designing credential management APIs so that any operation capable of changing authentication context (such as token refresh, rotation, or reconnect) is guarded by the same or higher privilege as initial credential creation.
- Applying least-privilege principles to shared credential access, granting read-only visibility without implicit rights to modify or reconnect.
- Introducing explicit ownership or stewardship models for shared credentials, so only designated maintainers can trigger reconnect or token replacement flows.
How teams detect issues like this
Detection typically involves reviewing how authorization is enforced on credential-related endpoints and identifying operations that can change token material or authentication context.
Useful approaches include:
- Static analysis or architectural review to ensure that state-changing credential operations always check for update or admin-level permissions rather than relying on read-level access.
- Code review practices that flag any API route handling reconnect, rotate, or refresh actions and verify that authorization checks match the sensitivity of the operation.
- Runtime monitoring and audit logging for unusual reconnect activity on shared credentials, such as reconnects initiated by users who are not designated maintainers.
- Policy enforcement within CI/CD pipelines that require security review for changes to credential management logic and access-control rules, optionally assisted by automated authorization analysis tools.

