CVE-2026-66838
SQL injection via the :comment option in Postgrex.stream/4
Mitigation
- Upgrade postgrex to 0.22.4 or later.
- Vendor workaround: 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.
Who should check
- Anyone running elixir-ecto postgrex >= 0.19.3, < 0.22.4
- Anyone running elixir-ecto postgrex >= 4971a2722fa72f8e1b54a2c403cad4c43916e36d, < *
Vulnerability facts
- Affected
- elixir-ecto postgrex >= 0.19.3, < 0.22.4; elixir-ecto postgrex >= 4971a2722fa72f8e1b54a2c403cad4c43916e36d, < *
- Fixed in
- elixir-ecto postgrex 0.22.4
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 5.9 (v4.0, CNA)CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:NOpen in CVSS calculator
Show all 11 CVSS metrics
- Attack vector: Local
- Attack complexity: Low
- Attack requirements: Present
- Privileges required: None
- User interaction: None
- Confidentiality impact: High
- Integrity impact: Low
- Availability impact: None
- Confidentiality impact on other systems: None
- Integrity impact on other systems: None
- Availability impact on other systems: None
- EPSS
- 0.41% chance of exploitation in 30 days (percentile 27, 2026-11-26)
- CWE
- CWE-89
- Modified
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| elixir-ecto postgrex | >= 0.19.3, < 0.22.4 | — | cvelist |
| elixir-ecto postgrex | >= 4971a2722fa72f8e1b54a2c403cad4c43916e36d, < * | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2026-66838. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2026-66838.md Affected: elixir-ecto postgrex >= 0.19.3, < 0.22.4; elixir-ecto postgrex >= 4971a2722fa72f8e1b54a2c403cad4c43916e36d, < * Fixed in: elixir-ecto postgrex 0.22.4 Steps: 1. Search this machine and project for elixir-ecto postgrex: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Patches
- https://cna.erlef.org/cves/CVE-2026-66838.html
- https://osv.dev/vulnerability/EEF-CVE-2026-66838
- https://github.com/elixir-ecto/postgrex/commit/4971a2722fa72f8e1b54a2c403cad4c43916e36d
- https://github.com/elixir-ecto/postgrex/commit/4011be852c99dc61ddb98cb01aa41e8775a0e3dd
- https://github.com/elixir-ecto/postgrex/commit/e1ecba618ddea4cee2556bd6ad9b6285e05f9d3c
FAQ
Is CVE-2026-66838 being exploited?
There is no confirmed exploitation: CVE-2026-66838 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.41% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2026-66838?
Medium: CVSS 5.9 (v4.0, scored by CNA). Not remotely exploitable (local or adjacent access needed).
Which versions are affected by CVE-2026-66838?
elixir-ecto postgrex >= 0.19.3, < 0.22.4; elixir-ecto postgrex >= 4971a2722fa72f8e1b54a2c403cad4c43916e36d, < *.
Is there a fix for CVE-2026-66838?
Yes. Fixed in elixir-ecto postgrex 0.22.4. Upgrade postgrex to 0.22.4 or later. Vendor workaround: 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.
How do I check if I'm affected by CVE-2026-66838?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.