SQL injection via the :comment option in Postgrex.stream/4
Summary
| CVE | CVE-2026-66838 |
|---|---|
| State | PUBLISHED |
| Assigner | EEF |
| Source Priority | CVE Program / NVD first with legacy fallback |
| Published | 2026-08-07 13:16:52 UTC |
| Updated | 2026-10-24 16:10:00 UTC |
| Description | 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. |
Risk And Classification
Primary CVSS: v4.0 5.9 MEDIUM from 6b3ad84c-e1a6-4bf7-a703-f496b71e49db
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/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
EPSS: 0.004030000 probability, percentile 0.333780000 (date 2026-10-23)
Problem Types: CWE-89 | CWE-89 CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
| Version | Source | Type | Score | Severity | Vector |
|---|---|---|---|---|---|
| 4.0 | 6b3ad84c-e1a6-4bf7-a703-f496b71e49db | Secondary | 5.9 | MEDIUM | 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/E:X/C... |
| 4.0 | CNA | CVSS | 5.9 | MEDIUM | 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 |
| 3.1 | [email protected] | Primary | 8.2 | HIGH | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N |
CVSS v4.0 Breakdown
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/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
CVSS v3.1 Breakdown
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N
NVD Known Affected Configurations (CPE 2.3)
| Type | Vendor | Product | Version | Update | Edition | Language |
|---|---|---|---|---|---|---|
| Application | Elixir-ecto | Postgrex | All | All | All | All |
Vendor Declared Affected Products
| Source | Vendor | Product | Version | Platforms |
|---|---|---|---|---|
| CNA | Elixir-ecto | Postgrex | affected 0.19.3 0.22.4 semver | Not specified |
| CNA | Elixir-ecto | Postgrex | affected 4971a2722fa72f8e1b54a2c403cad4c43916e36d * git | Not specified |
References
| Reference | Source | Link | Tags |
|---|---|---|---|
| github.com/elixir-ecto/postgrex/commit/e1ecba618ddea4cee2556bd6ad9b6285e... | 6b3ad84c-e1a6-4bf7-a703-f496b71e49db | github.com | Patch |
| osv.dev/vulnerability/EEF-CVE-2026-66838 | 6b3ad84c-e1a6-4bf7-a703-f496b71e49db | osv.dev | Patch, Third Party Advisory |
| github.com/elixir-ecto/ecto/security/advisories/GHSA-3gww-3f36-2388 | 134c704f-9b21-4f2e-91b3-4a467353bcc0 | github.com | Exploit, Patch, Vendor Advisory |
| github.com/elixir-ecto/postgrex/commit/4011be852c99dc61ddb98cb01aa41e877... | 6b3ad84c-e1a6-4bf7-a703-f496b71e49db | github.com | Patch |
| cna.erlef.org/cves/CVE-2026-66838.html | 6b3ad84c-e1a6-4bf7-a703-f496b71e49db | cna.erlef.org | Patch, Third Party Advisory |
| CVE Program record | CVE.ORG | www.cve.org | canonical |
| NVD vulnerability detail | NVD | nvd.nist.gov | canonical, analysis |
Vendor Comments And Credit
Discovery Credit
CNA: Snehil Shah (en)
CNA: José Valim (en)
CNA: Jonatan Männchen / EEF (en)
Additional Advisory Data
Workarounds
CNA: Reject any :comment value containing */ or a null byte before passing it to Postgrex.stream/4 or Ecto.Repo.stream/2. Alternatively, build comments only from trusted values.