{"id":"CVE-2026-66838","aliases":["CVE-2026-66838","EEF-CVE-2026-66838","GHSA-3gww-3f36-2388"],"related":[],"kind":"vulnerability","state":"published","title":"SQL injection via the :comment option in Postgrex.stream/4","summary":"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.\n\nPostgrex 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.\n\nThis issue affects postgrex: from 0.19.3 before 0.22.4.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.\n\nPostgrex 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.\n\nThis issue affects postgrex: from 0.19.3 before 0.22.4.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nImproper 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`.\n\nPostgrex 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.\n\nThis issue affects postgrex: from 0.19.3 before 0.22.4.\n\n## Workarounds\n\nReject 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.\n\n## Configurations\n\nThe application must pass a `:comment` derived from untrusted input to `Postgrex.stream/4` or `Ecto.Repo.stream/2`. Applications that omit the option or pass only static values are unaffected.","format":"markdown","source":"eef"},{"lang":"es","text":"Vulnerabilidad de Neutralización Incorrecta de Elementos Especiales utilizados en un Comando SQL (’inyección SQL’) en elixir-ecto postgrex permite la inyección SQL a través de la opción :comment de Postgrex.stream/4. Un atacante que puede influir en ese valor puede cerrar el delimitador de comentario con */ y extender la declaración transmitida con sus propias cláusulas, las cuales se ejecutan bajo el rol de la conexión. Ecto expone la misma opción a través de Ecto.Repo.stream/2.\n\nPostgrex añade el comentario concatenándolo en el texto de la declaración enviado en el mensaje Parse, sin escapar o rechazar */. La opción es validada por comment_not_present!/1 en cualquier otro punto de ejecución; stream/4 nunca la llama. Debido a que Parse acepta un solo comando, la inyección se limita a la declaración transmitida y no se pueden encadenar declaraciones adicionales.\n\nEste problema afecta a postgrex: desde 0.19.3 antes de 0.22.4.","source":"nvd"}],"published":"2026-08-07T12:20:02.376Z","modified":"2026-11-25T06:31:00.369Z","severity":{"scorer":"EEF","scheme":"CVSS:4.0","vector":"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","score":5.9,"rating":"MEDIUM"},"severities":[{"scorer":"EEF","scheme":"CVSS:4.0","vector":"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","score":5.9,"rating":"MEDIUM"},{"scorer":"Erlang Ecosystem Foundation","scheme":"CVSS:4.0","vector":"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"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N","score":8.2,"rating":"HIGH"}],"cwes":["CWE-89"],"affected":[{"ranges":[{"type":"semver","introduced":"0.19.3","fixed":"0.22.4","status":"affected"}],"vendor":"elixir-ecto","product":"postgrex","package":"postgrex","cpe":"cpe:2.3:a:elixir-ecto:postgrex:*:*:*:*:*:*:*:*","repo":"https://github.com/elixir-ecto/postgrex","source":"cvelist"},{"ranges":[{"type":"git","introduced":"4971a2722fa72f8e1b54a2c403cad4c43916e36d","fixed":"*","status":"affected"}],"vendor":"elixir-ecto","product":"postgrex","package":"elixir-ecto/postgrex","cpe":"cpe:2.3:a:elixir-ecto:postgrex:*:*:*:*:*:*:*:*","repo":"https://github.com/elixir-ecto/postgrex","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.19.3","status":"affected","fixed":"0.22.4"}],"ecosystem":"Hex","package":"postgrex","purl":"pkg:hex/postgrex","source":"eef"},{"ranges":[{"type":"git","introduced":"4971a2722fa72f8e1b54a2c403cad4c43916e36d","status":"affected","fixed":"4011be852c99dc61ddb98cb01aa41e8775a0e3dd"},{"type":"git","status":"affected","fixed":"e1ecba618ddea4cee2556bd6ad9b6285e05f9d3c"}],"repo":"https://github.com/elixir-ecto/postgrex","source":"eef"},{"ranges":[{"status":"affected","introduced":"0.19.3","fixed":"0.22.4"}],"vendor":"elixir-ecto","product":"postgrex","cpe":"cpe:2.3:a:elixir-ecto:postgrex:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/elixir-ecto/ecto/security/advisories/GHSA-3gww-3f36-2388","tags":["advisory","exploit","patch","related","vendor-advisory"],"sources":["cvelist","eef","nvd"]},{"url":"https://cna.erlef.org/cves/CVE-2026-66838.html","tags":["patch","related","third-party-advisory","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://osv.dev/vulnerability/EEF-CVE-2026-66838","tags":["patch","related","third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/elixir-ecto/postgrex/commit/4971a2722fa72f8e1b54a2c403cad4c43916e36d","tags":["related","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://github.com/elixir-ecto/postgrex/commit/4011be852c99dc61ddb98cb01aa41e8775a0e3dd","tags":["fix","patch"],"sources":["cvelist","eef","nvd"]},{"url":"https://github.com/elixir-ecto/postgrex/commit/e1ecba618ddea4cee2556bd6ad9b6285e05f9d3c","tags":["fix","patch"],"sources":["cvelist","eef","nvd"]},{"url":"https://hex.pm/packages/postgrex","tags":["package"],"sources":["eef"]}],"credits":["Snehil Shah","Jonatan Männchen / EEF","José Valim"],"assigner":"EEF","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-08-07T15:11:28.060Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-66838","url":"https://www.cve.org/CVERecord?id=CVE-2026-66838","licence":"CVE Terms of Use","modified":"2026-11-20T06:07:52.489Z"},{"source":"eef","name":"Erlang Ecosystem Foundation","id":"EEF-CVE-2026-66838","url":"https://osv.dev/vulnerability/EEF-CVE-2026-66838","licence":"CC-BY-4.0","modified":"2026-11-25T06:31:00.369Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-66838","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-66838","licence":"Public domain","modified":"2026-11-20T06:17:36.523Z"}],"updatedAt":"2026-11-25T22:59:31.847Z","epss":{"score":0.00346,"percentile":0.30164,"date":"2026-12-01T12:00:22.000Z"}}