Hex.pm Breach: 69 Requests Through a Bug From 2016

By 11 min read
Hex.pm breach summary card showing the CVSS 10 hex.pm flaw CVE-2026-129514

For almost eleven years, any anonymous visitor could have run commands on the servers behind Elixir’s package registry. On 23 November 2026, someone did: 69 requests in about 13 minutes reached six hex.pm web servers before the team shut the door.

In short: the hex.pm breach was an exploited deserialization flaw, CVE-2026-129514, that let an unauthenticated attacker run operating system commands on the registry’s web servers. Hex says no packages were altered, but account data may have been read, so every user should change their password, reset 2FA and use only repo.hex.pm until new clients ship.

What is hex.pm and why does this breach matter?

Hex is the package manager for the Erlang ecosystem, and hex.pm is its central registry. Elixir’s mix, Erlang’s rebar3 and Gleam all fetch dependencies from it, so it sits at the root of a large share of BEAM software in production.

A package registry is a high-value target because whoever controls it can, in principle, push code into every build that depends on it. That is why the two questions after any registry intrusion are always the same: were packages changed, and could the attacker sign or publish on behalf of others?

Hex published its incident report on 24 November 2026, written by Peter Ullrich, Jonatan Männchen and Eric Meadows-Jönsson. SecurityWeek covered it on 27 November. Both are linked in the sources.

Four figures from the hex.pm breach: 69 requests, 6 servers, 20 minutes, bug since 2016
The attack was short and contained, but the bug it used had been live since 2016. Data: Hex incident report.

What happened on 23 November 2026?

Hex’s timeline is unusually precise. All times below are UTC and come from its report.

The attack window

The attacker’s first request of any kind arrived at 18:14:21. Exploit requests ran from 18:16:00 to 18:29:33, from two IP addresses that Hex did not publish. The first file created by an attacker command appeared 3 milliseconds after a request at 18:16:46.

At 18:28 a restart brought up three fresh servers that were still running the vulnerable build, which is why six servers were hit in total rather than three.

Containment

Hex added a firewall rule at 18:27. It took full effect between 18:30 and 18:33, and every request from 18:33:48 onward was denied. Between 18:30 and 18:31 all hex.pm servers were replaced with a patched build. No exploit request succeeded after 18:29:33.

At 19:07 a security report arrived by email describing the same vulnerability. Hex’s report does not say who sent it.

Timeline of the 23 November hex.pm attack from first request to the email report
Hex had blocked the attacker and patched every server before the vulnerability report reached its inbox. Data: Hex incident report.

Credential rotation and notifications

Time (UTC) Action
18:47 Replacement AWS key created
18:49 Affected AWS key deactivated
20:21 Most infrastructure credentials rotated
22:58 Personal data breach reported to IMY, the Swedish data protection authority
23:05 Incident reported to CISA, which confirmed receipt at 23:43
23:26 Early warning sent to ENISA
24 Nov, by 10:42 Every readable credential rotated except the registry signing key and a few low-impact secrets
24 Nov, 13:48 CVE-2026-129514 published

The database password was rotated on 24 November. Rotating the keys that sign sessions and access tokens logged every user out of hex.pm and the Hex clients.

How did the hex.pm exploit work?

At a conceptual level, the flaw is a classic unsafe deserialization bug. Deserialization is the step where a program turns bytes received from outside back into live data structures; it becomes dangerous when the incoming data can choose what kind of object gets built.

The Erlang term format path

Hex clients can talk to hex.pm using the Erlang external term format, a binary encoding of Erlang values, sent with the content type application/vnd.hex+erlang. According to the CNA record, hex.pm decoded such bodies with Plug.Crypto’s non_executable_binary_to_term/2 function.

That function blocks executable values such as functions, but it still allows maps carrying a __struct__ key, which Elixir treats as structs. A struct is a map tagged with the name of a module, and code that later handles it can dispatch to that module’s behaviour. That gap is what turned a data parser into a code execution path.

Before authentication, before routing

The parser ran before request routing and before any authentication. Hex describes the exploit as an unauthenticated POST that reached the decoder first. The CNA record says the result was OS command execution as the BEAM user, the operating system account the Erlang virtual machine runs as.

The safety check that would have stopped this was removed on 23 February 2016. The CVE record lists hex.pm as affected from that date until the fix on 23 November 2026.

Five-step chain from an unauthenticated POST to readable secrets on the CVE-2026-129514 servers
The decoder ran before any authentication, so the attacker needed no account at all. Data: Hex and EEF CNA.

The fix

The fix is hexpm commit 379b0a2. The decoder now rejects any term that contains a map with a __struct__ key, and the parser answers such requests with HTTP 400.

Was anything stolen or tampered with?

