Read the docs

Forged DBConnection.Stream structs run code in db_connection

Priority LOW 39CWE-470Published · Updated

Key facts

Attack vector
Local
Privileges required
None
User interaction
None
Attack complexity
Low
Attack requirements
Present
Impact type
—
Confidentiality · integrity · availability
High · High · High
Fix status
Fixed

Attack profile from CVSS 4.0 · CNA. Fix status from CNA.

Summary

Versions of db_connection from 1.1.0 before 2.10.3 are affected by CWE-470, unsafe selection of code from externally controlled input. The Enumerable implementations of DBConnection.Stream and DBConnection.PrepareStream run the options stored in the struct, and the :log option accepts a module, function and arguments tuple that DBConnection calls when the struct is enumerated. The source says the flaw is not exploitable in db_connection alone and depends on a downstream component that decodes untrusted input with :erlang.binary_to_term/2 without restricting the resulting terms, so an attacker can execute arbitrary code through such a component by supplying a forged struct.

Written with Claude Haiku 5.5 from the sources below · 2026-11-24

Description from the CNA

Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') vulnerability in elixir-ecto db_connection allows an attacker to execute arbitrary code via a forged DBConnection.Stream or DBConnection.PrepareStream struct. The Enumerable implementations of both structs in lib/db_connection.ex run with the options stored in the struct. The :log option accepts a {module, function, arguments} tuple, which DBConnection applies. When code enumerates a forged struct, DBConnection calls the chosen function. This issue is not exploitable in db_connection alone. It is, in theory, a vulnerability of the downstream component. The root cause is a component that decodes untrusted input with :erlang.binary_to_term/2 and does not restrict which terms the result contains. The :safe option does not reject structs, and these structs contain only plain terms. Structs of other libraries can possibly lead to the same result, so a component that decodes untrusted terms stays at risk independently of db_connection. This record exists because the struct was used in attacks on such components. This issue affects db_connection: from 1.1.0 before 2.10.3.

Why it matters now

EPSS 0.00474 33rd percentileScored 2026-11-30
Fix Fixed db_connection (elixir-ecto): 2.10.3

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
elixir-ectodb_connection1.1.0 to before 2.10.32.10.3Patch availableCNA
  • db_connection Vendorelixir-ecto Affected 1.1.0 to before 2.10.3 Fixed in 2.10.3 Patch available CNA

CPE names CNA · 1

CPEVersionsRoleVendor
cpe:2.3:a:elixir-ecto:db_connection:*:*:*:*:*:*:*:*——elixir-ecto
  • cpe:2.3:a:elixir-ecto:db_connection:*:*:*:*:*:*:*:* Versions — — ·elixir-ecto

Remediation

Upgrade db_connection to version 2.10.3 or later.

Written with Claude Haiku 5.5 from the sources below · 2026-11-24

  • Fix · CNA db_connection (elixir-ecto) Fixed in 2.10.3

Timeline

  1. 2026-11-24 Threatist record created from CVE-2026-133555
  2. 2026-11-24 1 new reference · CNA

References

  • TI-2026-47460 SQL injection via the :comment option in Postgrex.stream/4 CVSS 4.0MEDIUM 5.9
  • TI-2026-85063 Unbounded query cache growth from interpolated JSON paths and splice lists in Ecto CVSS 4.0HIGH 8.9
  • TI-2026-41928 SQL injection in elixir-ecto postgrex CVSS 4.0LOW 2.1
  • TI-2026-25179 SQL injection via channel name in Postgrex.Notifications.listen/3 and unlisten/3 CVSS 4.0HIGH 7.5

Sources

This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences