Intel

AIKIDO-2026-848264

postgrex is vulnerable to SQL Injection

SQL InjectionCVE-2026-66838 Published Aug 11, 2026

58

Medium Risk

This Affects:

ELIXIRpostgrex
0.19.3 - 0.22.3
Fixed in 0.22.4
Are you affected? Scan for Free

TL;DR

Postgrex.stream/4 appends the caller-supplied :comment option into the SQL text of the PostgreSQL Parse message by concatenation, without escaping or rejecting */. An attacker who can influence that value can close the comment delimiter and extend the streamed statement with their own clauses, which then execute under the connection's database role. Ecto.Repo.stream/2 exposes the same option. Other query paths already reject unsafe comments via comment_not_present!/1, but stream/4 never calls it. The fix rejects comment values that contain */ or a null byte before they are sent.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and pass an untrusted :comment to Postgrex.stream/4 or Ecto.Repo.stream/2.

Background info

postgrex is vulnerable to SQL Injection in versions 0.19.3 - 0.22.3.

How to fix this

Upgrade the postgrex library to the patch version.

Are You Affected?

Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.

Free. No credit card required.

Aikido Platform