Critical Security Flaw Exploited on Hex.pm Package Registry Affecting Elixir and Erlang Ecosystems

The software supply chain supporting the Elixir and Erlang programming languages faced a critical security incident this week after an attacker successfully executed operating system commands on production servers belonging to Hex.pm, the official package registry for the ecosystem. The breach, which unfolded on Monday, exploited a vulnerability that had remained hidden within the registry’s codebase for nearly a decade.

According to an incident report published by the Hex.pm team, the flaw was introduced into the platform’s codebase on February 23, 2016. It resided within the custom request body parser used to process incoming data sent in the native Erlang external term format. Because this parser executed prior to standard routing and authentication checks, an unauthenticated POST request directed to any endpoint on the platform could successfully interact with the vulnerable parsing logic.

Although the decoding function was originally designed to operate securely and block dangerous terms such as arbitrary functions, it contained a critical blind spot. Specifically, it accepted data maps containing a __struct__ key. This oversight allowed a maliciously crafted request body to impersonate any Elixir struct that had been loaded into the application’s memory.

While sending a crafted struct did not execute code immediately, it triggered an application error. During the subsequent error-reporting phase, the internal inspection mechanisms—specifically routed through the Ecto and DBConnection database libraries—processed the malicious struct. This chain of events ultimately directed the server to invoke a function specified by the attacker, successfully executing arbitrary operating system commands with the elevated privileges of the registry’s service account.

The severity of the vulnerability has been formally tracked under the identifier CVE-2026-129514, receiving the maximum possible Common Vulnerability Scoring System (CVSS) rating of 10.0. Load balancer logs analyzed by the maintainers recorded 69 distinct exploit requests between 18:16 and 18:29 UTC on Monday, originating from just two IP addresses.

Forensic analysis revealed that files generated by the exploit were written to six separate web servers. In one instance, a malicious file appeared just three milliseconds after the initial request arrived. Three of the compromised servers had joined the infrastructure mid-attack when routine server restarts inadvertently brought up machines that were still running the vulnerable software build.

Despite the rapid execution of malicious commands, swift action by the platform maintainers mitigated the broader impact. The development team successfully deployed a patched build to every production server within approximately 15 minutes of the first malicious request. The remediation commit updated the decoder to explicitly reject any incoming term containing a map with a __struct__ key, and the entire Hex.pm infrastructure was running the updated code by 18:31 UTC on Monday.

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

To verify the integrity of the ecosystem, the registry team performed a comprehensive audit by comparing every database table against a backup snapshot taken two minutes before the first exploit request occurred. Every discrepancy discovered during the audit was successfully traced back to legitimate user activity. The team confirmed that the 23 package releases published during the attack window matched the official audit logs, no historical releases were modified, and all package and registry files written that evening corresponded accurately to database records.

Furthermore, post-incident checks revealed no lingering reverse shells, unauthorized user accounts, or unfamiliar cloud credentials within the audit logs. Interestingly, a separate security report detailing the exact same vulnerability arrived via email at 19:07 UTC on Monday, reaching the team shortly after the active exploitation phase had concluded. The identity of the attacker remains unknown, though activity traced back to the source IP addresses from late last week suggests that the perpetrator had constructed a local replica of Hex.pm to test and refine the exploit prior to the attack.

What Hex Users Should Do Now

While the rapid deployment of patches prevented the modification or tampering of public packages, the incident response team could not entirely rule out unauthorized data access. Because operations including direct database reads, shell commands, environment variables, and file storage queries were not comprehensively logged, the maintainers warned that the attacker may have read sensitive information stored within the platform database.

The underlying database contains sensitive user data, including email addresses, salted password hashes, API key hashes, two-factor authentication secrets, and active session tokens. Additionally, private packages hosted on the platform could potentially have been read without leaving a verifiable audit trail.

In response to these potential exposures, the Hex.pm maintainers invalidated all active user sessions by replacing the cryptographic keys used to sign session cookies and access tokens. Consequently, all registered users have been automatically logged out of their accounts. Developers who signed up using GitHub authentication are still required to log back into their respective clients and should reset their two-factor authentication configurations if enabled.

While passwords are protected using the bcrypt hashing algorithm—a computational method designed to slow down brute-force guessing attacks—weak passwords remain vulnerable to offline cracking efforts. As a result, account holders are strongly advised to update their account passwords. Conversely, API keys do not need to be replaced. These keys consist of random 128-bit values stored exclusively as HMAC-SHA256 hashes, a cryptographic design that makes brute-force attacks computationally unfeasible.

Developers who have never registered a Hex.pm account and rely solely on fetching public packages do not need to take any corrective action. Peter Ullrich, one of the report’s authors, clarified this distinction in a statement published on the Elixir Forum, noting that consumers of public packages are entirely unaffected by the account-level credential risks.

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

Until the official updated client software is released, maintainers advise developers to fetch dependencies exclusively through repo.hex.pm and to strictly avoid third-party mirrors. This precaution is necessary because the core registry signing key—which was among the credentials potentially exposed to the attacker—has not yet been rotated.

In the wake of the incident, the Hex.pm team formally reported the security breach on Monday night to relevant international regulatory bodies, including the Swedish data protection authority, the Cybersecurity and Infrastructure Security Agency (CISA) in the United States, and the European Union Agency for Cybersecurity (ENISA). Organizations operating private, self-hosted instances of the Hex registry remain vulnerable and are urged to apply the software patch immediately.

Related Library Fixes

Concurrently with the Hex.pm incident disclosures, maintainers of several widely adopted Elixir libraries released security advisories addressing separate vulnerabilities involving structs constructed from untrusted input. While these disclosures coincided with the registry attack, maintainers emphasized that they represent distinct software flaws rather than secondary exploitation vectors targeting Hex.pm.

Among the affected packages is the Ash framework, which addressed a vulnerability tracked as CVE-2026-124283 affecting versions 3.31.3 up to, but not including, 3.38.0. According to the Ash project advisory, exploitation of this flaw requires specific preconditions, including the use of keyset pagination with a client-supplied cursor, particular sort field types, and a signing secret left at its insecure default configuration.

Similarly, the db_connection library issued a fix for CVE-2026-133555, impacting versions 1.1.0 through 2.10.2. The advisory explicitly notes that this vulnerability cannot be exploited within db_connection in isolation, as another upstream component must first decode untrusted data into an improper struct. The Flop library also disclosed a pagination-related vulnerability tracked as CVE-2026-130411, releasing updated patches across multiple active release branches.