Hex.pm Breached via CVE-2026-129514 (CVSS 10.0): Unauthenticated Erlang-Term RCE Hit Six Registry Servers in 13 Minutes — No Tampered Packages Found, but Every User Must Change Password and Reset 2FA

Attackers exploited a forged-struct deserialisation flaw in hex.pm's Erlang request parser to run commands on six servers on 23 November; Hex patched within minutes, found no altered packages, but cannot rule out database reads and asks all users to change passwords and reset 2FA.
Attackers used a critical flaw in hex.pm, the package registry for Elixir, Erlang and Gleam, to run operating system commands on six of its production servers on 23 November. The bug is tracked as CVE-2026-129514 (CVSS 4.0 score 10.0, CWE-502). Hex says the attack lasted about 13 minutes and that it found no tampered packages. It cannot rule out that the attacker read the user database, so every hex.pm user is being asked to change their password and set up two-factor authentication (2FA) again.
What Happened
Hex has published a detailed timeline. The attack came from two IP addresses:
- 22:14 Mauritius time (18:14 UTC), 23 November: the first request from either address.
- 22:16 (18:16 UTC): the first exploit request. Hex's error tracker logged its first error at the same second, and a file appeared on a server 46 seconds later.
- 22:27 (18:27 UTC): responders added a firewall rule to block the addresses. A restart at 22:28 (18:28 UTC) started three new servers that were still on the vulnerable build. That is why six servers were hit, not three.
- 22:29:33 (18:29:33 UTC): the last exploit request to reach a server. Hex says none succeeded after this point.
- 22:31 (18:31 UTC): every hex.pm server was running the patched build. That was about 15 minutes after the first exploit request.
In total the attacker sent 69 malicious requests. Hex also saw repeated downloads of hex.pm's own dependencies from 19 November. It says this "suggests the attacker built a local copy of hex.pm to test against."
At 23:07 (19:07 UTC) Hex received a security report by email describing the same vulnerability. Over the next day it rotated most of its infrastructure credentials. It notified IMY, Sweden's data protection authority, at 02:58 Mauritius time on 24 November (22:58 UTC on 23 November). It reported the incident to CISA at 03:05 (23:05 UTC) and sent an early warning to ENISA. The Erlang Ecosystem Foundation, acting as the CNA, published the CVE at 17:48 Mauritius time (13:48 UTC) on 24 November, together with GitHub advisory GHSA-9pmm-hf4r-27pg.
Technical Details
The Hex command-line clients can send requests to the registry as Erlang terms (content type application/vnd.hex+erlang). hex.pm decoded these bodies with Plug.Crypto.non_executable_binary_to_term/2 in safe mode. That decoder refuses functions and new atoms, but it does not restrict maps. So a map carrying a __struct__ key passes through as if it were an Elixir struct of any module the attacker names.
The parser ran before routing and authentication, so no login was needed. Every route was reachable. According to the advisory, the chain worked like this:
- A forged struct ends up in the request's body parameters.
Plug.MethodOverridethen tries to read a_methodkey from it, which raises an error. - Error reporting (Sentry, the Bandit error log and the JSON log formatter) calls
inspect/1on the struct. That runs theInspectimplementation of whichever module the attacker chose. - Going through
Ecto.Query.DynamicExprand thenDBConnection.Stream, a:logoption taken from the request is applied as a{module, function, args}call. The result is OS command execution as the BEAM user.
Hex says a check that would have blocked this was removed in February 2016. The advisory lists every hexpm commit from ab1bbce up to, but not including, the fix as affected. The fix, commit 379b0a2 ("Refuse structs in Erlang term request bodies"), makes decoding fail with HTTP 400 if any map in the term has a __struct__ key.
Fixes are also going into shared libraries so other applications cannot be chained the same way. db_connection will stop applying :log callbacks taken from stream structs (CVE-2026-133555, fixed in 2.10.3). Work is also under way in plug, plug_crypto and ecto.
What May Have Been Exposed
Hex says it found "no evidence of unauthorized package modifications, or database changes." It checked that all 23 releases published during the incident match audit-log entries. It also checked that all 62 package files and 186 registry files written since 18:00 UTC match their database checksums. Documentation archives have no stored checksums, so they could not be checked the same way.
Database reads are not logged, so Hex cannot rule out that the attacker read email addresses, password hashes, API key hashes, 2FA secrets, sessions and audit logs. It also cannot rule out reads of private packages and private docs, and says it will contact the affected organisations directly. The advisory also notes that the attacker's code could read the server's environment, which holds "the database URL, the storage credentials and the registry signing key."
What Hex Has Rotated
- Storage, CDN, email and database credentials, plus an AWS key used by the affected servers.
- The keys that sign sessions and access tokens. Everyone was logged out of hex.pm and the Hex clients.
- Not rotated: API keys, because they are 128-bit random values stored only as HMAC-SHA256 hashes. Hex sees no need to replace them over the exposed hashes. The registry signing key has not been rotated yet either. Hex says it is building a new registry signing system that supports key rotation, delivered with new client releases.
What To Do Now
If you have a hex.pm account:
- Change your password on hex.pm. Passwords are hashed with bcrypt, but Hex points out that bcrypt does not protect a weak password from guessing.
- Reset 2FA: on the dashboard's security page, under the authenticator app, choose to set up a new app. Verify a code and store the new recovery codes. The old TOTP secret may have been exposed.
- Log in again from the command line:
mix hex.user auth
# or, for rebar3 users
rebar3 hex user auth
- When the new Hex client ships, update it with
mix local.hex --forceand update rebar3 or Gleam. Until then, Hex advises fetching packages only from repo.hex.pm and not from mirrors. - Treat emails claiming to come from Hex with suspicion. Leaked addresses make targeted phishing easier, so forward anything doubtful to Hex's security address.
For teams and operators:
- If you self-host the hexpm application, deploy commit
379b0a2or an equivalent fix. - Update db_connection to 2.10.3 or later in your own Elixir applications. Look for any place where
binary_to_termdecodes data from users who are not authenticated. - Organisations with private packages should watch for direct contact from Hex. Review recent publishes in your audit logs.
Why It Matters
Package registries are prime supply-chain targets. Here the most damaging outcome, poisoned packages, appears to have been avoided. Hex saw the attack fast, patched within about a quarter of an hour, and published a detailed timeline within a day. The incident still shows two lessons. First, "safe" deserialisation is not safe on unauthenticated input once forged structs can reach protocol code like inspect/1. Second, a signing key that cannot be rotated becomes a problem the moment a server is compromised. Until Hex ships its new signing system, the usual advice applies: use the official repository and lock dependency versions with checksums.