Hex says it found no evidence of unauthorised package modifications, database changes or lasting access. Its integrity checks were detailed:

  • All 23 releases published during the incident matched audit log entries.
  • All 62 package files and 186 registry files written since 18:00 matched the database.
  • Storage access logs covered 11,379 objects and 15,635 records between 14:56 and 20:59.
  • All 6,279 requests to the production storage came from the three node IP addresses.
  • A database copy restored to 18:13:59 was compared row by row with production and showed nothing unexplained.

What could not be ruled out

Database reads, environment reads and shell commands are not logged, so Hex cannot exclude that the attacker read them. The data at risk is email addresses, password hashes, API key hashes, two-factor secrets, sessions and audit logs.

One worker’s outbound traffic peaked at 0.47 MB/s against a usual maximum of 0.29 MB/s. Hex reports the number without drawing a conclusion from it, and neither should readers: it is not proof of exfiltration.

Signs of preparation

Request logs showed repeated downloads of hex.pm’s own dependencies starting 19 November. Hex reads this as the attacker building a local copy of the service to test against. That is Hex’s interpretation, not a confirmed fact.

Who is affected and how do you check exposure?

hex.pm account holders

Anyone with a hex.pm account should assume their password hash and 2FA secret may have been read. Passwords are hashed with bcrypt, which slows cracking but does not make weak passwords safe.

API keys are a different case. Hex says they are 128-bit random values stored as HMAC-SHA256, so a stolen hash is not useful for recovering the key, and it does not plan to rotate them.

Teams that use Hex mirrors

The CVE record says the BEAM user could read the application environment, including the registry signing key. That key was not rotated by 24 November because Hex is building a new signing system with key rotation. Until new clients ship, Hex asks users to fetch only from repo.hex.pm and not from third-party mirrors.

Applications using Ash, flop or db_connection

The investigation found the same class of bug in three popular libraries. These were not part of the breach, but your own applications may be exposed.

CVE Package CVSS 4.0 Fixed in Exposed when
CVE-2026-129514 hex.pm service 10.0 commit 379b0a2 Service only, now fixed
CVE-2026-130411 flop 9.2 0.26.7, 0.27.3, 0.28.1, 0.29.2 Cursor pagination enabled (the default)
CVE-2026-124283 ash 8.9 3.38.0 Keyset pagination with client cursors and no signing secret
CVE-2026-133555 db_connection 8.9 2.10.3 Another component builds structs from untrusted input

The db_connection record says the flaw is not exploitable in db_connection alone. It becomes reachable when another component decodes untrusted input into structs, which is exactly what the Ash and flop bugs did.

Bar chart comparing CVSS 4.0 scores for the hex.pm, flop, Ash and db_connection CVEs
All four linked flaws rate high or critical, and the registry bug is the only one confirmed as exploited. Data: EEF CNA.

To check exposure, run mix deps or read mix.lock and compare the versions of ash, flop and db_connection with the table. If you run your own copy of the hexpm application, confirm it includes commit 379b0a2.

How do you detect this kind of attack?

Hex did not publish attacker IP addresses or payload signatures, and it did not publish MITRE ATT&CK mappings. The guidance below combines what Hex describes with our own mapping.

Log sources and behaviours

  • Web access logs: unauthenticated POST requests with the content type application/vnd.hex+erlang from sources that are not known Hex clients. After the fix, such requests receive HTTP 400.
  • Error tracking: Hex’s Sentry recorded one error per malicious request. A Plug.MethodOverride UndefinedFunctionError on a POST was the visible symptom.
  • Process telemetry: the BEAM process spawning shells or writing new files is unusual for most Elixir web services and should alert.
  • Egress monitoring: outbound volume from application workers above their normal ceiling, as Hex observed on one worker.
  • Pagination parameters: for Ash and flop applications, unusually long or malformed after and before cursor values in request logs.

ATT&CK mapping (our assessment)

Technique ID Where it fits
Exploit Public-Facing Application T1190 Unauthenticated POST to the registry decoder
Command and Scripting Interpreter T1059 OS commands run as the BEAM user
Unsecured Credentials T1552 Secrets readable from the application environment

What should defenders do now?

  1. Change your hex.pm password and use a unique one.
  2. Reset 2FA at hex.pm/dashboard/security: under Authenticator App choose Setup New App, verify a code and store the new recovery codes.
  3. Use only repo.hex.pm for packages until Hex releases clients with its new signing system, then run mix local.hex --force and update rebar3 or Gleam.
  4. Upgrade the linked libraries: ash 3.38.0 or later, db_connection 2.10.3 or later, and the fixed flop release for your series. If you cannot upgrade yet, set keyset_signing_secret in Ash 3.37.0 or later, or limit flop’s pagination_types to page and offset.
  5. Treat Hex-branded email with suspicion. Check that links go to hex.pm and forward anything doubtful to security@hex.pm.
  6. Audit your own deserialization. Search your code for binary_to_term on any data that came from a request, cookie or cursor, and remember that safe mode still allows structs.

How does it compare with the RubyGems.org flaw?

