# CVE-2026-58225: SQL injection via unescaped dollar-quote in Postgrex.Notifications reconnect replay causes notification denial of service

Status: published. Published: 2026-07-10. Updated: 2026-11-24.

SQL Injection vulnerability in elixir-ecto postgrex allows an attacker who can influence a LISTEN channel name to inject SQL into the reconnect replay query, causing a denial of service of the notification connection.

Postgrex.Notifications sanitizes channel names with quote_channel/1, which doubles double quotes so the name is safe inside a double-quoted identifier. This protects the single-statement LISTEN and UNLISTEN paths. On every (re)connect, however, handle_connect/1 replays all registered channels at once by concatenating their LISTEN statements and wrapping them in a dollar-quoted anonymous code block (DO $$BEGIN ... END$$). quote_channel/1 does not escape the $$ dollar-quote delimiter that opens and closes this block.

The listen/3 guards only reject null bytes and names longer than 63 bytes, so a channel name containing $$ passes validation unchanged. Once such a name is embedded, its $$ prematurely terminates the outer dollar-quoted string and PostgreSQL parses the remainder as additional top-level statements. Because handle_connect/1 runs on every (re)connect, the malformed replay query is rejected each time and the notification connection never re-establishes its subscriptions, silently dropping notifications for every channel sharing that connection.

An application is affected when it passes untrusted input (for example a tenant or user identifier) as a channel name to Postgrex.Notifications.listen/3. The double-quote doubling prevents forming a fully valid injected statement, so arbitrary SQL execution is not possible, but the corrupted query reliably breaks the shared notification connection for all tenants, resulting in denial of service.

This issue affects postgrex: from 0.16.0 before 0.22.3.

## Remediation

- workaround: Validate channel names before passing untrusted input to Postgrex.Notifications.listen/3. Reject any name that contains the dollar-quote delimiter ($$), or restrict channel names to a safe character set such as alphanumeric characters and underscores. (source: CNA: EEF)
- fix: The reporting source identifies this reference as a patch. Check the advisory for affected versions and supported release branches. (source: CNA: EEF) — https://github.com/elixir-ecto/postgrex/commit/795c6062f62c4394272ff4b89170688857b4f841
- fix: The reporting source identifies this reference as a patch. Check the advisory for affected versions and supported release branches. (source: CNA: EEF) — https://github.com/elixir-ecto/postgrex/commit/797d395906c0a1d28bea55e3a2b03ce75c827f55

## Affected products and versions

- elixir-ecto / postgrex (postgrex): ≥ 0.16.0; < 0.22.3 (affected, semver). Source: CNA: EEF
- elixir-ecto / postgrex (elixir-ecto/postgrex): ≥ 266b530faf9bde094e31e0e4ab851f933fadc0f5; < * (affected, git); unaffected at 795c6062f62c4394272ff4b89170688857b4f841; unaffected at 797d395906c0a1d28bea55e3a2b03ce75c827f55. Source: CNA: EEF

## Severity and prioritization

- CVSS 4.0: 2.1 (low); CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N; source: CNA: EEF

- CISA KEV: No listing in collected sources

- EPSS: 0.26% as of 2026-11-23; percentile 18.19%

- SSVC: exploitation poc; automatable no; technical impact partial; source ADP: CISA-ADP

- Weaknesses: CWE-89

## Exploit evidence

- exploit: https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w (ADP: CISA-ADP)

## References

- https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w (CNA: EEF; vendor-advisory, related)

- https://cna.erlef.org/cves/CVE-2026-58225.html (CNA: EEF; related)

- https://osv.dev/vulnerability/EEF-CVE-2026-58225 (CNA: EEF; related)

- https://github.com/elixir-ecto/postgrex/commit/266b530faf9bde094e31e0e4ab851f933fadc0f5 (CNA: EEF; related)

- https://github.com/elixir-ecto/postgrex/commit/795c6062f62c4394272ff4b89170688857b4f841 (CNA: EEF; patch)

- https://github.com/elixir-ecto/postgrex/commit/797d395906c0a1d28bea55e3a2b03ce75c827f55 (CNA: EEF; patch)

- https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w (ADP: CISA-ADP; exploit)

## Provenance

- CNA: EEF: https://www.cve.org/CVERecord?id=CVE-2026-58225; retrieved 2026-11-24; source updated 2026-11-24

- FIRST EPSS: https://api.first.org/data/v1/epss?cve=CVE-2026-58225; retrieved 2026-11-24; source updated Not reported

Revision: 3d6bd40613cc2e263f3bc35dfeaafae276ebdee63f367f8f9824e98e9709980e

Canonical: https://y2.dev/cve/CVE-2026-58225

## Agent and API access

Public CVE pages, Markdown, and JSON are free to read without an account or API key.

- Public catalog: https://y2.dev/cve/index.json. Follow nextCursor with the same search, filters, sort, and limit (1–100). A null cursor marks the end.

- WebMCP: search_cve_disclosures, get_cve_disclosure, get_cve_page_markdown, get_y2_cve_access. Available in compatible browsers.

- Cyber API: https://api.y2.dev/api/v2/cyber/cves and https://api.y2.dev/api/v2/cyber/cves/{cveId}.

- Y2 Pro or Elite: create a workspace API key with the intel:cyber scope and send Authorization: Bearer <Y2_API_KEY>. Setup: https://y2.dev/docs/api/create-key.

- x402: Pay per request without an account or API key. Omit Authorization, read the HTTP 402 PAYMENT-REQUIRED challenge, validate its current requirements, and retry with PAYMENT-SIGNATURE through an authorized payment client. These browser tools never make payments. Guide: https://y2.dev/docs/api/x402.

- OpenAPI: https://y2.dev/api/openapi.yaml. Agent access metadata: https://y2.dev/cve/agent.json.

Collected public records only. Check source status for coverage and freshness.