Decade-Old Deserialization Flaw Let Attackers Run Commands on Six Hex.pm Package Registry Servers
A parser flaw present on hex.pm since February 2016 let an unauthenticated attacker run commands on six servers; the Elixir and Erlang package registry patched it within roughly 15 minutes.
Overview
An unauthenticated attacker ran commands on six production servers belonging to hex.pm, the package registry used by the Elixir and Erlang communities, by exploiting a parser flaw that had existed in the registry’s code since February 23, 2016, according to a security incident report published by hex.pm maintainers Peter Ullrich, Jonatan Männchen and Eric Meadows-Jönsson. The flaw, tracked as CVE-2026-129514 and rated the maximum CVSS score of 10.0, was exploited on November 23, 2026, and was patched within roughly 15 minutes of the first malicious request, The Hacker News reported.
What We Know
The attack and the response
According to hex.pm’s own account, the attacker sent 69 malicious requests between 18:16 and 18:29 UTC, hitting six servers. The team added a firewall rule to block the traffic at 18:27 and had all servers patched by 18:30-18:31 UTC — the entire exploitation-to-patch window lasted about 15 minutes. Hex.pm’s postmortem states plainly: “On November 23, 2026, an unauthorized third party exploited a vulnerability in hex.pm that let them run commands on our web servers.”
The response continued well past the initial patch. By 18:49 UTC the team had deactivated an AWS access key; by 20:21 UTC it had rotated most infrastructure credentials; by 10:42 UTC the next day, November 24, it had rotated all credentials except the registry’s package-signing key. The incident was also reported to Sweden’s data protection authority (IMY) at 22:58 UTC, to the U.S. Cybersecurity and Infrastructure Security Agency (CISA) at 23:05 UTC, and as an early warning to the EU’s ENISA at 23:26 UTC on the night of the breach, hex.pm said. A security vulnerability report describing the same flaw, submitted independently by an outside researcher, arrived by email at 19:07 UTC — after the exploitation window had already closed, The Hacker News noted.
How the flaw worked
The root cause, per hex.pm’s writeup, was a custom parser that handled Erlang-formatted request bodies — content type application/vnd.hex+erlang — before any routing or authentication took place. That parser decoded request bodies using Plug.Crypto.non_executable_binary_to_term/2. Hex.pm’s postmortem states: “The decoder rejected functions and new atoms, but it never checked maps.” The reason that mattered, the postmortem explains, is that “an Elixir struct is just a map with a __struct__ key naming a module.”
From there, hex.pm described a multi-hop chain: a forged struct caused Plug.MethodOverride to raise an UndefinedFunctionError; the application’s error-reporting tooling then called inspect on the malformed struct, which ran attacker-chosen module code; that code dispatched into Ecto.Query.DynamicExpr’s enumeration protocol, reaching a second forged struct; that struct, a DBConnection.Stream, executed its :log callback option — which the attacker had set to an arbitrary {module, function, args} tuple, giving them command execution on the server. The GitHub security advisory for the flaw independently confirms the same chain, describing how the decoder’s acceptance of __struct__ keys let Elixir’s protocol dispatch select implementations such as Inspect and Enumerable by attacker-chosen struct name, chaining through Ecto.Query.DynamicExpr and DBConnection.Stream to reach an apply/3 call that executes arbitrary commands as the BEAM process user.
Hex.pm’s fix, shipped in commit 379b0a2 the same day, makes the decoder reject any term containing a map with a __struct__ key outright, returning an HTTP 400 error instead.
What was and wasn’t affected
Hex.pm said it found “no evidence of unauthorized package modifications, or database changes, or that the attacker maintained access.” To verify that, the team compared a database snapshot restored to 18:13:59 UTC — just before the attack began — against the live database, checked storage checksums for 62 package files and 186 registry files, and confirmed all 23 package releases published during the incident window matched its audit logs.
The team could not fully rule out exposure of some data, however: email addresses, password hashes, API key hashes, two-factor-authentication secrets, session data and audit logs could potentially have been read, because database reads themselves are not logged. As a precaution, hex.pm logged out every account and is asking all users to change their password and reset two-factor authentication; it said rotating API keys isn’t necessary because they are stored as 128-bit random values hashed with HMAC-SHA256, but recommended password changes because passwords are bcrypt-hashed and therefore vulnerable to offline brute-forcing if the hashes were exposed.
The same bug pattern elsewhere in the ecosystem
The hop through DBConnection.Stream’s :log option is being fixed in the db_connection library itself, in an advisory reported by Elixir creator José Valim titled “Code execution via the :log option of forged DBConnection.Stream structs in db_connection,” according to the library’s GitHub security advisories page; The Hacker News reports that fix, tracked as CVE-2026-133555, lands in db_connection 2.10.3.
A related, independently discovered struct-deserialization vulnerability was also disclosed the same day in Ash, a separate Elixir application framework. According to the CVE Numbering Authority record for CVE-2026-124283, a “deserialization of untrusted data vulnerability in ash-project ash allows an unauthenticated attacker to execute arbitrary code or inject SQL through a forged keyset pagination cursor,” affecting Ash versions 3.31.3 through 3.37.x and fixed in 3.38.0, released November 24. Ash’s bug follows the same underlying pattern as the hex.pm flaw: a client-supplied value is deserialized into a struct and later reaches the same ecto and db_connection protocol implementations without being adequately checked.
What We Don’t Know
The identity of the attacker behind the hex.pm breach remains unknown. The Hacker News reports that activity in hex.pm’s logs suggests the attacker had tested the exploit locally against a copy of hex.pm before running it against production. Hex.pm’s own report says it could not fully exclude the possibility that private package data was read during the incident, since direct database reads are not logged, though package storage itself was verified unmodified.
Why It Matters
Hex.pm says it is pursuing broader hardening beyond the immediate patch: documenting that plug_crypto’s struct-blocking is not safe against unauthenticated data and adding an option to reject structs outright, having the plug library refuse struct values as body parameters, adding list validation to ecto’s Inspect protocol before enumeration, and removing the :log callback’s ability to execute code from db_connection’s stream structs. The near-simultaneous, independent discovery of a structurally similar deserialization flaw in Ash underscores that the underlying pattern — decoding client-supplied data into structs that are later inspected or enumerated by framework code — was not confined to a single project.