Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify application forwarding external input to :comment in Postgrex.stream/4
-
DeliveryCraft value containing */ to close SQL comment delimiter
-
ExploitAppend UNION or clause payload to injected string
-
ExecutionPostgrex concatenates unsanitized comment into Parse message
-
PersistPostgreSQL executes injected clause under connection role
-
ImpactAttacker reads sensitive rows from response stream
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 | Exploitation requires that the application passes an externally influenced string as the :comment keyword option to Postgrex.stream/4 or Ecto.Repo.stream/2. The :comment option is optional and not enabled by default; applications that do not use it, or that supply only hard-coded developer strings, are not exploitable. The injected SQL is confined to a single streamed statement - no statement chaining is possible due to PostgreSQL Parse message semantics - limiting attainable impact to UNION-based data exfiltration or WHERE/RETURNING clause manipulation within that one query, bounded by the database connection role's privileges. A specific application architecture must be present: the streaming API in active use, the comment value reachable by external influence, and the Postgrex version in the affected range (0.19.3 to 0.22.3). Applications using only Postgrex.query/4 or other non-streaming execution paths are not affected regardless of version. |
| Impact | The CVSS 4.0 score of 5.9 (Medium) is consistent with the realistic threat model. AV:L indicates the attacker must control an application-internal value - the :comment argument - rather than send a crafted network packet directly to the database. AT:P (attack requirements present) is the most important constraint: two simultaneous conditions must hold - the application must invoke the streaming API, and the :comment value must be derived from externally influenced input - an unusual architectural pattern absent from most Ecto applications. PR:N reflects that no database-level credentials are required from the attacker, though this must not be misread as network-unauthenticated exploitation; local or application-layer influence over the comment value is still necessary. Confidentiality impact is High: successful injection could return arbitrary rows accessible to the connection role. Integrity impact is Low and bounded by the single-statement constraint. No KEV listing and no public proof-of-concept have been identified, confirming this as a real but low-immediacy risk - the attack surface is narrow and the preconditions are uncommon. EPSS data is not available in the provided intelligence. There is no conflict between the CVSS signal and the description. |
| Exploit ScenarioDerived | A developer instruments their Ecto streaming queries by passing a per-request trace identifier as the :comment option - for example, forwarding an HTTP header value directly to Ecto.Repo.stream/2 for log correlation. An attacker supplies the header value |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 07, 2026
SQL injection in Postgrex (elixir-ecto's PostgreSQL driver) versions 0.19.3 through 0.22.3 allows an attacker who controls the :comment option passed to Postgrex.stream/4 or Ecto.Repo.stream/2 to close the SQL comment delimiter with */ and inject arbitrary SQL clauses into the streamed statement, executing them under the existing database connection's role. The root cause is a missing call to the comment_not_present!/1 guard in stream/4, an oversight absent from every other execution path in the library. No public exploit code has been identified and no active exploitation appears in the CISA KEV catalog; the CVSS 4.0 vector (AV:L, AT:P) signals that exploitation requires specific, non-default application architecture.
RemediationAI
Upgrade Postgrex to version 0.22.4 or later, which adds the missing comment_not_present!/1 call to the stream/4 code path; the fix is confirmed in upstream commits https://github.com/elixir-ecto/postgrex/commit/e1ecba618ddea4cee2556bd6ad9b6285e05f9d3c and https://github.com/elixir-ecto/postgrex/commit/4011be852c99dc61ddb98cb01aa41e8775a0e3dd. If an immediate upgrade is not feasible, audit all call sites of Postgrex.stream/4 and Ecto.Repo.stream/2 and ensure the :comment option value is always a hard-coded developer string - never derived from user-supplied input, request parameters, tenant identifiers, or any other external source; this eliminates the injection surface without patching. As a secondary application-layer control, strip or reject any occurrence of */ in comment values before they reach the API, though this is less reliable than the upstream fix since new call sites may be added without following the convention.
Affected VersionsENISA
Affected Packages
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 PostgreSQL driver for the Elixir ecosystem, used directly and as the backing adapter for Ecto (the widely-used Elixir data mapping and query layer). The :comment option exists to embed tracing or diagnostic metadata into the SQL comment prepended to each statement. Postgrex implements this by string-concatenating the caller-supplied comment into the statement text sent in the PostgreSQL wire-protocol Parse message. Every other execution entry point (query, execute, prepare, etc.) calls the internal comment_not_present!/1 validator, which raises an error if the comment string contains the */ delimiter-closing sequence or null bytes. The stream/4 function - and by extension Ecto.Repo.stream/2 - never invoked this guard, leaving the code path unprotected. CWE-89 (Improper Neutralization of Special Elements in SQL Commands) applies directly: user-supplied data reaches the SQL layer without sanitization. Critically, PostgreSQL's Parse message accepts exactly one command, so the injected clauses are constrained to modifying the single streamed statement (e.g., appending UNION, WHERE, or RETURNING clauses) - multi-statement chaining is architecturally prevented. Affected CPE: cpe:2.3:a:elixir-ecto:postgrex:*:*:*:*:*:*:*:* from 0.19.3 to 0.22.3.
Know when Postgrex 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
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N
AV:L because attacker must control an application-internal argument; AC:H for the dual precondition of streaming API use and externally influenced comment; C:H for full data access within connection role scope.
Primary rating from Vendor (EEF).
CVSS VectorVendor: EEF
DescriptionCVE.org
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') vulnerability in elixir-ecto postgrex allows SQL Injection via the :comment option of Postgrex.stream/4. An attacker who can influence that value can close the comment delimiter with */ and extend the streamed statement with their own clauses, which execute under the connection's role. Ecto exposes the same option through Ecto.Repo.stream/2.
Postgrex appends the comment by concatenating it into the statement text sent in the Parse message, without escaping or rejecting */. The option is validated by comment_not_present!/1 at every other execution point; stream/4 never calls it. Because Parse accepts a single command, the injection is confined to the streamed statement and further statements cannot be chained.
This issue affects postgrex: from 0.19.3 before 0.22.4.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.
EUVD-2026-54476
NVD
CVE.org
EPSS
Vulnrichment
GitHub
VulDB
Exploit-DB