Skip to main content

Postgrex CVE-2026-58225

| EUVDEUVD-2026-42867 LOW
SQL Injection (CWE-89)
2026-07-10 6b3ad84c-e1a6-4bf7-a703-f496b71e49db
2.1
CVSS 4.0 · Vendor: 6b3ad84c-e1a6-4bf7-a703-f496b71e49db
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Supply $$ in user-controlled identifier
  2. Delivery
    Application passes identifier to listen/3 unchecked
  3. Exploit
    Channel registered in Postgrex.Notifications
  4. Install
    Network disruption or server restart triggers reconnect
  5. C2
    handle_connect/1 embeds $$ into dollar-quoted replay block
  6. Execute
    PostgreSQL rejects malformed query
  7. Impact
    Notification connection permanently fails to replay subscriptions

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Parameterized queries, prepared statements
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Persistence

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

The application must pass attacker-controlled input directly as a channel name argument to Postgrex.Notifications.listen/3 - for example, using a raw tenant ID, user ID, or session token as the channel name. The attacker-supplied string must contain the exact two-character sequence $$ to prematurely close the dollar-quoted PL/pgSQL block. Exploitation only manifests on a reconnect event (not on the initial LISTEN call), so the attacker must also wait for or trigger a connection disruption. Arbitrary SQL execution is blocked because double-quote doubling via quote_channel/1 prevents forming syntactically complete injected statements - impact is strictly limited to DoS of the notification connection. Applications using static, hardcoded, or developer-controlled channel names are not affected, nor are applications that use Postgrex for regular query execution without the Notifications module.

Impact

The CVSS 4.0 score of 2.1 with vector AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N accurately reflects the tightly bounded impact: availability is low and confined to the notification connection, with no confidentiality or integrity loss. The AT:P (attack precondition) is the critical limiting factor - exploitation is only possible when the application explicitly passes attacker-controlled strings as channel names to Postgrex.Notifications.listen/3, a non-default and architecturally unusual pattern. No public exploit code exists at time of analysis, and the vulnerability has not been listed in the CISA KEV catalog. Real-world risk is meaningful only for multi-tenant Elixir/Phoenix applications that use PostgreSQL LISTEN channels parameterized by tenant or user identifiers; applications using static, hardcoded channel names are entirely unaffected. The denial of service is persistent rather than transient - once a corrupted channel is registered and a reconnect occurs, the notification subsystem silently fails for all tenants sharing that connection until the offending channel is removed and the connection is recycled. The silent failure mode elevates the operational risk above what the low CVSS score might suggest for affected deployments.

Exploit ScenarioDerived

In a multi-tenant Phoenix application, a malicious tenant registers an account with an identifier containing $$, which the application uses directly as a PostgreSQL LISTEN channel name (e.g., to receive real-time updates). When the application calls Postgrex.Notifications.listen/3 with this identifier and the underlying connection subsequently reconnects - due to a network hiccup, PostgreSQL restart, or scheduled maintenance - the replay query embeds $$ into the dollar-quoted block, causing PostgreSQL to reject the malformed statement. Every subsequent reconnect reproduces the failure, permanently silencing real-time notifications for all tenants on that shared connection without any error surfacing to the affected users. No public exploit code was identified at time of analysis.

