CVE-2026-32687: SQL injection via channel name in Postgrex.Notifications.listen/3 and unlisten/3
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') vulnerability in elixir-ecto postgrex ('Elixir.Postgrex.Notifications' module) allows SQL Injection.
The channel argument passed to 'Elixir.Postgrex.Notifications':listen/3 and 'Elixir.Postgrex.Notifications':unlisten/3 is interpolated directly into LISTEN "..." / UNLISTEN "..." SQL statements without escaping the " character. An attacker who can influence the channel name can inject a " to break out of the quoted identifier and append arbitrary SQL. Because the notifications connection uses the PostgreSQL simple query protocol, multi-statement payloads are accepted, allowing DDL and DML commands to be chained (e.g. ; DROP TABLE ...; --). The same unsanitized interpolation also occurs in handle_connect/1 when replaying LISTEN commands after a reconnect.
This vulnerability is associated with program file lib/postgrex/notifications.ex and program routines 'Elixir.Postgrex.Notifications':listen/3, 'Elixir.Postgrex.Notifications':unlisten/3, 'Elixir.Postgrex.Notifications':handle_connect/1.
This issue affects postgrex: from 0.16.0 before 0.22.2.
Security readout for executives and security teams
Plain-English summary
Postgrex can treat a notification channel name as SQL when applications allow untrusted input to reach notification listen or unlisten operations. Successful abuse could let an attacker alter or destroy database data within the notification connection’s privileges. Applications using only fixed, trusted channel names are less exposed.
Executive priority
Prioritize expedited remediation where external users, tenants, messages, or other untrusted sources can influence notification channel names. Elsewhere, schedule a prompt dependency upgrade and document why inputs are trusted. Database privileges should inform urgency because they bound the potential damage.
Technical view
Postgrex versions 0.16.0 through 0.22.1 interpolate channel identifiers without escaping double quotes in listen/3, unlisten/3, and reconnect replay. Because the connection uses PostgreSQL’s simple query protocol, injected input can introduce additional statements. The issue is CWE-89 and has a CVSS 4.0 score of 7.5.
Likely exposure
Exposure requires an affected Postgrex version and attacker influence over a channel name passed to the vulnerable notification functions. Reconnect handling can replay a malicious channel. Impact depends on the PostgreSQL privileges assigned to the notifications connection. The supplied sources do not identify specific exposed applications.
Exploitation context
No CISA KEV listing or cited evidence of active exploitation is supplied. Exploitation has a prerequisite: attacker-controlled channel input must reach the vulnerable API. If reachable, the simple query protocol permits multiple SQL statements, creating potential confidentiality, integrity, and availability impact.
Researcher notes
The vulnerable routines are in lib/postgrex/notifications.ex: listen/3, unlisten/3, and handle_connect/1. The core flaw is missing quoted-identifier escaping combined with simple-query multi-statement handling. The fixed release boundary is 0.22.2, and the supplied patch reference is commit 7cdedbd4316bb65f82e6a9a4f922c0ac491cb770.
Mitigation direction
Upgrade Postgrex to version 0.22.2 or later.
Until upgraded, allow only fixed, trusted notification channel names.
Restrict the notifications database role to the minimum necessary privileges.
Review the vendor advisory and patch commit for deployment-specific guidance.
Validation and detection
Inventory applications and lockfiles for Postgrex versions 0.16.0 through 0.22.1.
Trace all listen/3 and unlisten/3 channel values to their input sources.
Check whether reconnect replay can retain attacker-influenced channel names.
Confirm the notifications connection uses a least-privileged PostgreSQL role.
Verify production deployments resolve Postgrex 0.22.2 or later after remediation.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · medium confidence lookup
CWE-89: Database access and collection lookup
Injection into data stores can inform collection, data access, and exfiltration detection reviews. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references database injection or access, so collection and exfiltration review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
1ADP providers
5Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-89 · source CWE mapping
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.