NocoDB: OAuth Token Scope Not Enforced at ACL Layer Allows Scope Escalation
Description
Summary
The OAuth token strategy attached oauth_scope and oauth_granted_resources to the request user, but the ACL middleware never consulted either. An OAuth token issued with a restricted scope (e.g. MCP-only) therefore inherited the full permissions of the underlying user across all routes; the granted_resources.base_id restriction was bypassed on org-level endpoints that don't populate req.context.base_id.
Details
In packages/nocodb/src/strategies/oauth-token.strategy.ts, the strategy set is_oauth_token, oauth_client_id, oauth_granted_resources, and oauth_scope on the user object, then mapped through to the user's existing roles / base_roles. The ACL middleware in extract-ids.middleware.ts honoured is_api_token via blockApiTokenAccess but had no equivalent gate for is_oauth_token or scope-string enforcement.
The base/workspace restriction logic short-circuited when req.context.base_id was unset (org-level routes), so an OAuth token scoped to one base could still call org-level endpoints as the underlying user.
The fix adds a path-prefix allowlist (['/mcp', '/api/v3/', '/auth/user/me']) enforced inside the strategy and a blockOAuthTokenAccess ACL flag for endpoints that should never accept OAuth tokens.
Impact
- Scope escalation: tokens issued with a narrow scope received the underlying user's full role.
- Resource boundary bypass: per-base restrictions did not apply to org-level routes.
- Violates least-privilege expectation for third-party OAuth integrations.
Credit
This issue was reported by @ik0z.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
NocoDB OAuth token scope and resource restrictions are not enforced by the ACL middleware, allowing full user permissions regardless of token limits.
Root
Cause
The vulnerability stems from a disconnect between NocoDB's OAuth token strategy and its ACL middleware. The OAuth token strategy in packages/nocodb/src/strategies/oauth-token.strategy.ts correctly populates oauth_scope and oauth_granted_resources on the user object. However, the ACL middleware in extract-ids.middleware.ts never reads these properties; it only checks is_api_token via blockApiTokenAccess. As a result, an OAuth token issued with a restricted scope (e.g., MCP-only) inherits the full permissions of the underlying user across all routes, violating the token's intended restrictions [1][2].
Attack
Scenario
To exploit this, an attacker would need to obtain a valid OAuth token that was issued with a narrow scope or limited to a specific base. Because the base_id restriction logic short-circuits when req.context.base_id is unset (as on org-level endpoints), the token can be used to access org-level routes without any scope enforcement. The attack requires no additional authentication beyond possession of the OAuth token, and the attacker's access is effectively that of the underlying user account [1].
Impact
Successful exploitation leads to scope escalation: tokens intended for minimal access gain full user roles. Additionally, resource boundary restrictions are bypassed on org-level routes, breaking the least-privilege expectation for third-party OAuth integrations. This allows an attacker to perform actions across the entire user's workspace that were never authorized by the token's scope [1][2].
Mitigation
The fix introduces a path-prefix allowlist (['/mcp', '/api/v3/', '/auth/user/me']) enforced inside the OAuth strategy and a blockOAuthTokenAccess ACL flag for endpoints that should never accept OAuth tokens. No workaround is necessary; applying the patch fully resolves the issue. The vulnerability was reported by @ik0z and is documented in the GitHub advisory GHSA-m5qg-rvjq-727p [1].
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
1Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
2News mentions
0No linked articles in our index yet.