Monitor Track and reassess. Why: LOW severity (CVSS 0.1-3.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 10, 2026

SQL injection in Postgrex.Notifications' reconnect replay path allows an attacker who can supply untrusted input as a PostgreSQL LISTEN channel name to corrupt the shared notification connection, silently dropping all channel subscriptions and causing persistent denial of service of the notification subsystem. Affected versions are postgrex 0.16.0 through 0.22.2 in the Elixir ecosystem. No arbitrary SQL execution is possible due to double-quote escaping, and no public exploit or CISA KEV listing exists; the CVSS 4.0 base score of 2.1 reflects the constrained, precondition-heavy impact.

RemediationAI

Upgrade postgrex to version 0.22.3 or later, which contains the fix in commit 795c6062f62c4394272ff4b89170688857b4f841 that extends quote_channel/1 to sanitize or reject the $$ dollar-quote delimiter sequence. The vendor advisory is at https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w. If an immediate upgrade is not feasible, the most effective compensating control is to sanitize channel names at the application boundary before passing them to Postgrex.Notifications.listen/3, specifically by rejecting or stripping any string containing the two-character sequence $$; this is a simple pattern match and does not require database interaction. A secondary control is to restrict which values can be used as channel names to a known-safe allowlist (e.g., prefixed UUIDs or hashed identifiers), eliminating attacker influence over the raw channel string. Do not rely solely on the existing null-byte and length guards in listen/3, as they do not cover this delimiter sequence.

Affected VersionsENISA

postgrex 0.16.0 <0.22.3
postgrex 266b530faf9bde094e31e0e4ab851f933fadc0f5 <795c6062f62c4394272ff4b89170688857b4f841

Affected Packages

euvd postgrex fix: 0.22.3

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Postgrex is the primary Elixir/Erlang client library for PostgreSQL, and Postgrex.Notifications provides an asynchronous subscription mechanism built on PostgreSQL's LISTEN/UNLISTEN protocol. The root cause (CWE-89, SQL Injection) lies in the reconnect path: handle_connect/1 replays all registered channels by concatenating individual LISTEN statements inside a dollar-quoted anonymous PL/pgSQL block of the form DO $$BEGIN ... END$$. The sanitization function quote_channel/1 correctly doubles double-quote characters, protecting the single-statement LISTEN and UNLISTEN paths, but it does not escape or reject the $$ delimiter sequence. PostgreSQL's dollar-quoting treats a literal $$ as both an opening and closing delimiter, so a channel name containing $$ prematurely ends the outer dollar-quoted string on the server side, and PostgreSQL parses whatever follows as additional top-level SQL statements. Because handle_connect/1 runs on every reconnect, the corrupted query is re-submitted each time the connection is re-established, preventing the notification connection from ever successfully replaying its subscriptions. The listen/3 guard rejects only null bytes and names longer than 63 bytes, allowing $$ to pass unchallenged.

Know when PostgreSQL gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (6b3ad84c-e1a6-4bf7-a703-f496b71e49db) PRIMARY 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
vuln.today AI 3.7 LOW

Network-reachable via hosting application (AV:N), but AT:P precondition (user input as channel name plus a reconnect) maps to AC:H; no confidentiality or integrity impact.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
4.0 AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

Primary rating from Vendor (6b3ad84c-e1a6-4bf7-a703-f496b71e49db).

CVSS VectorVendor: 6b3ad84c-e1a6-4bf7-a703-f496b71e49db

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
Low
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

1
Patch available
Jul 10, 2026 - 12:01 EUVD

DescriptionCVE.org

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.

Threat Intelligence Overview

EPSS Score
0.2%
Top 94% exploitable
Prevalence
Low
Elixir-ecosystem PostgreSQL driver, niche adoption outside Phoenix/Elixir shops
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity LOW
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
LOW severity (CVSS 0.1-3.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
Poc
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Low
Technical Impact
Partial

Priority Score

10
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +10
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

CVE-2025-1094 HIGH POC
8.1 Feb 13

PostgreSQL libpq functions PQescapeLiteral(), PQescapeIdentifier(), PQescapeString(), and PQescapeStringConn() improperl

CVE-2024-55964 CRITICAL POC
9.8 Mar 26

An issue was discovered in Appsmith before 1.52. Rated critical severity (CVSS 9.8), this vulnerability is remotely expl

CVE-2013-1899 MEDIUM POC
6.5 Apr 04

Argument injection vulnerability in PostgreSQL 9.2.x before 9.2.4, 9.1.x before 9.1.9, and 9.0.x before 9.0.13 allows re

CVE-2026-20253 CRITICAL POC
9.8 Jun 10

Unauthenticated arbitrary file write in Splunk Enterprise (below 10.2.4 and 10.0.7) and Splunk Cloud Platform (below 10.

CVE-2026-9586 CRITICAL POC
9.3 Jul 17

Unauthenticated SQL injection in Sangoma Switchvox SMB Edition 8.3 (build 104997) lets remote attackers execute arbitrar

CVE-2017-7546 CRITICAL
9.8 Aug 16

PostgreSQL versions before 9.2.22, 9.3.18, 9.4.13, 9.5.8 and 9.6.4 are vulnerable to incorrect authentication flaw allow

CVE-2015-1352 MEDIUM POC
5.0 Mar 30

The build_tablename function in pgsql.c in the PostgreSQL (aka pgsql) extension in PHP through 5.6.7 does not validate t

CVE-2024-10553 CRITICAL POC
9.8 Mar 20

A vulnerability in the h2oai/h2o-3 REST API versions 3.46.0.4 allows unauthenticated remote attackers to execute arbitra

CVE-2019-9193 HIGH POC
7.2 Apr 01

In PostgreSQL 9.3 through 11.2, the "COPY TO/FROM PROGRAM" function allows superusers and users in the 'pg_execute_serve

CVE-2026-40887 CRITICAL POC
9.1 Apr 14

Unauthenticated SQL injection in Vendure Shop API allows remote attackers to execute arbitrary SQL commands against the

CVE-2022-24760 CRITICAL POC
10.0 Mar 12

Parse Server is an open source http web server backend. Rated critical severity (CVSS 10.0), this vulnerability is remot

CVE-2025-56157 CRITICAL POC
9.8 Dec 18

Hard-coded default PostgreSQL credentials shipped in the docker-compose.yaml of langgenius Dify through version 1.5.1 al

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy