Hackers Exploited CVSS 10.0 Hex.pm RCE Flaw to Compromise 6 Package Registry Servers

Hackers Exploited CVSS 10.0 Hex.pm RCE Flaw to Compromise 6 Package Registry Servers

An attacker ran operating system commands on Monday on six production servers of Hex.pm, the package registry that Elixir and Erlang developers fetch their dependencies from. The flaw used in the attack had been in the registry's code since February 2016, and the team that maintains the service had every server on a patched build within about 15 minutes of the first malicious request. Checks since then found no sign that any package was changed. Whether the attacker read account data such as email addresses, password hashes, and two-factor authentication secrets could not be ruled out, the team said. What Hex Users Should Do Now Everyone with a hex.pm account has been logged out because the maintainers replaced the keys that sign sessions and access tokens. They advise account holders to take these steps: Change your hex.pm password. Reset two-factor authentication by setting up a new authenticator entry, and store 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. Watch for phishing. Exposed email addresses may be misused, so check that links in any email about Hex go to hex.pm. API keys do not need to be replaced, according to the team: they are random 128-bit values stored only as HMAC-SHA256 hashes, which it says cannot realistically be brute-forced. Passwords are hashed with bcrypt, which slows guessing but does not stop it for weak passwords, so changing them still matters. Developers who never created a hex.pm account and only fetch public packages have nothing to reset, Peter Ullrich, one of the report's authors, said in a maintainer clarification on the Elixir Forum. Those who signed up with GitHub should still log back in to their clients, and reset two-factor authentication if they enabled it. Until the new client ships, the advice is to fetch packages only from repo.hex.pm and to avoid third-party mirrors. The registry signing key has not yet been replaced, and it was among the credentials the attacker could have read. The flaw, tracked as CVE-2026-129514 with the maximum CVSS score of 10.0, sat in the parser hex.pm used to read request bodies sent in an Erlang data format. That parser ran before routing and authentication, so an unauthenticated POST request to any address on the site could reach it. The decoding function was meant to be safe, and it did block dangerous terms such as functions, but it accepted maps with a __struct__ key, which allowed a request body to pose as any Elixir struct the application had loaded. The safety check that would have stopped this was removed from the code on February 23, 2016, which is where the flaw's age comes from. Exploitation before Monday has not been established. A crafted struct ran nothing 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 a point where the server called a function of the attacker's choice, which then ran operating system commands with the permissions of the registry's service account. The security advisory lists hex.pm as affected from February 23, 2016 until Monday. The fix commit makes the decoder reject any term containing a map with a __struct__ key, and every hex.pm server was running it by 18:31 UTC on Monday. Load balancer logs recorded 69 exploit requests between 18:16 and 18:29 UTC on Monday, all from two addresses, the Hex.pm team said in its incident report yesterday. Files created by the exploit appeared on six web servers, in one case just 3 milliseconds after the request. Three of those servers joined mid-attack, when a restart brought up machines still on the vulnerable build. To check the packages, the team 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, and the package and registry files written that evening match the database records. Database reads, shell commands, environment variables and direct reads from file storage were not logged. For that reason, "we cannot rule out that the attacker accessed data stored in the database," the team wrote. That database holds email addresses, password hashes, API key hashes, two-factor authentication secrets and session data, and private packages could also have been read without leaving a trace. The checks found no leftover shells and no new accounts or cloud keys in the audit logs. Who was behind the attack is unknown. Activity from the two addresses going back to late last week suggests the attacker built a local copy of hex.pm to test against, according to the team. A separate security report describing the same flaw arrived by email at 19:07 UTC on Monday, after the attack had ended. By yesterday morning the team had replaced every credential the attacker could have read except the registry signing key. On Monday night it reported the breach to the Swedish data protection authority, to CISA in the United States and to ENISA in the European Union. Related Library Fixes 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 yesterday. These are separate disclosures, not further attacks on Hex.pm. Library CVE Affected versions Fixed versions ash CVE-2026-124283 3.31.3 up to, but not including, 3.38.0 3.38.0 db_connection CVE-2026-133555 1.1.0 up to, but not including, 2.10.3 2.10.3 flop CVE-2026-130411 From 0.8.0, each branch before its fixed version 0.26.7, 0.27.3, 0.28.1, 0.29.2 Each needs its own conditions to be exploited. The Ash flaw requires keyset pagination with a client-supplied cursor, certain sort field types, and a signing secret left at its unset default, according to the Ash advisory. The db_connection flaw "is not exploitable in db_connection alone," the DBConnection advisory says, because another component must first decode untrusted data into structs. The Flop flaw has similar conditions around its pagination cursors, according to the Flop advisory. The exploited flaw sits in the hexpm server code, not in the Hex client, so organizations that run their own copy of the registry are affected until they deploy the patch. Found this article interesting? Follow us on Google News, Twitter and LinkedIn to read more exclusive content we post.

Original Source

Read the full article at Thehackernews →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.