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

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** LOW 2.1
- **CVSS:** 2.1 (v4.0, CNA) `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`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Attack requirements: Present; Privileges required: None; User interaction: None; Confidentiality impact: None; Integrity impact: None; Availability impact: Low; Confidentiality impact on other systems: None; Integrity impact on other systems: None; Availability impact on other systems: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.26% (percentile 11, 2026-11-26)
- **CWE:** CWE-89
- **Published:** 2026-07-10T10:51:46.978Z
- **Modified:** 2026-11-24T05:18:28.310Z

## Who should check

- Anyone running elixir-ecto postgrex \>= 0.16.0, \< 0.22.3
- Anyone running elixir-ecto postgrex \>= 266b530faf9bde094e31e0e4ab851f933fadc0f5, \< \*

## Description

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.

## Affected and fixed versions

- elixir-ecto postgrex: \>= 0.16.0, \< 0.22.3 (cvelist)
- elixir-ecto postgrex: \>= 266b530faf9bde094e31e0e4ab851f933fadc0f5, \< \* (cvelist)

## Mitigation

- Upgrade postgrex to 0.22.3 or later.
- Vendor 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.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-58225. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-58225.md
Affected: elixir-ecto postgrex >= 0.16.0, < 0.22.3; elixir-ecto postgrex >= 266b530faf9bde094e31e0e4ab851f933fadc0f5, < *
Fixed in: elixir-ecto postgrex 0.22.3

Steps:
1. Search this machine and project for elixir-ecto postgrex: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-58225 being exploited?

There is no confirmed exploitation: CVE-2026-58225 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.26% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2026-58225?

Low: CVSS 2.1 (v4.0, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2026-58225?

elixir-ecto postgrex \>= 0.16.0, \< 0.22.3; elixir-ecto postgrex \>= 266b530faf9bde094e31e0e4ab851f933fadc0f5, \< \*.

### Is there a fix for CVE-2026-58225?

Yes. Fixed in elixir-ecto postgrex 0.22.3. Upgrade postgrex to 0.22.3 or later. Vendor 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.

### How do I check if I'm affected by CVE-2026-58225?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w>
- patch: <https://github.com/elixir-ecto/postgrex/commit/266b530faf9bde094e31e0e4ab851f933fadc0f5>
- patch: <https://github.com/elixir-ecto/postgrex/commit/795c6062f62c4394272ff4b89170688857b4f841>
- patch: <https://github.com/elixir-ecto/postgrex/commit/797d395906c0a1d28bea55e3a2b03ce75c827f55>
- other: <https://cna.erlef.org/cves/CVE-2026-58225.html>
- other: <https://osv.dev/vulnerability/EEF-CVE-2026-58225>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-58225>

HTML: <https://flawdb.com/CVE-2026-58225> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-58225>
