CVE-2026-58225
SQL injection via unescaped dollar-quote in Postgrex.Notifications reconnect replay causes notification denial of service
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.
INFO
Published Date :
July 10, 2026, 11:16 a.m.
Last Modified :
July 10, 2026, 12:17 p.m.
Remotely Exploit :
No
Source :
6b3ad84c-e1a6-4bf7-a703-f496b71e49db
CVSS Scores
| Score | Version | Severity | Vector | Exploitability Score | Impact Score | Source |
|---|---|---|---|---|---|---|
| CVSS | 134c704f-9b21-4f2e-91b3-4a467353bcc0 | |||||
| CVSS 4.0 | LOW | 6b3ad84c-e1a6-4bf7-a703-f496b71e49db | ||||
| CVSS 4.0 | LOW | 6b3ad84c-e1a6-4bf7-a703-f496b71e49db |
Solution
- Update the postgrex dependency to version 0.22.3 or higher.
- Ensure channel names are properly sanitized before use.
- Avoid using untrusted input for channel names.
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2026-58225.
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2026-58225 is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2026-58225
weaknesses.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2026-58225 vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2026-58225 vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
CVE Modified by 134c704f-9b21-4f2e-91b3-4a467353bcc0
Jul. 10, 2026
Action Type Old Value New Value Added Reference https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w Added SSVC {'id': 'CVE-2026-58225', 'role': 'CISA Coordinator', 'options': [{'exploitation': 'poc'}, {'automatable': 'no'}, {'technicalImpact': 'partial'}], 'version': '2.0.3', 'timestamp': '2026-07-10T11:47:10.671088Z'} -
New CVE Received by 6b3ad84c-e1a6-4bf7-a703-f496b71e49db
Jul. 10, 2026
Action Type Old Value New Value Added Affected [{'cpes': ['cpe:2.3:a:elixir-ecto:postgrex:*:*:*:*:*:*:*:*'], 'repo': 'https://github.com/elixir-ecto/postgrex', 'vendor': 'elixir-ecto', 'modules': ["'Elixir.Postgrex.Notifications'"], 'product': 'postgrex', 'versions': [{'status': 'affected', 'version': '0.16.0', 'lessThan': '0.22.3', 'versionType': 'semver'}], 'packageURL': 'pkg:hex/postgrex', 'packageName': 'postgrex', 'programFiles': ['lib/postgrex/notifications.ex'], 'collectionURL': 'https://repo.hex.pm', 'defaultStatus': 'unaffected', 'programRoutines': [{'name': "'Elixir.Postgrex.Notifications':handle_connect/1"}, {'name': "'Elixir.Postgrex.Notifications':listen/3"}]}, {'cpes': ['cpe:2.3:a:elixir-ecto:postgrex:*:*:*:*:*:*:*:*'], 'repo': 'https://github.com/elixir-ecto/postgrex', 'vendor': 'elixir-ecto', 'modules': ["'Elixir.Postgrex.Notifications'"], 'product': 'postgrex', 'versions': [{'status': 'affected', 'version': '266b530faf9bde094e31e0e4ab851f933fadc0f5', 'lessThan': '795c6062f62c4394272ff4b89170688857b4f841', 'versionType': 'git'}], 'packageURL': 'pkg:github/elixir-ecto/postgrex', 'packageName': 'elixir-ecto/postgrex', 'programFiles': ['lib/postgrex/notifications.ex'], 'collectionURL': 'https://github.com', 'defaultStatus': 'unaffected', 'programRoutines': [{'name': "'Elixir.Postgrex.Notifications':handle_connect/1"}, {'name': "'Elixir.Postgrex.Notifications':listen/3"}]}] Added 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. Added CVSS V4.0 AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X Added CWE CWE-89 Added Reference https://cna.erlef.org/cves/CVE-2026-58225.html Added Reference https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w Added Reference https://github.com/elixir-ecto/postgrex/commit/795c6062f62c4394272ff4b89170688857b4f841 Added Reference https://osv.dev/vulnerability/EEF-CVE-2026-58225