Hex.pm's Perfect 10.0. Six Servers Compromised in Minutes.

Hex.pm’s Perfect 10.0. Six Servers Compromised in Minutes.

On Monday, Hex.pm — the package registry that Elixir and Erlang developers fetch their dependencies from — was breached. An attacker ran operating system commands on six of its production servers, through a flaw rated CVSS 10.0, the maximum score. The team had every server on a patched build by 18:31 UTC, about fifteen minutes after the first malicious request. The response was fast — but the part every Hex user needs to hear is what came after.

What happened

The flaw, tracked as CVE-2026-129514, sat in the parser Hex.pm used to read request bodies sent in Erlang data format. That parser ran before routing and authentication, so any unauthenticated POST could reach it. The decoder blocked dangerous terms such as functions, but it accepted maps with a __struct__ key, which let a request body pose as any Elixir struct the application had loaded. The safety check that would have stopped this was removed on February 23, 2016. The flaw is nearly ten years old.

A crafted struct ran nothing by itself. It caused an error, and the error-reporting code then inspected it — through Ecto and DBConnection, until the server called an attacker-chosen function that ran operating system commands as the service account. The fix makes the decoder reject any term containing a map with a __struct__ key.

Load balancer logs show 69 exploit requests between 18:16 and 18:29 UTC on Monday, all from two addresses. Exploit-created files appeared on six web servers, in one case 3 milliseconds after the request. Three joined mid-attack, when a restart brought up machines still on the vulnerable build.

Five steps converged on six Hex.pm servers: an unauthenticated POST reached the parser, a __struct__ map was accepted, the safety check had been gone since 2016, the error handler inspected the struct, and Ecto and DBConnection ran OS commands as the service account. 69 requests, 18:16-18:29 UTC, from 2 addresses, patched by 18:31 UTC.

Why it matters

A package registry is trust infrastructure. Every Elixir and Erlang project that pulls a dependency reaches for Hex.pm — a compromised registry means poisoned packages flowing silently into thousands of builds. On that front, the news is good. Every database table was compared against a copy taken two minutes before the first exploit request; every difference was normal activity. The 23 releases published during the attack all match the audit log, and no older release was changed. No package was tampered with.

But one question stayed open. Database reads, shell commands, environment variables, and direct reads from file storage were not logged — so the team cannot rule out that the attacker read account data. That database holds email addresses, password hashes, API key hashes, 2FA secrets, and session data — and private packages could have been read without a trace. No leftover shells, new accounts, or cloud keys turned up in the audit logs. The attacker is unknown, but activity from the two addresses back to late last week suggests a local copy of hex.pm built for testing. That night the breach was reported to Sweden’s data protection authority, to CISA, and to ENISA.

The shape should look familiar: an unauthenticated request, a permissive parser, an error handler that trusted what it inspected — ending in full remote code execution. It is the same shape as the four flaws chained into remote code execution on QNAP devices earlier this month. And the clock matters as much as the chain: 69 requests in thirteen minutes, a file on disk three milliseconds after the request. We have seen the same speed elsewhere: cloud keys planted in public Docker images were used within eight seconds. When the gap is measured in minutes, only the defense already in place counts.

Separately, three widely used Elixir libraries disclosed flaws of their own involving structs built from untrusted data, and shipped fixes: Ash (CVE-2026-124283, fixed in 3.38.0), db_connection (CVE-2026-133555, fixed in 2.10.3), and Flop (CVE-2026-130411, fixed in 0.26.7, 0.27.3, 0.28.1, and 0.29.2). These are separate disclosures, not further attacks on Hex.pm — each needs its own conditions, and db_connection is “not exploitable in db_connection alone.” The flaw sits in the hexpm server code, not the Hex client, so organizations running their own copy of the registry are affected until they patch.

What to do now

Everyone with an account has been logged out — the maintainers replaced the keys that sign sessions and tokens. If you have an account, do this now:

What happened and what to do: CVE-2026-129514 scored CVSS 10.0, the flaw dates to Feb 2016, 69 requests hit between 18:16 and 18:29 UTC, and no packages changed — but data exposure cannot be ruled out. Change your password, reset 2FA, and fetch only from repo.hex.pm.

1. Change your hex.pm password. Passwords are bcrypt-hashed, which slows guessing but not enough for weak passwords — changing still matters.

2. Reset two-factor authentication. Set up a new authenticator entry and store the new recovery codes.

3. Log back in to the client with mix hex.user auth — or rebar3 hex user auth for Erlang projects.

4. Update the Hex client when the next release ships, expected within days. Until then, fetch packages only from repo.hex.pm and avoid third-party mirrors.

5. Watch for phishing. Exposed email addresses may be misused — check that links in any email about Hex go to hex.pm.

Two things do not need doing. API keys need no replacement: random 128-bit values stored only as HMAC-SHA256 hashes, which cannot realistically be brute-forced. If you never created an account and only fetch public packages, you have nothing to reset — GitHub sign-ups should still log back in, and reset 2FA if enabled. One credential is still unreplaced: the registry signing key, which the attacker could have read.

A ten-year-old flaw, a thirteen-minute attack, a patch in fifteen minutes. Hex.pm’s team did the hard part fast — the part only users can do is the reset. Change the password, reset 2FA, today, while the window is still yours.

One thought on “Hex.pm’s Perfect 10.0. Six Servers Compromised in Minutes.”

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.