AAK-MCP-AWSPOSTGRES-CVE-2026-85787-001: awslabs postgres-mcp-server: COPY TO PROGRAM command injection and SQL validation gap (below 1.1.7)
- Severity
- CRITICAL
- Category
- Supply Chain (
supply-chain) - Scanner
agent_audit_kit/scanners/mcp_cve_pins_2026_07.py- Auto-fixable
- No.
- SARIF name
AwslabsPostgresMcpSqlValidationGap
What it detects
Amazon awslabs postgres-mcp-server (awslabs.postgres-mcp-server, PyPI) before 1.1.7 carries two defects in the same SQL validation component, both cleared by one floor. CVE-2026-87911 (CRITICAL 9.6): the read-only enforcement does not stop a crafted COPY ... TO PROGRAM statement, so an unauthenticated actor who can place content that an authenticated user later processes executes operating-system commands on the host of a self-managed PostgreSQL server, in the server's default configuration. CVE-2026-85787 (MEDIUM 6.5): the disallowed-input list is incomplete, so crafted SQL reaching the same path modifies data beyond the server's read-only scope. The command-injection reading is the load-bearing one — a read-only scope bypass and OS command execution are different threats, and the remediation below addresses the latter. Fixed in 1.1.7; treat < 1.1.7 (and unpinned) as exposed.
How to fix
Upgrade awslabs.postgres-mcp-server to >= 1.1.7 and pin it. Enforce read-only access with a least-privilege database role rather than relying on the server's own statement filtering: a role without pg_execute_server_program cannot run COPY ... TO PROGRAM even if the statement filter is bypassed.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-AWSPOSTGRES-CVE-2026-85787-001
Limitations
Reads awslabs.postgres-mcp-server 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 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-87911, CVE-2026-85787
- OWASP MCP Top 10: MCP04:2025 (Software Supply Chain Attacks & Dependency Tampering), MCP05:2025 (Command Injection & Execution)
- OWASP Agentic Top 10: ASI04 (Agentic Supply Chain Vulnerabilities), ASI05 (Unexpected Code Execution (RCE))
- 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-AWSPOSTGRES-CVE-2026-85787-001.md: the page then shows that text, with the registry reference appended under it.