AAK-MCP-PGEDGE-CVE-2026-125320-001: pgEdge Postgres MCP Server image below 1.1.0: read-only bypass, SQL injection through pl-do tools, DNS rebinding, a spoofable rate-limit address and a count_rows oracle
- Severity
- HIGH
- Category
- Supply Chain (
supply-chain) - Scanner
agent_audit_kit/scanners/container_image_pins.py- Auto-fixable
- No.
- SARIF name
PgedgePostgresMcpPre110Flaws
What it detects
The pgEdge Postgres MCP Server (pgEdge/pgedge-postgres-mcp) runs SQL against PostgreSQL for MCP clients and ships as the image ghcr.io/pgedge/postgres-mcp. Five flaws are fixed in 1.1.0. CVE-2026-126196 (CVSS 3.1 8.1, CWE-89 and CWE-693, GHSA-j7mp-839j-jrm7): on a read-only connection a caller of the query_database tool could write anyway, because a statement the guard did not take for a read went to tx.Exec with no bind parameters, over the simple query protocol, so several statements, transaction control among them, ran in one message. CVE-2026-126197 (8.8, CWE-89, GHSA-r5pp-jx86-r6r9): a custom pl-do tool put its arguments inside a DO block delimited by a fixed dollar-quote tag, so an argument holding that tag ran the caller's own SQL as the connecting role. CVE-2026-125320 (5.3, CWE-346, GHSA-6hg5-9f3w-c886): the HTTP transport did not check the Origin header, so a page a user visited could reach a server on that machine through DNS rebinding and read schemas and query results. CVE-2026-125321 (6.5, CWE-807, GHSA-v347-v3w7-7fq9): with the HTTP transport and authentication on, login rate limiting keyed on the leftmost caller-supplied X-Forwarded-For value. CVE-2026-125322 (6.5, CWE-89, GHSA-fhv3-x3jh-grj7): the count_rows tool's where parameter accepted subqueries against other tables, so the returned count was an oracle for any table the database role can read. Checked in the source at the commit each image's label names: 1.0.0 (67121476) has all five; 1.1.0-beta1 (b971c413) carries every fix (the read-only guard and BEGIN access mode of b5b92930, per-call dollar-quote tags, the Origin check, the client-address resolver and the subquery rejection), and every later image keeps them. 1.0.0-beta2 (6830caeb), the first image, has the three MEDIUM flaws but neither high-severity route: it has no custom tools, and it runs each query_database statement with tx.Query, one statement per message, after SET TRANSACTION READ ONLY; the tx.Exec path and pl-do tools arrive in 1.0.0-beta3.
How to fix
Run ghcr.io/pgedge/postgres-mcp 1.1.0 or later, pinned by version, and review the database's audit logs for DDL and DML made through the MCP connection, which upgrading does not undo. Until then grant the connecting role no write privileges (the one control that holds against both read-only bypasses), define no pl-do custom tools, serve over stdio, the image's default, or put an HTTP deployment behind a proxy that overwrites X-Forwarded-For and refuses cross-origin requests, and grant SELECT only on the tables MCP clients may read.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-PGEDGE-CVE-2026-125320-001
Limitations
Reads image references only: an image: value or any other mention of ghcr.io/pgedge/postgres-mcp:TAG in YAML (compose files, Kubernetes manifests, MCP configs), a Helm values mapping of repository and tag, Dockerfile and Containerfile FROM, and docker run arguments in *mcp*.json and claude_desktop_config.json. Tags below 1.1.0 are reported, from 1.0.0-beta2, the first, with the two-part 1.0 and the -with-kb builds; the 1.1.0 betas and release candidate read as 1.1.0 and carry the fixes. 1.0.0-beta2 is reported at HIGH because it reads as 1.0.0, although that one tag has neither high-severity route: it has no custom_tool.go, and its query_database uses the single-statement extended protocol; the advisories name every pre-release. latest was the 1.1.0 digest on 2026-11-11, so an untagged reference is not reported. The rule reads the tag, not the transport or the configuration: CVE-2026-126196 needs a read-only connection whose role can write, CVE-2026-126197 a pl-do custom tool, CVE-2026-125320 the HTTP transport and CVE-2026-125321 HTTP with authentication on, so a deployment that has none of these, such as a stdio one, the image's default, with no custom tools, is reported although only CVE-2026-125322 reaches it. The write-confirmation prompts of the bundled CLI and web client are in their own images, ghcr.io/pgedge/nla-cli and ghcr.io/pgedge/nla-web, which AAK-MCP-PGEDGE-CVE-2026-126199-001 reads; this rule does not match them. The release binaries and a server built from source state no version AAK reads, and the go.mod at every tag declares the module pgedge-postgres-mcp, a path no other go.mod can require. Mirrors under another registry are not matched, and commented-out lines are skipped.
References
- CVE: CVE-2026-125320, CVE-2026-125321, CVE-2026-125322, CVE-2026-126196, CVE-2026-126197
- OWASP MCP Top 10: MCP04:2025 (Software Supply Chain Attacks & Dependency Tampering), MCP05:2025 (Command Injection & Execution), MCP07:2025 (Insufficient Authentication & Authorization), MCP10:2025 (Context Injection & Over-Sharing)
- OWASP Agentic Top 10: ASI02 (Tool Misuse and Exploitation), ASI03 (Identity and Privilege Abuse), ASI04 (Agentic Supply Chain Vulnerabilities)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-INJECT-07 (Tool Param SQL Injection), ADV-AUTH-01 (Missing Authentication)
- Incidents and advisories: GHSA-j7mp-839j-jrm7, GHSA-r5pp-jx86-r6r9
- CSA AI Controls Matrix (AICM): AIS-07, IAM-01, STA-08
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-PGEDGE-CVE-2026-125320-001.md: the page then shows that text, with the registry reference appended under it.