Hex.pm was exploited for 13 minutes, and the registry signing key still hasn't been rotated
An attacker ran OS commands on six Hex.pm servers on November 23 through a decoder bug from 2016. No package was changed, but the registry signing key could have been read and is not yet rotated.
On November 23 an attacker sent 69 requests to hex.pm over 13 minutes and ran OS commands on six production web servers. The bug they used had been in the registry's code since February 23, 2016. The maintainers had a patched build on every server by 18:31 UTC, roughly 15 minutes after the first hostile request. No package was modified. But the attacker could have read the environment of the service account, and that environment held the key that signs the entire registry. As of the incident report, that key has not been rotated, because nothing in the current Hex client can accept a new one.
Hex.pm is where every Elixir, Erlang and Gleam project pulls dependencies from. If you ship on the BEAM, this is your npm getting popped.
A parser that ran before authentication
The advisory is CVE-2026-129514, CVSS 4.0 score 10.0, CWE-502. The hexpm server accepts request bodies in Erlang's external term format under the content type application/vnd.hex+erlang. The body parser for that format runs as a Plug before routing and before authentication. An unauthenticated POST to any path on the site reached the decoder.
The decoder called Plug.Crypto.non_executable_binary_to_term/2 with the :safe option. That function rejects funs and other executable terms, and :safe stops the creation of new atoms. Neither check blocks a map with a __struct__ key. In Elixir a struct is a map with that key naming a module, and protocol dispatch trusts the key. So a request body could claim to be any struct the release had loaded, including Ecto.Query.DynamicExpr and DBConnection.Stream.
From there the chain is long and none of it is in hexpm's own code. Plug.MethodOverride reads a _method field from every POST. Calling Access.get/3 on the fake struct raises an UndefinedFunctionError with the struct sitting in the stack frame. Error reporting then runs inspect/1 on it. Ecto's Inspect implementation for DynamicExpr calls Enum.map/2 on a field the attacker controls, which dispatches to DBConnection.Stream, whose declare/4 turns a {module, function, args} tuple into a closure and applies it. That is apply/3 on values from the request body, running as the BEAM user. The teardown by dohyeontech walks each hop with the code.
Git history says a commit on February 23, 2016 removed a safe_term?/1 check that rejected all atoms. In 2018 the decoder was swapped for the Plug.Crypto function. The function's name promised safety from execution. It delivered safety from funs. Those are different things, and for eight years nobody asked which one they had.
I've run infrastructure long enough to have a rule about this: a security function's name is a claim, and claims get verified. "non_executable" told every reviewer to move on. The fix, commit 379b0a2, walks the decoded term through map keys, values, list tails and tuples and returns an error if any map carries __struct__. The parser now answers HTTP 400.
Thirteen minutes, and three servers rejoined on the wrong build
The incident report by Peter Ullrich, Jonatan Männchen and Eric Meadows-Jönsson gives the timeline to the second.
- 18:14:21 UTC: first request of any kind from either of the two attacker addresses.
- 18:16 to 18:29: 69 exploit requests. Files created by the exploit appeared on six web servers, one of them 3 milliseconds after the request.
- 18:27: firewall rule added, with full effect between 18:30 and 18:33.
- 18:30 to 18:31: every server replaced with a patched build.
- 18:47 and 18:49: replacement AWS key created, old key deactivated.
- 19:07: an emailed security report describing the same vulnerability arrived, 35 minutes after the fix was live.
- 20:21: most infrastructure credentials rotated.
- 22:58, 23:05 and 23:26: breach reported to Sweden's data protection authority, to CISA, and as an early warning to ENISA.
- November 24, 10:42: every credential the attacker could have read was rotated, database password included. The CVE published at 13:48.
One detail in there should sting anyone who runs a fleet. Three of the six affected servers joined during the attack, because a restart brought up machines still on the vulnerable build. The team was deploying a fix and the platform was cheerfully scaling out the old image underneath them. I have watched that exact thing happen on more than one platform. Your deploy and your autoscaler do not know about each other unless you make them.
The two attacker addresses had been active since late the prior week. Hexpm is open source, so the likeliest reading is that someone stood up a local copy and tested the chain until it worked. The 19:07 email from a separate researcher is a coincidence the report does not try to explain.
What they proved and what they couldn't
The verification work is the part other projects should copy. The team restored a database snapshot from 18:13:59, two minutes before the first exploit request, and compared it row by row against the live database. Every difference traced to normal activity. All 23 releases published during the window match the audit log. The 62 package files and 186 registry files written after 18:00 match database checksums. All 6,279 requests to the production storage bucket came from the three node IPs. CDN logs show no requests for private docs from the attacker addresses in the last 30 days. No shells on disk, no new cloud keys, no new accounts.
Then the honest half. Database reads are not logged. Neither are shell commands, environment variable access, or direct reads from file storage. So the report says it "cannot rule out" that the attacker read email addresses, password hashes, API key hashes, 2FA secrets, session data and audit logs. One worker server peaked at 0.47 MB/s outbound against a normal maximum of 0.29 MB/s, which is either an exfil or nothing, and the logs can't say which.
Passwords are bcrypt hashes. API keys are random 128-bit values stored as HMAC-SHA256, which the team says are not worth rotating, and I agree with the math. 2FA secrets are stored in a form that is useful to an attacker who has them, which is why the reset instruction is reset 2FA, not merely change your password.
And the registry signing key. The advisory lists it among the values readable from the process environment. It has not been rotated. The report says: "We're building a new registry signing system that supports key rotation." The current signing scheme has no rotation path, so a new client has to ship before a new key can exist. Until then Hex's guidance is to fetch only from repo.hex.pm and to avoid third-party mirrors, because a mirror serving a registry signed by a stolen key would verify fine on today's client.
A signing key you cannot rotate is a key you cannot afford to lose, and this one sat in an environment variable on a web server with an unauthenticated deserializer in front of it. That design predates everyone's current understanding of supply chain attacks. It is also the design most registries still have.
If you ship on the BEAM
The account steps are short. Change your hex.pm password. Reset 2FA at the security dashboard and save the new recovery codes. Run mix hex.user auth or rebar3 hex user auth to log the client back in. When the new client ships, reinstall the Hex archive with mix local.hex and update rebar3 or Gleam. Treat any email about Hex as phishing until the links resolve to hex.pm.
If you only fetch public packages and never made an account, Ullrich confirmed on the Elixir Forum that you have nothing to reset.
If you run your own hexpm, you are vulnerable until you deploy 379b0a2. The flaw is in the server, and your copy is as old as your last pull.
Three library fixes landed the same day and are separate from the registry incident. Ash 3.38.0 fixes CVE-2026-124283, exploitable only with keyset pagination, a client supplied cursor and a signing secret left at its default. db_connection 2.10.3 fixes CVE-2026-133555, which is not exploitable alone and now normalizes the log tuple when the stream is built instead of at declare time. Flop shipped fixes on four branches for CVE-2026-130411. Ecto's Inspect implementation now requires the fields to be a function and a list.
The wider point for anyone writing Elixir: if your app decodes external term format from the network, Plug.Crypto's helper does not protect you from struct injection today. Reject __struct__ yourself, recursively, until plug_crypto and plug ship the change the report promises.
Hex's response is the best I have read from a package registry. Fifteen minutes from first exploit request to a patched fleet, credentials rotated the same night, three regulators notified before midnight, and a report that lists what it could not see. The gap is the signing key, and my bet is that fixing it takes longer than the "coming days" the report expects, because every Hex, rebar3 and Gleam client in the world has to learn a new trust root before the old one can be retired.


