Cybersecurity

Hex.pm Breach: CVSS 10.0 Flaw That Lived 10 Years Hit 6 Registry Servers

Published By Shivam Sharma9 min read
Hex.pm package registry breached through a CVSS 10.0 remote code execution flaw

By our own calculation, a flaw that sat in Hex.pm’s code for 3,926 days took 13 minutes to exploit. On Monday 23 November, an attacker sent 69 malicious requests to the package registry that Elixir and Erlang developers depend on, and ran commands on six of its production servers. Hex.pm had every server on a patched build about 15 minutes after the first request. Hex.pm found no evidence any package was modified. What the attacker may have read is a different story, and one credential still cannot be rotated.

Hex.pm is the official registry where Elixir and Erlang developers fetch their dependencies, and it also serves Gleam. The Hex client is the package manager used with mix in Elixir and rebar3 in Erlang. Hex.pm published its incident report on 24 November, and The Hacker News covered the breach the next day. A compromised registry is the supply-chain nightmare: if packages could be swapped, every project that fetches them would inherit the damage. That is why this breach matters.

Thirteen minutes, six servers

The attack ran on Monday 23 November 2026 between 18:16 and 18:29 UTC. The attacker sent 69 malicious requests from two addresses, about five a minute. The first exploit request arrived at 18:16:00. The last one to reach a server arrived at 18:29:33, and no exploit request from either address succeeded after that.

Commands ran on six production web servers. Three of them were new servers that came up in a restart at 18:28, still running the vulnerable build. The first file created by the exploit appeared 3 milliseconds after a request, at 18:16:46. Hex.pm’s error tracker, Sentry, recorded an error for every exploit request, starting at 18:16:00. The team’s first response on the servers followed at 18:23:55. A firewall rule blocking the attacker’s traffic went in at 18:27 and took full effect between 18:30 and 18:33. Every request from the attacker was denied from 18:33:48. All hex.pm servers were replaced with a patched build between 18:30 and 18:31, about 15 minutes after the first malicious request.

The attacker had been preparing. Hex.pm found repeated downloads of its own dependencies by the two attacker addresses since Thursday 19 November, which the team says suggests the attacker built a local copy of hex.pm to test against. That is the team’s inference, not a confirmed fact.

A separate security report describing the same vulnerability arrived by email at 19:07 UTC on 23 November, after the attack had ended. The reporter is not named in Hex.pm’s incident report.

How a “safe” decoder turned into remote code execution

The flaw is tracked as CVE-2026-129514 and carries the maximum CVSS score of 10.0. It was published on 24 November at 13:48 UTC. It had been in hex.pm’s code since 23 February 2016, when a safety check was removed from the request decoder. That works out at 3,926 days, ten years and nine months, between the check coming out and the flaw being used. Nothing establishes that anyone exploited it before Monday 23 November.

The decoder’s job was to read unauthenticated request bodies in Erlang term format. Hex.pm used Plug.Crypto.non_executable_binary_to_term/2 in “safe” mode, which blocks most dangerous terms but lets struct values through. Because the parser ran before routing and authentication, any unauthenticated POST with the content type application/vnd.hex+erlang reached it on every route.

An Elixir struct is just a map with a __struct__ key naming a module. The decoder never checked maps, so the attacker could send a value the runtime treats as a real struct, with every field set to whatever they chose. From there the chain ran through ordinary code doing ordinary things: a method-override check read a field that did not exist, raised an error with the attacker’s struct in the stack trace, and error reporting called inspect on it. That dispatched to the attacker’s chosen code, first through Ecto.Query.DynamicExpr, then through a DBConnection.Stream whose :log option was an attacker-supplied tuple naming a module, a function and its arguments. The server ran it. That is how a request body became OS command execution as the BEAM’s user.

The fix, in hexpm commit 379b0a2, makes the decoder reject any term containing a map with a __struct__ key, returning a 400. The flaw sits in the hexpm server code. The Hex client update Hex.pm asks users to install is for the new signing system, not a fix for this flaw.

Nothing was changed. Something may have been read.

Hex.pm’s investigation found no evidence that any package was modified. All 23 releases published during the incident match a publish or stage entry in the audit log, and no older release changed. All 62 package files written since 18:00 UTC and all 186 registry files written since 18:00 UTC match the checksums and database contents. Storage writes came only from Hex.pm’s own services. Documentation archives have no stored checksum to compare against, so they could not be verified the same way.

The database check was just as thorough. The team restored a copy of the database from 18:13:59 UTC, two minutes before the first exploit request, and compared every row of every table with the live database. Every difference is explained by an audit-log entry from another address, by background jobs, or by the team’s own response actions. No unexpected change to tables, functions, roles or permissions was found. One caveat: a row changed and then changed back, or overwritten by a later legitimate change, would not show up in that comparison.

