A Decade-Old Bug Owned the Elixir Registry in 13 Minutes
A Decade-Old Bug Owned the Elixir Registry in 13 Minutes On Monday evening, someone sent 69 requests to Hex.pm and walked away with operating system command execution on six production servers. The whole thing took 13
A Decade-Old Bug Owned the Elixir Registry in 13 Minutes
On Monday evening, someone sent 69 requests to Hex.pm and walked away with operating system command execution on six production servers. The whole thing took 13 minutes. The bug they used had been sitting in the code since February 2016.
I do not write Elixir. I have never shipped a line of it. But I build a messenger, and my messenger pulls dozens of packages from a registry every time I run an install. So when a package registry gets owned, I pay attention, because the registry is the one place in my whole build where I have decided to simply trust someone else.
Here is what happened, what the Hex team did right, and the part that should bother you more than the hack itself.
What Hex.pm is, and why it matters to you anyway
Hex.pm is the package registry for Elixir and Erlang. Every mix deps.get in the world talks to it. It is the npm of that ecosystem, just smaller and quieter, which is exactly why this story is interesting. Nobody writes breathless posts about Hex.pm on a normal week. It just works, in the background, for years.
On Monday, November 23, an attacker ran operating system commands on six of its production servers. The team had every server on a patched build within about 15 minutes of the first malicious request. That is a genuinely fast response, and I want to be fair about it, because the rest of this article is not going to be comfortable.
The bug was ten years old
The flaw is tracked as CVE-2026-129514, CVSS 10.0, the maximum score. It lived in the parser Hex.pm used to read request bodies sent in Erlang's own data format. That parser ran before routing and before authentication, which meant an unauthenticated POST request to any address on the site could reach it.
The decoding function was supposed to be safe. It blocked dangerous terms like functions. But it accepted maps carrying a __struct__ key, which let a request body pretend to be any Elixir struct the application had loaded.
The safety check that would have stopped this was removed from the code on February 23, 2016. That is where the ten years come from. Not a new bug. A guardrail deleted a decade ago, in a commit nobody flagged, in a parser that sat in front of everything.
The crafted struct ran nothing by itself. It caused an error, and the error reporting code then inspected the struct. That inspection, going through the Ecto and DBConnection database libraries, reached a point where the server called a function of the attacker's choosing. That function ran operating system commands with the permissions of the registry's service account.
Read that chain again, because it is the whole lesson in one paragraph. The parser was not the only problem. The error handler trusted what the parser gave it. The database libraries did what they were asked. Nobody in the chain did anything obviously wrong on its own. The vulnerability was the shape of the chain.
Thirteen minutes
Load balancer logs recorded 69 exploit requests between 18:16 and 18:29 UTC, all from two addresses. Files created by the exploit appeared on six web servers, in one case three milliseconds after the request. Three of those servers joined mid-attack, when a restart brought up machines still running the vulnerable build. Every server was patched by 18:31 UTC.
A separate security report describing the same flaw arrived by email at 19:07 UTC, after the attack had already ended. The attacker had evidently built a local copy of Hex.pm to test against. Activity from the two addresses going back to late last week suggests preparation, not luck.
The part they could prove, and the part they could not
This is where the Hex team earned my respect, and also where the story gets uncomfortable.
They checked the packages thoroughly. They compared every database table against a copy taken two minutes before the first exploit request and traced each difference to normal activity. The 23 releases published during the attack all match the audit log. No older release was changed. The package and registry files written that evening match the database records. They found no leftover shells, no new accounts, no new cloud keys.
So: no package tampering. That is a real finding, backed by a real check, and it matters, because a tampered package would have flowed straight into thousands of builds.
But here is the sentence from their incident report that you should sit with:
"We cannot rule out that the attacker accessed data stored in the database."
Database reads, shell commands, environment variables, and direct reads from file storage were not logged. The database holds email addresses, password hashes, API key hashes, two-factor authentication secrets, and session data. Private packages could also have been read without leaving a trace.
That is honest. It is also the worst sentence in the report, because it means the thing they could verify (the packages are clean) and the thing they could not (nobody read your credentials) are two different questions, and only one of them has an answer.
Everyone with a Hex.pm account has been logged out. The team replaced the keys that sign sessions and access tokens, and they are telling users to change passwords, reset two-factor authentication, log back in to their clients, and watch for phishing on exposed email addresses. API keys, they say, do not need replacing, because they are random 128-bit values stored only as HMAC-SHA256 hashes. Passwords are hashed with bcrypt, which slows guessing but does not stop it for weak passwords.
One credential has not been replaced yet: the registry signing key. It was among the credentials the attacker could have read. Until the new client ships, the advice is to fetch packages only from repo.hex.pm and to avoid third-party mirrors.
The team reported the breach to the Swedish data protection authority, to CISA in the United States, and to ENISA in the European Union, on Monday night.
Three libraries, same week, same pattern
Alongside the incident, maintainers of three widely used Elixir libraries disclosed flaws of their own involving structs built from untrusted data, and shipped fixed versions the same day. Ash (CVE-2026-124283), db_connection (CVE-2026-133555), and Flop (CVE-2026-130411). Each needs its own conditions to be exploited. The db_connection flaw, its own advisory says, is "not exploitable in db_connection alone," because another component must first decode untrusted data into structs.
That is not a coincidence. It is the same underlying assumption showing up in four places at once: that data arriving from outside can be turned into rich internal objects without someone checking every field. When one team finds it in the registry, everyone else starts looking at their own decoders, and they find it too.
What this means if you build things
I keep coming back to one uncomfortable fact. My messenger's build pulls packages from npm. Yours probably pulls from npm, or PyPI, or crates.io, or RubyGems, or Hex. Every one of those registries is a single point of trust for an entire ecosystem. We audit our own code. We pin versions. We read lockfiles. And then we hand the whole thing to a server run by a small team and assume the server is fine, because it has always been fine.
Hex.pm was fine for ten years, with a remote code execution bug in its front door the entire time.
A few things I actually do, and a few I am now going to start doing, after reading this incident report twice:
Pin everything, and mean it. A lockfile is not a suggestion. If a dependency can float, it will float at the worst moment.
Treat the registry as untrusted input, not as a trusted source. That sounds paranoid until you remember that the packages were the one thing the Hex team could verify, and they verified them by comparing against a backup, not by trusting the server. Your build should be able to notice if a package changes under a version you already installed. Hashes in the lockfile are the cheap version of this. Use them.
Log the reads, not just the writes. The Hex team's blind spot was not the patch speed. It was that database reads and shell commands were not logged, so they could not answer the only question their users were actually asking: did someone read my stuff? If you run a service, ask yourself which of your own reads would be invisible to you after a breach. Then fix the logging before you need it.
Respond like the Hex team did. Fifteen minutes to patch every server. A public incident report the next day. Plain language about what they could and could not rule out. No minimization, no "sophisticated threat actor" theater, no waiting a month to tell anyone. That is the standard now, and users notice when a team meets it.
The question that stays open
The packages are clean. The servers are patched. The credentials are mostly rotated. But the registry signing key, the one key that lets clients trust that a package really came from Hex.pm, is still the old one, and the attacker may have read it.
That is the part of the story that has no clean ending yet. A signing key you cannot prove is safe is a key you have to replace, and until it is replaced, the trust your builds place in that registry rests on the hope that the attacker did not bother to read it. Hope is not a control.
I am not writing this to tell you to stop using package registries. There is no realistic alternative, and the Hex team handled a bad day about as well as a team can. I am writing it because the next registry breach will not be Elixir's. It will be yours. And the difference between a bad week and a catastrophe will be decided by things you do now: the lockfile, the logging, the rotation plan, and whether you have ever once asked what your build would do if the registry lied to it.
Ten years. Sixty-nine requests. Thirteen minutes. That is how long trust takes to break, once someone finally looks at the parser.
Sources: The Hacker News, "Hackers Exploited CVSS 10.0 Hex.pm RCE Flaw to Compromise 6 Package Registry Servers" (Nov 25, 2026); Hex.pm incident report and security advisory (CVE-2026-129514).
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.