CVE-2026-58225

SQL injection via unescaped dollar-quote in Postgrex.Notifications reconnect replay causes notification denial of service

2.1 low EPSS 0.24%

Published 10 Jul 2026 Updated 24 Nov 2026 CNA: EEF

Check your servers for CVE-2026-58225

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2026-58225 affects postgrex, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

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.

Severity (CVSS)

2.1 low CVSS 4.0 from EEF (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
Attack vector
local: the attacker needs local access, or a user has to open a prepared file
Attack complexity
low: an attack works without special conditions
Attack requirements
present: an attack works only when the target is in a certain state or configuration
Privileges required
none: the attacker does not need an account
User interaction
none: nobody has to click or open anything
Impact on the vulnerable system
confidentiality none, integrity none, availability low: what an attacker can read, change or stop in the vulnerable component
Impact on other systems
confidentiality none, integrity none, availability none: what an attacker can read, change or stop beyond it

Exploitation

EPSS 0.24%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 16.3% of all scored CVEs. Scores of 1 Dec 2026.

The assessment of CISA (SSVC, 10 Jul 2026):

Exploitation
poc: a proof of concept is public
Automatable
no: each attack takes manual steps
Technical impact
partial: limited control or limited data

Weakness

  • CWE-89 Improper Neutralization of Special Elements used in an SQL Command

Affected products

As the CNA lists them.

ProductVersions
postgrex
package postgrex
affected from 0.16.0, before 0.22.3
Other versions: unaffected
postgrex
package elixir-ecto/postgrex
affected 266b530faf9bde094e31e0e4ab851f933fadc0f5 and later (unaffected from 795c6062f62c4394272ff4b89170688857b4f841, unaffected from 797d395906c0a1d28bea55e3a2b03ce75c827f55)
Other versions: unaffected

Is my server affected?

Find the installed version of postgrex and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.

Debian, Ubuntu

dpkg -l | grep -i postgrex
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2026-58225 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2026-58225

RHEL, Rocky, Alma, Fedora

rpm -q postgrex
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2026-58225

Alpine

apk list --installed | grep -i postgrex

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2026-58225
trivy image --scanners vuln IMAGE | grep CVE-2026-58225

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Patches and release notes

Exploits and proof of concept

Other references

Source: the record CVE-2026-58225 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.