CVE-2026-66838: CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in elixir-ecto postgrex
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.
AI Analysis
Technical Summary
The vulnerability arises because Postgrex.stream/4 concatenates the :comment option directly into the SQL statement without escaping or rejecting the comment terminator sequence '*/'. This allows an attacker who can influence the :comment value to prematurely close the comment and append additional SQL clauses that execute with the connection's privileges. The validation function comment_not_present!/1 is not called by stream/4, unlike other execution points. The injection is confined to the streamed statement since the Parse message accepts only a single command. The issue affects postgrex versions >=0.19.3 and <0.22.4.
Potential Impact
An attacker able to control the :comment option in Postgrex.stream/4 or Ecto.Repo.stream/2 can perform SQL Injection within the streamed statement. This could lead to unauthorized data access or manipulation under the database connection's role. However, the injection is limited to a single statement and cannot chain multiple SQL commands. The vulnerability requires local access or ability to influence the :comment parameter, limiting remote exploitation potential.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, avoid passing untrusted input to the :comment option in Postgrex.stream/4 and Ecto.Repo.stream/2. Review application code to ensure that the :comment parameter is not influenced by external or untrusted sources.
CVE-2026-66838: CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in elixir-ecto postgrex
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 v4.0
Score 5.9medium
Affected software
cpe:2.3:a:elixir-ecto:postgrex:*:*:*:*:*:*:*:*Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability arises because Postgrex.stream/4 concatenates the :comment option directly into the SQL statement without escaping or rejecting the comment terminator sequence '*/'. This allows an attacker who can influence the :comment value to prematurely close the comment and append additional SQL clauses that execute with the connection's privileges. The validation function comment_not_present!/1 is not called by stream/4, unlike other execution points. The injection is confined to the streamed statement since the Parse message accepts only a single command. The issue affects postgrex versions >=0.19.3 and <0.22.4.
Potential Impact
An attacker able to control the :comment option in Postgrex.stream/4 or Ecto.Repo.stream/2 can perform SQL Injection within the streamed statement. This could lead to unauthorized data access or manipulation under the database connection's role. However, the injection is limited to a single statement and cannot chain multiple SQL commands. The vulnerability requires local access or ability to influence the :comment parameter, limiting remote exploitation potential.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, avoid passing untrusted input to the :comment option in Postgrex.stream/4 and Ecto.Repo.stream/2. Review application code to ensure that the :comment parameter is not influenced by external or untrusted sources.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- EEF
- Date Reserved
- 2026-08-06T14:00:01.865Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a75cf11bf8831d5394aa20f
Added to database: 08/07/2026, 12:26:57 UTC
Last enriched: 08/07/2026, 12:48:00 UTC
Last updated: 08/07/2026, 12:56:49 UTC
Views: 9
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.