CVE-2026-66838
Awaiting Analysis Awaiting Analysis - Queue

SQL Injection in Postgrex via Ecto.Repo.stream

Vulnerability report for CVE-2026-66838, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-08-07

Last updated on: 2026-08-07

Assigner: 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.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-08-07
Last Modified
2026-08-07
Generated
2026-08-07
AI Q&A
2026-08-07
EPSS Evaluated
N/A
NVD
EUVD

Affected Vendors & Products

Showing 2 associated CPEs
Vendor Product Version / Range
elixir postgrex From 0.19.3 (inc) to 0.22.4 (exc)
elixir postgrex 0.22.4

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-89 The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

CVE-2026-66838 is a SQL injection vulnerability in the Postgrex library affecting versions 0.19.3 to 0.22.3. The issue occurs when the :comment option in Postgrex.stream/4 is not properly sanitized. An attacker can inject malicious SQL code by closing the comment delimiter with */ and appending additional clauses to the query. This allows reading sensitive data or modifying the database state if the attacker controls the comment value.

Detection Guidance

To detect this vulnerability, check the version of Postgrex in use. If it is between 0.19.3 and 0.22.3, the system is vulnerable. Run: mix deps | grep postgrex to check the installed version.

Impact Analysis

If you use Postgrex versions between 0.19.3 and 0.22.3, an attacker with local access could exploit this to read sensitive data or alter database state by injecting malicious SQL through the :comment option in stream queries. The attack requires low complexity and no privileges.

Compliance Impact

This SQL injection vulnerability could lead to unauthorized access to sensitive data, which may violate compliance requirements under GDPR (data protection) and HIPAA (health information privacy). Unauthorized data exposure or modification could result in regulatory penalties or breaches of confidentiality obligations.

Mitigation Strategies

Upgrade Postgrex to version 0.22.4 or later immediately. Update dependencies using mix deps.update postgrex and verify the version after update.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-66838. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart