News Analysis 9 min read

Hex.pm RCE Turns Registry Recovery Into A Trust Reset

Hex.pm says attackers ran commands on six web servers. Reset passwords and 2FA, use only repo.hex.pm and track the signing update.

By Protocol Report Editorial | Updated November 26, 2026
An amber crafted structured request crosses a package registry parser, error handler and command boundary to reach six web servers while a cyan path rejects the request, replaces servers, rotates credentials, resets account secrets and restores signed package trust
Short Version

Hex.pm says an unauthorized party exploited CVE-2026-129514 on November 23 to run operating-system commands on six registry web servers. The unauthenticated request used a chain of attacker-shaped Elixir structs, protocol dispatch and an error-reporting path to reach a configurable logging callback. Hex counted 69 malicious requests between 18:16 and 18:29 UTC, replaced every server with a patched build by 18:31 and blocked later requests from the identified addresses. The CVE is rated Critical at 10.0 and the vendor marks exploitation as confirmed.

The investigation found no unauthorized package modification, database change or persistent access, but Hex cannot rule out database reads, environment-variable reads, direct private-package reads or private-documentation access. Users should follow the vendor's specific response: change the Hex.pm password, reset the authenticator-app enrollment and recovery codes, use only `repo.hex.pm` rather than third-party mirrors, and update Hex, rebar3 or Gleam when clients supporting the new registry-signing system are released. Do not describe the incident as a proven package supply-chain compromise; the unresolved risk is access and trust material, not confirmed package tampering.

Key Takeaways

  • check_circle The attacker sent 69 exploit requests over about 13 minutes, and Hex matched command-created files to requests on six web servers.
  • check_circle The vulnerable parser ran before routing and authentication, so a crafted POST could reach it without an account or user interaction.
  • check_circle Hex verified package and registry writes during the incident and found no unexpected release, but gaps in read logging leave some exposure unresolved.
  • check_circle Infrastructure, database, storage, email, session and access-token credentials were rotated; the registry-signing transition still requires a client update.
  • check_circle Hex asks users to change passwords and reset 2FA, but says database exposure of HMAC-protected API-key hashes does not by itself require API-key rotation.
  • check_circle Self-hosted deployments of the Hex.pm server code need commit `379b0a2` or later and should treat any exposed vulnerable server as a host-level incident.

A Request Parser Reached Command Execution

The entry point was Hex.pm's parser for the `application/vnd.hex+erlang` content type. It decoded Erlang external term data with `Plug.Crypto.non_executable_binary_to_term/2` and the `:safe` option. That option blocks functions and new atoms, but the resulting term could still contain a map with a `__struct__` key. In Elixir, that key can make an ordinary map behave as an instance of a named module for protocol dispatch.

The parser operated in the endpoint before the router and authentication plugs. A POST to any route could therefore supply body parameters before Hex.pm decided whether the route existed or required a user. `Plug.MethodOverride` then tried to read `_method` from the attacker-selected struct, which raised an error. Error reporting inspected the request and stack arguments, and inspection dispatched to the struct implementation named by the input.

The published chain used `Ecto.Query.DynamicExpr` to enumerate a crafted `DBConnection.Stream`. Its query encoding failed, but the failure path still invoked the stream's `:log` callback. The request controlled a module, function and argument tuple used by that callback, allowing a call into loaded runtime code and ultimately an operating-system command as the BEAM process user. This was a composition failure across decoding, parameter handling, inspection, enumeration and logging, not a single shell command placed directly in an HTTP field.

The Confirmed Window Was Short But Material

Hex's incident timeline begins with the first exploit request at 18:16:00 UTC on November 23. The service recorded 69 malicious requests through 18:29:33. Six web servers executed commands. Three additional servers became exposed when a restart at 18:28 launched them on the still-vulnerable build, showing why a partial rollout or automatic replacement can extend an incident even after response has started.

Responders added a firewall rule at 18:27, replaced web, worker and job servers from the patched build between 18:30 and 18:31, and observed the identified source addresses being denied from 18:33:48 onward. Hex deactivated the affected AWS access key at 18:49, rotated most infrastructure credentials by 20:21 and completed the database-password change on November 24. It also reported a personal-data breach to Sweden's IMY and notified CISA and ENISA.

The public evidence supports confirmed command execution on registry infrastructure. It does not establish that the attacker altered a package, created a hidden account or kept access after server replacement. Hex found no running shells before replacement, no unexplained cloud API activity, no new keys or accounts and no writes from the attacker's addresses. Those negative findings narrow the known impact, but they do not turn missing telemetry into proof that every read was harmless.

Package Integrity And Data Exposure Need Separate Answers

Hex reconciled all 23 releases published during the incident with its audit log. It checked 62 package files and 186 registry files written since 18:00 against database records and found no unexpected content. Storage access logs showed the expected writes, no deletes, no version-specific requests and no bucket listing by the production identity. This is strong evidence against unauthorized package modification in the investigated window.

Read access is less conclusive. Database reads, environment-variable reads and shell commands were not logged. Direct cloud-storage reads could not be excluded, and private documentation archives do not have stored checksums. The database could contain email addresses, password hashes, API-key hashes, two-factor secrets, sessions and audit logs. The operator also says a compromised server reading private packages could resemble an ordinary service-originated request.

Treat those as bounded unknowns rather than confirmed theft. Hex says API keys are random 128-bit values stored as HMAC-SHA256 and does not recommend rotating them merely because their hashes might have been read. Password hashes use bcrypt, which leaves weak passwords exposed to offline guessing, so the password reset is justified. Two-factor seeds are reusable shared secrets, so re-enrollment and new recovery codes are necessary even without proof that a particular row was copied.

Users And Organizations Have Different Recovery Work

Every Hex.pm user should change the account password to a unique value and set up the authenticator app again from the security dashboard. The reset issues a new seed and new recovery codes. Store the recovery codes away from the device that holds the authenticator. Because Hex rotated the keys that sign sessions and access tokens, existing web and client sessions were invalidated; a fresh sign-in is expected rather than evidence of another attack.

Organization administrators should reconcile membership, owners, package releases, authentication changes and organization audit events around the incident window. Confirm that the 23 releases Hex identified match intended publisher activity for your organization, and compare package checksums with pinned build records or reproducible-build evidence where available. Preserve relevant CI logs before re-authenticating tools so the replacement credentials do not erase the sequence responders need to review.

Do not rotate every API key solely because the database may have been read, since that contradicts the vendor's assessment of its stored hashes. Rotate a key when there is separate evidence that the usable value was exposed, such as a repository leak, compromised developer workstation, CI log or secret store. Private-package customers should watch for direct notices from Hex, which said it would contact affected organizations where the private-content investigation identified relevant activity.

Registry Signing Is The Remaining Trust Transition

The command-running process could read the registry-signing key from its environment. Hex had rotated the database and other reachable credentials by 10:42 UTC on November 24, but its incident post explicitly excluded the registry-signing key and a few low-impact secrets from that completed set. The project is building a signing design that supports rotation and says compatible Hex, rebar3 and Gleam releases will follow.

Until that release is available, the vendor tells users not to trust third-party mirrors and to fetch only from `repo.hex.pm`. That instruction is narrower than disabling dependency installation. Keep lock files, package checksums and normal review gates in place, avoid adding mirrors during the transition, and record the client version used in build evidence. Once the signing update ships, update all developer, CI, release and recovery environments rather than only an administrator laptop.

As of this article's publication date, the official incident guidance still describes the new signing clients as forthcoming. Verify the current Hex announcement and release notes before automating an update command. A client version number copied from a third-party post can become stale quickly, while the official public-key page is designed to explain revoked-key errors and the trust transition supported by current clients.

The Durable Fix Must Exist At More Than One Layer

The deployed Hex.pm fix, commit `379b0a2`, recursively rejects any decoded map containing `__struct__` and returns a 400 response. Tests cover a top-level struct, nested values, struct keys and improper lists while preserving ordinary maps, tuples and lists. Placing the check in the single decoder for the format closes the demonstrated path across every route that accepts it.

Hex is also pursuing defense in depth in `plug_crypto`, Plug, Ecto and DBConnection. Proposed work includes documenting that the decoder is suitable only for authenticated payloads, adding a reject-struct option, refusing structs as body parameters, validating the expected binding type before enumeration and preventing a stream struct from supplying an executable log callback. Those changes matter because a parser-level block can be weakened later unless downstream components also reject attacker-selected behavior.

Self-hosters should rebuild from commit `379b0a2` or a later maintained release, prove that a nested fake struct receives a 400 response and replace rather than merely restart affected instances. If a vulnerable service was internet reachable, preserve load-balancer, application, error-tracker, process, cloud-audit and storage evidence before cycling infrastructure. Rotate every secret readable by the service, then verify the new identities from clean hosts. The hosted Hex.pm service has already been patched; these server-code actions apply to independent deployments.

Checklist

  • Change the Hex.pm password to a unique value and re-enroll the authenticator app to obtain a new secret and recovery codes.
  • Use only `repo.hex.pm` during the signing transition and remove or pause untrusted third-party mirrors.
  • Track the official Hex announcement, then update Hex, rebar3 and Gleam clients across developer, CI, release and recovery systems.
  • Reconcile organization membership, releases, package checksums and audit events around 18:16 to 18:29 UTC on November 23.
  • Rotate a usable API key only when separate evidence shows its value was exposed; the vendor does not treat stored key hashes as reversible.
  • For a self-hosted Hex.pm server, deploy commit `379b0a2` or later, reject nested structs and replace any exposed vulnerable instance.
  • Preserve proxy, application, Sentry, cloud, storage and CI evidence before credentials or hosts are replaced.

Sources

Related Articles

Continue Reading