CVE-2026-66838
SQL injection via the :comment option in Postgrex.stream/4
Check your servers for CVE-2026-66838
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2026-66838 affects postgrex, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
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.
Severity (CVSS)
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
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Attack requirements
- present: an attack works only when the target is in a certain state or configuration
- Privileges required
- none: the attacker does not need an account
- User interaction
- none: nobody has to click or open anything
- Impact on the vulnerable system
- confidentiality high, integrity low, availability none: what an attacker can read, change or stop in the vulnerable component
- Impact on other systems
- confidentiality none, integrity none, availability none: what an attacker can read, change or stop beyond it
Exploitation
EPSS 0.35%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 30.1% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 7 Aug 2026):
- Exploitation
- poc: a proof of concept is public
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Weakness
- CWE-89 Improper Neutralization of Special Elements used in an SQL Command
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
|
postgrex
package
postgrex |
affected from 0.19.3, before 0.22.4
Other versions: unaffected
|
|
postgrex
package
elixir-ecto/postgrex |
affected 4971a2722fa72f8e1b54a2c403cad4c43916e36d and later (unaffected from 4011be852c99dc61ddb98cb01aa41e8775a0e3dd, unaffected from e1ecba618ddea4cee2556bd6ad9b6285e05f9d3c)
Other versions: unaffected
|
Is my server affected?
Find the installed version of postgrex and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i postgrex
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2026-66838 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2026-66838RHEL, Rocky, Alma, Fedora
rpm -q postgrex
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2026-66838Alpine
apk list --installed | grep -i postgrexWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2026-66838
trivy image --scanners vuln IMAGE | grep CVE-2026-66838
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Patches and release notes
- Fix commit 4011be8 in elixir-ecto/postgrex github.com · patch
- Fix commit e1ecba6 in elixir-ecto/postgrex github.com · patch
Exploits and proof of concept
- https://github.com/elixir-ecto/ecto/security/advisories/GHSA-3gww-3f36-2388 github.com · vendor advisory, related, exploit
Other references
- EEF CNA record for CVE-2026-66838 cna.erlef.org · related
- OSV record EEF-CVE-2026-66838 osv.dev · related
- Introducing commit 4971a27 in elixir-ecto/postgrex github.com · related
Source: the record CVE-2026-66838 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse