Hex.pm RCE (CVE-2026-129514)

An attacker exploited CVE-2026-129514, a maximum-severity flaw in the hex.pm registry server code, on November 23, 2026 to run operating system commands on six production servers. The service is patched, and account holders should change their password, reset two-factor authentication and log back in.

Vulnerability

An attacker exploited a maximum-severity vulnerability in the hex.pm registry server code, CVE-2026-129514, to run operating system commands on six Hex.pm production servers. Hex.pm is the package registry Elixir and Erlang developers fetch their dependencies from. The flaw had been in the registry’s code since February 2016.

It sat in the parser hex.pm used to read request bodies sent in an Erlang data format. That parser ran before routing and authentication. As a result, an unauthenticated POST request to any address on the site could reach it.

The decoding function was meant to be safe and 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 check that would have prevented this was removed from the code on February 23, 2016.

A crafted struct didn’t run anything by itself. It caused an error, and the error reporting code then inspected the struct. That inspection, via the Ecto and DBConnection database libraries, led to the server calling a function of the attacker’s choice. That function ran operating system commands.

Separately, maintainers of three widely used Elixir libraries disclosed their own flaws involving structs built from untrusted data and shipped fixes on November 24, 2026. These are separate disclosures and not further attacks on Hex.pm:

  • ash (CVE-2026-124283): requires keyset pagination with a client-supplied cursor, certain sort field types, and a signing secret left at its unset default
  • db_connection (CVE-2026-133555): not exploitable in db_connection alone, since another component must first decode untrusted data into structs
  • flop (CVE-2026-130411): similar conditions around its pagination cursors

CVE and severity

The vulnerability is tracked as CVE-2026-129514.

It’s a maximum-severity vulnerability.

Impact

The attacker’s operating system commands ran with the permissions of the registry’s service account.

Package integrity appears intact. The Hex.pm team compared each 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 match the audit log, and no older release was changed. The package and registry files written that evening match the database records. The team found no leftover shells and no new accounts or cloud keys in the audit logs.

Database reads, shell commands, environment variables and direct reads from file storage weren’t logged, though. So the team can’t rule out that the attacker accessed data stored in the database. That 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. The registry signing key was among the credentials the attacker could have read, and it hasn’t yet been replaced.

Exploit status

An attacker exploited CVE-2026-129514 on Monday, November 23, 2026. Hex.pm’s incident report records 69 exploit requests between 18:16 and 18:29 UTC that day, all from two IP addresses.

Files created by the exploit appeared on six web servers, in one case 3 milliseconds after the request. Three of those servers joined mid-attack, when a restart brought up machines still running the vulnerable build. The Hex.pm team had all servers on a patched build within about 15 minutes of the first malicious request.

Activity from the two addresses going back to late the previous week suggests the attacker built a local copy of hex.pm to test against. Who was behind the attack is unknown, and exploitation before November 23 hasn’t been established.

Affected component and versions

hex.pm (hexpm server code):

  • Affected from February 23, 2016 until the November 23, 2026 fix
  • Organizations running their own copy of the hexpm registry are affected until they deploy the patch
  • The Hex client isn’t affected by the exploited flaw

The hex.pm service itself was patched on November 23, 2026, and all servers were running the fix by 18:31 UTC. The fix commit makes the decoder reject any term containing a map with a __struct__ key.

Related library flaws, which are separate disclosures:

  • ash (CVE-2026-124283): 3.31.3 up to, but not including, 3.38.0. Fixed in 3.38.0
  • db_connection (CVE-2026-133555): 1.1.0 up to, but not including, 2.10.3. Fixed in 2.10.3
  • flop (CVE-2026-130411): from 0.8.0, each branch before its fix. Fixed in 0.26.7, 0.27.3, 0.28.1 and 0.29.2

Fix and mitigation

All hex.pm users have been logged out because the maintainers replaced the keys that sign sessions and access tokens. Account holders should:

  • Change their hex.pm password.
  • Reset two-factor authentication by setting up a new authenticator entry and storing the new recovery codes.
  • Log back in to the client with mix hex.user auth or, for Erlang projects, rebar3 hex user auth.
  • Update the Hex client when the next release ships (expected within days) with a new registry signing system.

Further steps:

  • Until the new client ships, fetch packages only from repo.hex.pm and avoid third-party mirrors. The registry signing key hasn’t yet been replaced.
  • Organizations running their own hexpm registry should deploy the patch.
  • Update the ash, db_connection and flop libraries to the fixed versions above, assessing each against its stated exploitation conditions.
  • Review whether any private packages hosted on hex.pm contained secrets, since those could have been read without leaving a trace.
  • Watch for phishing. Exposed email addresses may be misused, so check that links in any email about Hex go to hex.pm.

Developers who never created a hex.pm account and only fetch public packages have nothing to reset. Those who signed up with GitHub should still log back in to their clients, and reset two-factor authentication if enabled.

According to the maintainers, API keys don’t need replacing, since they’re random 128-bit values stored only as HMAC-SHA256 hashes. Passwords are hashed with bcrypt, which slows guessing but doesn’t stop it for weak passwords, so changing them still matters.

References