No lasting access was found either. Running processes on the affected servers were listed before replacement and no shells were found. Cloud audit logs show no new keys, accounts or API calls from the attacker’s addresses, and no writes by hex.pm’s Kubernetes service accounts. Access logs were extended to 11,379 log objects and 15,635 records to confirm that credentials were not used from outside: all 6,279 hexpm-prod requests came from the three node IPs, and the logs hold no DELETE.OBJECT requests, no requests with a version ID, no ACL or tagging writes, no copies and no bucket listings by hexpm-prod.

But the other half of the finding is what Hex.pm cannot say. Database reads, shell commands, environment-variable reads and direct reads from file storage are not logged, so the team states it cannot rule out that the attacker accessed data stored in the database, including email addresses, password hashes, API key hashes, 2FA secrets, sessions and audit logs. That is the verified wording: may have been accessed, not stolen, and not proven safe either. Network traffic stayed within normal levels, except one worker server that peaked at 0.47 MB/s against a usual maximum of 0.29 MB/s.

Passwords are hashed with bcrypt, which slows guessing but does not prevent it for a weak password, so Hex.pm asks users to change theirs. API keys are 128-bit random values stored as HMAC-SHA256, and Hex.pm considers 128 bits far beyond brute-force reach, so it sees no need to rotate API keys because of the exposed hashes. Private packages are a grey area too: reads in the incident period came from Hex.pm’s own servers and coincide with releases the same organisations published at the time, but a read made from a compromised server would look like one of Hex.pm’s own, so a private-package read cannot be fully ruled out, and reads of private documentation are not logged. Hex.pm says it will contact affected organisations directly. CDN logs show no requests from either attacker address to private docs in the last 30 days.

I use Elixir or Erlang. What do I need to do?

Change your hex.pm password and reset your two-factor authentication now, then update your Hex client when the release with the new signing system arrives. Until then, fetch packages only from repo.hex.pm and do not trust third-party mirrors.

  1. Change your password at hex.pm, and use a password that you use nowhere else.
  2. Reset your 2FA under “Authenticator App” by choosing “Setup New App” and verifying a code.
  3. Store the new recovery codes somewhere safe and accessible, and keep them for later use.
  4. Update your Hex client with mix local.hex --force when the new release is out.
  5. Update rebar3 or Gleam too if you use them, and fetch only from repo.hex.pm.

Hex.pm also warns users to treat emails claiming to come from Hex with suspicion, and to forward suspicious ones to security@hex.pm. Email addresses may have been exposed, so check that any message claiming to be from Hex has links leading to hex.pm, and forward suspicious ones to security@hex.pm.

The signing key that cannot be rotated yet

The attacker’s commands could read the credentials the servers use, so Hex.pm replaced them: the storage, CDN, email and database credentials, and the keys that sign sessions and access tokens. That logged everyone out of hex.pm and the Hex clients. By 10:42 UTC on 24 November, every credential the attacker could have read had been rotated, except the registry signing key and a few low-impact secrets.

The registry signing key is the one credential that cannot yet be replaced. It was among the credentials the attacker could have read, and the current system does not support rotation. Hex.pm is building a new registry signing system that supports key rotation, with new Hex client releases promised in the coming days. Until then, users should fetch packages only from repo.hex.pm and not trust third-party mirrors. No package modifications were found. The key may have been read, so mirrors stay untrusted until the new client ships.

Hex.pm reported a personal data breach to IMY, the Swedish data protection authority, at 22:58 UTC on 23 November. It reported the incident to CISA, the US Cybersecurity and Infrastructure Security Agency, at 23:05 UTC, and CISA confirmed receipt at 23:43. An early warning went to ENISA, the EU Agency for Cybersecurity, at 23:26 UTC. Three regulators were told within 28 minutes of each other that night.

The same flaw class was hiding in three more libraries

While investigating, Hex.pm found the same class of vulnerability in Ash, an Elixir framework: its keyset pagination accepted crafted structs in client-supplied cursors, which could lead to command execution or SQL injection. Hex.pm reported it, and the Ash team released a fix in ash 3.38.0 on 24 November. It is tracked as CVE-2026-124283.

Two more library flaws were found in the same investigation. db_connection has CVE-2026-133555: it should not apply :log callbacks taken from stream structs. flop has CVE-2026-130411. Hardening fixes are also planned for plug_crypto, which will document that its decoder is only safe for authenticated payloads and add an option to reject structs, for plug, which will refuse struct values as body params, and for ecto, which will check that the binding is a list before enumerating it in Inspect.

What is still not known

Who the attacker is, and what they wanted, is not stated anywhere. No group, no country and no motive has been named, and no attribution should be inferred from the two addresses alone. Whether the attacker actually read any account data is unknowable from the logs, which is why every account holder is being told to change their password and reset 2FA. When the new Hex client with the new signing system will ship is dated only as “in the coming days”. Hex.pm says it will update its post as the investigation continues.

The Hex.pm breach is a supply-chain incident with a stark shape: a maximum-severity flaw, in the code since February 2016, weaponised in thirteen minutes, patched in about fifteen. The packages survived. The signing key is the loose end, and until it is rotated, the advice is simple: fetch only from repo.hex.pm, change your password, reset your 2FA, and wait for the new client.