Skip to content

AAK-MCP-POSTGRESMCP-CVE-2026-85620-001: Postgres MCP Pro restricted-mode bypass via FROM-clause functions (no fixed release)

Severity
HIGH
Category
Supply Chain (supply-chain)
Scanner
agent_audit_kit/scanners/mcp_cve_pins_2026_07.py
Auto-fixable
No.
SARIF name
PostgresMcpRestrictedModeFromClauseBypass

What it detects

Postgres MCP Pro (postgres-mcp, PyPI) 0.3.0 applies function-name validation to plain function calls but not to RangeFunction nodes in FROM clauses, so pg_read_file and its siblings reached through FROM-clause syntax read arbitrary server-side files despite restricted ("read-only") mode (CVE-2026-85620, CVSS 8.6). There is no fixed release: upstream's newest tag is v0.3.0 and the security issue (crystaldba/postgres-mcp#178) is still open, so every published version of this distribution is affected. The separate PyPI name postgres-mcp-pro carries the product's marketing name and an identical summary but declares no repository and is not referenced by the upstream project — it is not treated here as a verified upgrade target. The unrelated npm package of the same name (a multi-database MCP server on the 1.0.x line) is not affected and does not fire.

How to fix

There is no patched release to upgrade to. Stop relying on the server's restricted mode as a security boundary: connect it with a least-privilege PostgreSQL role that cannot execute pg_read_file, pg_ls_dir or COPY ... FROM PROGRAM, and enforce read-only at the database rather than in the MCP server's SQL validator.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-MCP-POSTGRESMCP-CVE-2026-85620-001

Limitations

Reads postgres-mcp in requirements*.txt at any depth and, at the project root only, in pyproject.toml, Pipfile, package.json, .mcp.json, mcp.json, claude_desktop_config.json and the Pipfile.lock, poetry.lock, uv.lock, package-lock.json, pnpm-lock.yaml and yarn.lock lockfiles, taking the lowest version a range allows and reporting a reference that states no version. The dependency is not read when it is declared in a sub-directory manifest (services/api/pyproject.toml), in .cursor/mcp.json or .vscode/mcp.json, or in a lockfile format the reader does not parse (pdm.lock). A compose file's crystaldba/postgres-mcp image tag is not read. A file over 2 MB, or a lockfile over 32 MiB, is not read. A declaration nested more than 64 levels deep in package.json, a TOML manifest or an MCP config (an MCP server more than 62) is still judged, and reported without a line; a lockfile entry keeps its line at any depth.

References

  • CVE: CVE-2026-85620
  • OWASP MCP Top 10: MCP02:2025 (Privilege Escalation via Scope Creep), MCP04:2025 (Software Supply Chain Attacks & Dependency Tampering)
  • OWASP Agentic Top 10: ASI02 (Tool Misuse and Exploitation), ASI04 (Agentic Supply Chain Vulnerabilities)
  • Adversa AI MCP Top 25 (AAK-defined ids): ADV-DATA-01

All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-POSTGRESMCP-CVE-2026-85620-001.md: the page then shows that text, with the registry reference appended under it.