Hex.pm Breach: Attacker Ran Commands on Erlang and Elixir Package Registry Servers — Reset Your 2FA

Hex.pm says an attacker exploited CVE-2026-129514 to run commands on its servers. Users must change passwords and reset 2FA; no package tampering found.

By Vivek • • 6 Min Read • 0 • Follow on Google News Add to Preferred Source
hex.pm hacked

An attacker exploited a flaw in hex.pm, the package registry for the Erlang, Elixir, and Gleam ecosystems, to run operating system commands on six of its web servers on Monday, November 23, 2026, the Hex team disclosed on Tuesday.

Hex says it blocked the traffic, deployed a fix within 20 minutes, and found no evidence that any package was modified. However, it is asking every user to change their password and reset two-factor authentication (2FA) because it cannot rule out that its database was read.

The flaw, tracked as CVE-2026-129514 (GHSA-9pmm-hf4r-27pg), carries the maximum CVSS 4.0 score of 10.0 from the Erlang Ecosystem Foundation (EEF), which issues CVEs for the ecosystem and lists the bug as actively exploited. The vulnerable code dates to February 23, 2016, when a safety check was removed, so the hole sat in the registry for more than ten years. Hex.pm hosts more than 27,000 packages and has served over 16 billion downloads, according to its homepage.

Per Hex’s account, written by Peter Ullrich, Jonatan Männchen and Eric Meadows-Jönsson, the attacker’s first request arrived at 18:14 UTC and the first exploit request at 18:16. Over the next 13 minutes the attacker sent 69 exploit requests, and commands ran on six web servers. Hex added a firewall rule at 18:27 and replaced every server with a patched build between 18:30 and 18:31, after three servers that had restarted at 18:28 were still running the vulnerable build.

The attack was not improvised. Hex says activity from the attacker since November 19 “suggests the attacker built a local copy of hex.pm to test against,” which is possible because the hexpm server code is open source. At 19:07 UTC, about 35 minutes after the fix went live, Hex received an emailed security report describing the same vulnerability. The post does not name the reporter or say whether the report is connected to the attack.

How the Hex.pm Attack Worked

The entry point was a custom parser for the application/vnd.hex+erlang content type, which lets Hex clients send data in Erlang’s binary term format. The parser decoded request bodies with Plug.Crypto.non_executable_binary_to_term/2, a function designed to block dangerous values such as anonymous functions. That function still lets through Elixir structs, which are maps carrying a __struct__ key that the runtime treats as typed objects, so an attacker could hand the server fake structs of their choosing. Because the parser ran before routing and authentication, any POST request reached it.

The EEF advisory describes the chain that followed. A forged struct made Plug.MethodOverride crash, and when Sentry, the Bandit web server’s error log, and the JSON log formatter tried to print the crash details, the printing code encountered a fake Ecto query object and then a fake DBConnection stream. That stream’s logging option accepted a module, function, and argument list taken straight from the request body, which the attacker used to run OS commands as the user running the BEAM, the Erlang virtual machine. Each request still ended in an ordinary 500 error.

The fix, commit 379b0a2, makes the decoder reject any map with a __struct__ key and return a 400 error. While investigating, Hex found a similar class of bug in the Ash framework, now tracked as CVE-2026-124283 and fixed in ash 3.38.0 on November 24.

What Data Hex.pm Could Not Rule Out

Commands running as the BEAM user could read the application environment, which held the database URL, storage credentials, and the registry signing key, according to the EEF advisory. Hex does not log database reads, so it cannot rule out that the attacker accessed email addresses, password hashes, API key hashes, 2FA secrets, sessions and audit logs. Passwords are hashed with bcrypt, which, as Hex notes, does not protect a weak password from being cracked. API keys are 128-bit random values stored as HMAC-SHA256 hashes, so Hex is not asking users to rotate them.

To check for tampering, Hex restored a database snapshot from 18:13:59 UTC and compared it row by row with the live database. All 23 releases published during the incident match the audit log entries, all 62 package files written since 18:00 match the database checksums, and all 186 registry files match the database contents. Hex found no shells on the servers, no deletions in cloud storage, and no new keys or accounts. It acknowledges the limits: a row changed and then restored would not show up, and documentation archives have no stored checksum to check against. One worker server’s traffic peaked at 0.47 MB/s, against a usual maximum of 0.29 MB/s.

Private package reads during the window came from Hex’s own servers and match releases those organizations published, but Hex cannot fully exclude reads from a compromised server, and private documentation reads are not logged. Hex says it will contact affected organizations directly.

By 10:42 UTC on November 24, Hex had rotated storage, CDN, email, and database credentials, as well as the keys that sign sessions and access tokens. The registry signing key, which Hex clients use to confirm that package index data is genuine, has not been rotated, and Hex is building a new signing system that supports key rotation. Hex reported the incident to IMY, Sweden’s data protection authority, to the US Cybersecurity and Infrastructure Security Agency (CISA), and to the EU agency ENISA on the evening of November 23.

What Hex.pm Users Should Do Now

The credential rotation has already logged everyone out of hex.pm and Hex clients. Hex asks users to change their password at hex.pm, then reset 2FA at hex.pm/dashboard/security by choosing “Setup New App” under “Authenticator App” and saving the new recovery codes. Because email addresses may have been exposed, Hex warns users to expect phishing and to check that links point to hex.pm.

Until new Hex client releases with the new signing system ship in the coming days, Hex says to fetch packages only from repo.hex.pm and not to trust third-party mirrors. Once they are out, Elixir users should run mix local.hex --force, and rebar3 and Gleam users should update those tools. Anyone running their own copy of the open-source hexpm server should update to a build that includes commit 379b0a2.

The breach comes seven months after Hex completed its first third-party security audit in April 2026, funded by the OpenSSF’s Alpha-Omega project and carried out by Paraxial.io and Zentrust partners, which led to a fix for an unsafe-deserialization bug in the hex_core client library (CVE-2026-21619). Hex has not said who was behind this week’s attack or whether any data left its servers, and its post names no law enforcement agency.

Community Discussion

Join the conversation. Ask questions, share solutions, and help others.

0 Comments

Be the first to start the discussion!

Leave a Comment

Your email address will not be published. Required fields are marked *

We respect your privacy, your information is safe with us.

Latest Articles

View all