Skip to content
Security & Trust

A 2016 flaw in Hex.pm's decoder let an attacker run commands on servers

The attack ran through error reporting. Hex.pm says it cannot rule out that account data was read.

W
WebPulse Newsroom
AI-assisted · 4 min read
Share on X LinkedIn
A 2016 flaw in Hex.pm's decoder let an attacker run commands on servers

Graphic: WebPulse, drawn from the sourced facts in this story.

In brief
  • Hex.pm says an attacker ran commands on six of its web servers on November 23 through CVE-2026-129514. The team found no sign of changed packages.
  • The team cannot rule out that email addresses, hashed passwords and 2FA secrets were read, because database reads are not logged.
  • Elixir and Erlang teams should update the Hex client when it ships, fetch only from repo.hex.pm, and reset 2FA and passwords.

A function named non_executable_binary_to_term makes a promise in its name. At Hex.pm, the promise and the behavior parted ways, and an attacker walked through the gap. The lesson, in this publication's view, is that a safety label records what its author meant. It does not guarantee what the code does with every input.

Hex.pm is the registry where Elixir and Erlang developers fetch their dependencies. Its team says an unauthorized third party exploited a vulnerability on November 23 and ran commands on its web servers. The team says it blocked the traffic and shipped a fix within 20 minutes, by the team's account. The flaw is tracked as CVE-2026-129514. The Hacker News reports it carries the maximum CVSS score of 10.0.

What happened, in order

Load balancer logs record 69 exploit requests from two addresses. They span about 13 minutes, starting at 18:16 UTC. A firewall rule went in at 18:27, and every server ran a patched build by 18:31.

Three of the six affected servers joined mid-attack. A restart at 18:28 launched them from the old build, so they were exposed too, according to the team.

The team also found that the same addresses had been downloading hex.pm's own dependencies since November 19. It says this suggests the attacker built a local copy to test against.

How the attack worked

The entry point was a custom parser for request bodies sent in Erlang's data format. It called the function above with a "safe" option. The parser ran before routing and before login, so any unauthenticated request to any route could reach it.

The decoder rejected functions and new names. It never checked maps. An Elixir struct is a map with a special __struct__ key naming a module. So the attacker could send a fake record, with every field chosen, that the runtime treated as real.

The fake record was harmless until something failed. It became the request's body parameters, and a lookup on it raised an error. Three logging components then printed the record to help diagnose the failure: Sentry, Bandit's error logger and the JSON log formatter. Printing a record runs the code of whatever module it names, so the attacker picked what ran next.

The attacker picked a type from Ecto, a database library. Ecto's printing code looped over one field without checking it was a list. Looping is also dispatched by type, so the attacker placed a DBConnection stream in that field. Its handler applied a logging option holding a module, function and arguments taken straight from the request. That ran operating system commands as the service's user.

A flaw from 2016

The decoder's change history dates the weakness to February 23, 2016. The team says a protective check was taken out of it that day. It does not describe what that check did. The Hacker News reports it was the check that would have stopped this attack.

So the flaw dates to 2016. The Hacker News says earlier exploitation has not been established. On the sources' account, November 23 is the first known attack.

The planned fixes show the gap between label and behavior. In plug_crypto, the change is a documentation warning that the decoder suits only authenticated senders, plus a setting to refuse structs. Hex.pm's own patch is blunter. The decoder now returns a 400 error for any input holding a map with a __struct__ key.

What the team could and could not prove

The team found no sign that packages were altered. Each of the 23 releases published during the incident has a matching publish or stage entry in the audit log. No older release changed. The team compared files written to storage since 18:00 with database records, 62 package files and 186 registry files, and found no mismatch.

The team names its blind spots. Documentation archives have no stored checksum. A row edited and then restored to its old value would look unchanged in the database comparison.

Data theft is the open question. Database reads, shell commands and environment variable reads are not logged. The team therefore cannot exclude that the attacker saw email addresses, hashed passwords, hashed API keys, 2FA secrets, sessions or audit logs. It replaced the credentials its servers use, which logged everyone out.

The registry signing key is still unchanged, along with a few low-impact secrets. The Hacker News reports the signing key was among the credentials the attacker could have read. New Hex client releases with a new signing system are due in the coming days. Until then, the team says to fetch only from repo.hex.pm and to distrust third-party mirrors.

One flaw, several libraries

While investigating, the team found the same class of flaw in Ash, an Elixir framework. Its keyset pagination hands clients a cursor and accepts it back, and that cursor could carry crafted structs. Ash 3.38.0 fixed it on November 24 as CVE-2026-124283.

Hardening work covers plug_crypto, plug, ecto and db_connection. The db_connection change is tracked as CVE-2026-133555. This is one incident. It shows how a chain forms and does not show a trend.

Questions to put to your team

If you build with Elixir, Erlang or Gleam, ask who will update the Hex client when it ships. Ask who has reset 2FA and passwords on any hex.pm account. Peter Ullrich, an author of the report, said in a clarification on the Elixir Forum, as The Hacker News reports, that developers with no hex.pm account who only download public packages need not reset anything.

Ask where your own systems decode outside data before login. Ask whether error reporting ever sees raw request content. Ask which dependencies come through mirrors.

Ask whether database reads are logged. Hex.pm found no sign that its packages were touched. It could not say what was read, because reads left no trace.

Check what a safety label covers before you rely on it. The gap between its name and its behavior is where the attacker worked.

Produced by the WebPulse Newsroom with AI assistance from the original reporting credited below, and checked against that source by our editorial review. How we use AI.
Original reporting: Hex.pm team (hex.pm, the Elixir/Erlang package registry operator).