Two days after Hex’s report, RubyGems.org published advisory GHSA-7h7w-m82c-x2xg for a different bug of the same family, CWE-502 deserialization of untrusted data. Comparing them shows how much the authentication step matters.

  hex.pm (CVE-2026-129514) RubyGems.org (GHSA-7h7w-m82c-x2xg)
Data format Erlang term format body YAML gem metadata
Login needed None A push-capable API key
CVSS 4.0 10.0 9.0
CVE assigned Yes No
Exploited Yes, 23 November 2026 No direct evidence, per the advisory
Fix public Same evening 4 November, disclosed 26 November
Logging gap Reads and shell commands not logged Upload payloads not recorded

Both registries say they cannot fully rule out abuse because the relevant actions were never logged. That is the common lesson: integrity can often be proven after the fact, confidentiality usually cannot.

The same week also brought a critical TLS client flaw in the Erlang runtime itself, covered in our article on the Erlang/OTP CVE-2026-124286 TLS fix that OTP 28 missed. For registry attacks that did push malicious code, see the Microsoft Agent Framework PyPI attack and the WPPConnect supply chain attack. For another Ruby heap bug from the same period, read Ruby2Shell explained.

What did Hex do well, and what is the catch?

Hex’s response was fast and transparent. It blocked the attacker within about 20 minutes, patched before the vulnerability report even arrived, notified IMY, CISA and ENISA the same night, and published a minute-by-minute report the next day.

The catch is the part no fast response can fix. A check removed in 2016 left the registry open for almost eleven years, and no one can say whether this was the first time someone found it. The signing key was still waiting for rotation when Hex published its report, and reads of user data are invisible in the logs.

Open questions

  • Who was the attacker? Hex has not attributed the attack, and nothing in the sources links it to a known group.
  • Who sent the 19:07 report? Hex says the email described the same vulnerability but does not say whether it came from an independent researcher or from someone connected to the attack.
  • Was data actually read? The elevated traffic on one worker is unexplained in the report, and unlogged reads cannot be excluded.
  • When will the new signing system ship? On 24 November Hex said new clients would come in the coming days. The Hex blog index showed no follow-up post when this article was written.
  • How exposed are Ash users? The Ash CVE vector lists a local attack vector while its description speaks of an unauthenticated attacker. The record does not explain the difference.

The bottom line

The hex.pm breach was short, well handled and, as far as Hex can tell, did not touch a single package. It was still a full remote code execution on a central registry, made possible by a safety check deleted in 2016. Change your hex.pm password, reset 2FA, stay off mirrors until the new clients ship, and check your own code for deserializing structs from user input.

Sources

This article is written for defenders and authorised security testers. Only test systems you own or have written permission to assess.

Frequently asked questions

What happened in the hex.pm breach?

On 23 November 2026 an unauthorised party exploited CVE-2026-129514 in hex.pm and ran operating system commands on six web servers between 18:16 and 18:29 UTC. Hex blocked the traffic, replaced the servers with a patched build and rotated its infrastructure credentials the same evening.

What is CVE-2026-129514?

CVE-2026-129514 is an unauthenticated remote code execution flaw in hex.pm. Its request decoder accepted Erlang term format bodies containing struct values, which let an attacker run OS commands as the server's BEAM user. It is rated CVSS 4.0 10.0 and was fixed in hexpm commit 379b0a2.

Were any Hex packages tampered with in the breach?

Hex says no. All 23 releases published during the incident matched audit log entries, and every package and registry file written since 18:00 UTC matched the database.

What hex.pm data may have been exposed?

Hex cannot rule out reads of email addresses, bcrypt password hashes, API key hashes, two-factor secrets, sessions and audit logs. Database reads and shell commands were not logged, so exposure can be neither confirmed nor excluded.

Do I need to rotate my Hex API keys?

Hex says no. API keys are 128-bit random values stored as HMAC-SHA256 hashes, so it does not plan to rotate them, but it does ask every user to change their password and reset two-factor authentication.

Why should I avoid Hex mirrors after the breach?

The attacker could have read the environment that holds the registry signing key, and that key had not yet been rotated on 24 November. Until new Hex clients with a new signing system ship, Hex advises fetching packages only from repo.hex.pm.

Are Ash, flop and db_connection affected by the hex.pm breach?

They were not breached, but the investigation found the same class of bug in them. Fixes are ash 3.38.0 (CVE-2026-124283), db_connection 2.10.3 (CVE-2026-133555) and flop 0.26.7, 0.27.3, 0.28.1 or 0.29.2 (CVE-2026-130411).

Who was behind the hex.pm attack?

Hex has not named or attributed the attacker. Its report mentions two attacker IP addresses without publishing them and notes repeated downloads of hex.pm's own dependencies from 19 November, which it reads as preparation.

Keep reading

hex.pm breachCVE-2026-129514ElixirErlangpackage registry securitydeserializationincident response