/

CVE-2026-85620

Severity:

HIGH RISK

(8.6)

Authorization Bypass (CWE-863) in Postgres MCP Pro SQL

CVE-2026-85620

Awaiting Analysis

Vulnerability type

Category:

Authorization Bypass

CWE:

CWE-863

Impact:

Sensitive Information Disclosure

Severity:

HIGH RISK

(8.6)

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

Postgres MCP Pro contains a restricted-mode authorization bypass in which function-name validation is not consistently applied to RangeFunction nodes used in FROM clauses. An attacker who can submit or influence SQL processed by the service may invoke file-reading functionality and access arbitrary files despite restricted-mode protections.

Affected context

The vulnerability occurs in Postgres MCP Pro deployments that use restricted mode to limit callable database functions while still permitting SQL expressions containing FROM-clause function nodes. Risk depends on whether an attacker can reach the SQL execution interface and cause queries to be processed without equivalent validation across all supported syntax paths.

Exploit preconditions

  • Attack surface: The Postgres MCP Pro SQL or database-tool interface
  • Required access: Ability to submit, influence, or cause SQL statements to be processed
  • Trigger point: Resolution of a RangeFunction node in a FROM clause
  • Why exploitation is possible: Restricted-mode function-name checks do not cover this syntax path, allowing disallowed file-reading functions to be reached through an alternate query structure

Why this happens

The underlying bug is incomplete authorization enforcement across equivalent syntax representations. Function restrictions are applied to some invocation paths but omitted for RangeFunction nodes in FROM clauses, allowing a caller to bypass the intended policy by selecting a different parse-tree form. This maps to CWE-863: Incorrect Authorization, because the system fails to consistently enforce access-control rules for a protected operation.

Potential impact

  • Sensitive local files may be read
  • Database credentials, application secrets, or configuration data could be disclosed
  • Host or service reconnaissance may become easier
  • Exposed information could support follow-on compromise

General mitigation guidance

Mitigation generally focuses on enforcing authorization consistently at the semantic operation level rather than only at selected syntax nodes.

Common defensive patterns include:

  • Apply the same allowlist or denylist to every SQL representation that can invoke restricted functions
  • Prefer a narrow, secure-by-default function allowlist over broad name-based filtering
  • Parse and normalize statements before policy evaluation so equivalent forms receive equivalent authorization decisions
  • Reduce trust in user-controlled SQL and expose only purpose-built operations where possible
  • Run the database and MCP service with least-privilege identities and limit access to sensitive filesystem paths
  • Treat restricted mode as defense in depth alongside database permissions, filesystem controls, and secret isolation

How teams detect issues like this

Detection approaches can include:

  • Static analysis and code review for authorization checks applied to only specific parser node types
  • Tests covering equivalent function-invocation forms, including functions represented in FROM clauses
  • Policy tests that verify denied functions remain denied after parsing, normalization, and query rewriting
  • Monitoring for unusual file-reading function usage or database-tool requests that reference unexpected filesystem resources
  • CI enforcement requiring security regression tests for every supported SQL syntax path
  • Neutral automated review tools that identify incomplete authorization coverage and inconsistent allowlist enforcement

Sources

SourceLink
github.comgithub.com/crystaldba/postgres-mcp
github.comgithub.com/crystaldba/postgres-mcp/blob/v0.3.0/src/postgres_mcp/sql/safe_sql.py
github.comgithub.com/crystaldba/postgres-mcp/issues/178
vulncheck.comvulncheck.com/advisories/postgres-mcp-pro-0.3.0-restricted-mode-bypass-via-from-clause-function

Frequently asked

questions

It may be remotely exploitable when the MCP service exposes a SQL execution capability to an attacker who can submit or influence queries. If the interface is limited to trusted administrators, practical exploitability is narrower.

Authentication requirements depend on the deployment. An attacker needs whatever access is required to reach the query-processing interface, but the restricted-mode bypass can occur after that access is obtained.

Enforce function authorization consistently across the complete parsed query structure, using secure-by-default allowlists and normalized semantic checks rather than relying on individual syntax locations.

Maintain authorization regression tests for alternate SQL forms, minimize exposed query capabilities, and combine application-level policies with database privileges and filesystem isolation.

Find out what's already
exploitable in your codebase.