postgrex is vulnerable to SQL Injection
58
Medium Risk
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.
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.
postgrex is vulnerable to SQL Injection in versions 0.19.3 - 0.22.3.
Upgrade the postgrex library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant