Severity:

HIGH RISK

(7.3)

Improper Authorization in ChatGPTNextWeb NextChat MCP

CVE-2026-7644

Deferred

Vulnerability type

Category:

Improper Authorization

CWE:

CWE-266, CWE-285

Impact:

Unauthorized Feature and Configuration Access

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

ChatGPTNextWeb NextChat up to version 2.16.1 contains an improper authorization flaw in the addMcpServer function within app/mcp/actions.ts.

Under certain conditions, a remote party may be able to add or manipulate MCP server configurations without appropriate permission checks, potentially expanding their effective capabilities within the application.

Affected context

This vulnerability occurs in deployments of ChatGPTNextWeb NextChat (up to 2.16.1) that expose functionality for managing MCP (Model Context Protocol) servers through the addMcpServer action.

It is relevant where:

  • MCP server configuration endpoints are reachable over the network
  • The application relies on server-side authorization to control who can add or modify MCP servers
  • The same process or account that handles MCP configuration also has access to sensitive operational capabilities or external integrations

The issue manifests when the function processes requests that are not adequately tied to an authenticated and authorized user context.

Exploit preconditions

  • Attack surface: Network-accessible interface (e.g., web/API route) that ultimately invokes addMcpServer in app/mcp/actions.ts.
  • Required access: Ability to reach the application over the network; insufficient server-side authorization checks may allow actions without valid or appropriate credentials.
  • Trigger point: Sending a crafted request that causes the backend to call addMcpServer with attacker-controlled parameters.
  • Why exploitation is possible: The function implements incomplete or missing authorization logic (CWE-285 / CWE-266), failing to robustly verify that the caller is permitted to perform MCP server management operations.

Why this happens

The core issue is improper authorization enforcement around a security-sensitive operation: managing MCP server entries.

Instead of consistently validating that the caller has the right privileges, the addMcpServer logic appears to either:

  • Trust client-side state or unauthenticated identifiers, or
  • Reuse an authentication mechanism without enforcing role, scope, or ownership checks.

This aligns with CWE-285: Improper Authorization, where the system allows access to a function or resource without sufficiently verifying whether the caller is allowed to use it.

It is also related to CWE-266: Incorrect Privilege Assignment, as privilege boundaries around MCP configuration are not clearly or correctly enforced.

In abstract terms, the design treats a configuration-modifying operation as if it were a low-risk action and does not gate it behind a robust server-side authorization decision.

Potential impact

  • Attackers may be able to add new MCP servers under their control, potentially influencing how the application interacts with external services.
  • Malicious MCP endpoints could be introduced, which can provide misleading or harmful data to users or downstream systems.
  • Existing application trust boundaries could be bypassed, extending an attacker's effective capabilities beyond their intended permissions.
  • In some deployment patterns, unauthorized MCP configuration changes may pave the way for further compromise or data exfiltration through manipulated integrations.

General mitigation guidance

Addressing this vulnerability typically involves hardening authorization checks around MCP server management and any related configuration endpoints:

  • Ensure that addMcpServer and companion actions perform strict, server-side authorization checks based on authenticated user identities and roles.
  • Treat MCP server registration and modification as privileged operations, allowable only to explicitly authorized administrators or system roles.
  • Implement clear ownership and scoping rules (e.g., per-user or per-tenant) for MCP configurations, and validate them on every request.
  • Introduce a centralized authorization layer or policy engine so that permission checks are consistent across all configuration-related actions.
  • Apply the principle of least privilege to both application roles and the internal components that process MCP configuration, reducing the blast radius of misuse.

How teams detect issues like this

Potential detection and verification strategies include:

  • Code review: Examine app/mcp/actions.ts and related routes for calls to addMcpServer, looking for missing checks on authenticated user identity, role, or ownership.
  • Static analysis: Use security-focused linters or SAST tools to flag endpoints that change configuration or perform administrative actions without clear authorization logic.
  • Authorization policy review: Cross-check documented authorization requirements for MCP management against actual implementation and routing logic.
  • Logging and monitoring: Enable detailed logging for MCP configuration changes (including actor identity and source IP) and monitor for anomalous or unexpected additions.
  • Automated tests: Add security-focused tests that attempt MCP configuration operations with insufficient privileges, ensuring such requests are denied.

Sources

SourceLink
github.comgithub.com/ChatGPTNextWeb/NextChat/
github.comgithub.com/ChatGPTNextWeb/NextChat/issues/6757
vuldb.comvuldb.com/submit/806851
vuldb.comvuldb.com/vuln/360756
vuldb.comvuldb.com/vuln/360756/cti

Frequently asked

questions

Yes, the vulnerability is remotely exploitable if the affected MCP configuration interface is exposed over the network and not correctly protected by server-side authorization. A remote attacker who can reach the relevant endpoint may attempt to trigger the issue.

The exact access level depends on the deployment, but exploitation generally requires network access to the application and the ability to invoke the route or API method that eventually calls addMcpServer. If authentication or authorization is weak or missing, even unauthenticated users might be able to abuse it.

The safest pattern is to require strong, authenticated identities and enforce explicit authorization checks for all MCP configuration operations. Only trusted administrative roles should be able to add, update, or remove MCP servers, and these operations should be validated by centralized, consistent authorization logic.

Prevention strategies include enforcing a uniform access control model for all sensitive operations, adopting a security review process for configuration-affecting endpoints, using defense-in-depth via role-based access control and least privilege, and incorporating automated checks (SAST, code review templates, and tests) that flag any new endpoint that modifies configuration without explicit authorization.

Find out what's already
exploitable in your codebase.