# CVE-2026-66838: SQL injection via the :comment option in Postgrex.stream/4

- Severity: Medium 5.9 (CVSS:4.0, scored by EEF) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.35%, higher than 30% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-08-07T12:20:02.376Z
- Modified: 2026-11-25T06:31:00.369Z
- Also known as: EEF-CVE-2026-66838, GHSA-3gww-3f36-2388
- Weaknesses: CWE-89
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- Assigned by: EEF

## 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.

(As written by CVE List.)

## Affected

- postgrex: from 0.19.3 before 0.22.4
- elixir-ecto/postgrex: from 4971a2722fa72f8e1b54a2c403cad4c43916e36d before *
- postgrex (Hex): from 0.19.3 before 0.22.4
- https://github.com/elixir-ecto/postgrex: from 4971a2722fa72f8e1b54a2c403cad4c43916e36d before 4011be852c99dc61ddb98cb01aa41e8775a0e3dd; before e1ecba618ddea4cee2556bd6ad9b6285e05f9d3c
- elixir-ecto postgrex: from 0.19.3 before 0.22.4

## Every score

- EEF: CVSS:4.0 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`
- Erlang Ecosystem Foundation: CVSS:4.0 `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`
- NVD: CVSS:3.1 8.2 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N`

## References

- <https://github.com/elixir-ecto/ecto/security/advisories/GHSA-3gww-3f36-2388> (exploit, advisory, patch, related, vendor-advisory)
- <https://cna.erlef.org/cves/CVE-2026-66838.html> (patch, related, third-party-advisory, web)
- <https://osv.dev/vulnerability/EEF-CVE-2026-66838> (patch, related, third-party-advisory)
- <https://github.com/elixir-ecto/postgrex/commit/4971a2722fa72f8e1b54a2c403cad4c43916e36d> (related, web)
- <https://github.com/elixir-ecto/postgrex/commit/4011be852c99dc61ddb98cb01aa41e8775a0e3dd> (fix, patch)
- <https://github.com/elixir-ecto/postgrex/commit/e1ecba618ddea4cee2556bd6ad9b6285e05f9d3c> (fix, patch)
- <https://hex.pm/packages/postgrex> (package)

## Sources

- CVE List: [CVE-2026-66838](https://www.cve.org/CVERecord?id=CVE-2026-66838), CVE Terms of Use, modified 2026-11-20
- Erlang Ecosystem Foundation: [EEF-CVE-2026-66838](https://osv.dev/vulnerability/EEF-CVE-2026-66838), CC-BY-4.0, modified 2026-11-25
- NVD: [CVE-2026-66838](https://nvd.nist.gov/vuln/detail/CVE-2026-66838), Public domain, modified 2026-11-20

---

Page: https://cve.day/CVE-2026-66838 · Whole record: https://cve.day/CVE-2026-66838.json · Rebuilt by cve.day 2026-11-25T22:59:31.847Z
