The team behind Hex.pm, the primary package registry for the Elixir and Erlang ecosystems, has disclosed a security incident involving the successful exploitation of a critical remote code execution vulnerability that allowed an attacker to execute operating system commands on six production servers.
The vulnerability, tracked as CVE-2026-129514 and assigned a CVSS score of 10.0, had remained hidden in Hex.pm's codebase for more than a decade before being weaponized in the attack. Despite the severity of the compromise, maintainers reported that vulnerable systems were patched within approximately 15 minutes of the first malicious request being detected.
Package Integrity Appears Unaffected
Following an extensive forensic investigation, the Hex.pm team stated that it found no evidence that package contents, releases, or registry metadata were altered during the intrusion. Comparisons between pre-attack and post-attack database states showed no unauthorized package modifications, and all package releases published during the incident aligned with legitimate audit logs.
However, investigators were unable to conclusively determine whether the attacker accessed sensitive information stored within the platform. As a result, exposure of account-related data cannot be ruled out.
Potentially accessible information includes:
- Email addresses
- Password hashes
- Two-factor authentication secrets
- Session information
- Private package contents
- API key hashes
Because certain database queries, file-storage reads, environment variable access, and shell activity were not comprehensively logged, investigators acknowledged that portions of the attacker's activity may have occurred without leaving forensic evidence.
Immediate Actions for Hex.pm Users
As a precautionary measure, Hex.pm administrators invalidated all active user sessions and rotated the cryptographic keys used for session management and access-token signing.
Users are strongly encouraged to:
- Change their Hex.pm account password immediately.
- Reconfigure two-factor authentication with a new authenticator entry.
- Generate and securely store updated recovery codes.
- Re-authenticate package management clients using:
mix hex.user authfor Elixir environments.rebar3 hex user authfor Erlang projects.
- Upgrade to the forthcoming Hex client release, which introduces an updated registry-signing architecture.
- Remain alert for phishing campaigns, particularly those attempting to capitalize on potentially exposed email addresses.
The maintainers emphasized that API keys do not currently require replacement. The keys are generated as high-entropy 128-bit values and stored only as HMAC-SHA256 hashes, making brute-force recovery impractical. Passwords, while protected using bcrypt hashing, remain susceptible if weak or reused credentials were chosen, making password resets a critical precaution.
Certain Users Face Lower Risk
Developers who only consume public packages and never registered a Hex.pm account are not required to perform any remediation steps.
Users who authenticate through GitHub should still log back into their clients after session invalidation. Those who had enabled multi-factor authentication are also advised to reset their authenticator configurations and recovery codes.
Until updated client software becomes available, maintainers recommend downloading packages only from the official repo.hex.pm infrastructure and avoiding third-party mirrors.
Root Cause: Decade-Old Deserialization Flaw
The attack exploited a critical weakness in the mechanism used by Hex.pm to process request bodies encoded in Erlang's external term format.
Because request decoding occurred before normal routing and authentication checks, any unauthenticated POST request submitted to the service could reach the vulnerable code path.
The parser attempted to safely deserialize incoming data and included protections against dangerous Erlang terms. However, it failed to reject specially crafted structures containing a __struct__ field, allowing attackers to masquerade arbitrary payloads as legitimate Elixir structures already loaded by the application.
The vulnerability originated from a security validation that was removed from the codebase on February 23, 2016, leaving the platform exposed for more than ten years.
Exploitation Chain Led to Remote Command Execution
The malicious struct itself did not directly execute code. Instead, it triggered an application exception.
When the platform attempted to inspect and process the resulting error, execution entered code paths within the widely used Ecto and DBConnection libraries. Through this sequence, attackers gained the ability to invoke attacker-controlled functions and ultimately execute operating system commands under the permissions of the Hex.pm service account.
The security patch now blocks deserialization of any payload containing maps that define a __struct__ key, eliminating the vulnerable execution path.
Attack Timeline Reveals Rapid Exploitation
According to the incident report, infrastructure logs recorded 69 exploit attempts between 18:16 UTC and 18:29 UTC on Monday.
The malicious traffic originated from only two IP addresses.
Investigators found evidence that attacker-controlled commands successfully executed on six web servers. In some cases, malicious files appeared on compromised hosts within just milliseconds of the triggering request.
Three affected systems entered service during the attack window after restarts brought online instances that had not yet received the patched code, allowing them to be compromised before the update process completed.
Evidence Suggests Significant Reconnaissance
Analysis of activity associated with the attacking infrastructure indicated that reconnaissance may have begun several days before the successful compromise.
The Hex.pm team believes the attacker likely built and tested a local instance of the registry prior to launching the operation, allowing precise development of the exploit chain.
Investigators found no evidence that the attacker:
- Created persistent backdoors
- Established long-lived shells
- Added unauthorized user accounts
- Generated new cloud credentials
- Modified registry packages
Nevertheless, maintainers stressed that the absence of logging around certain data-access operations prevents them from definitively ruling out information theft.
Coordinated Disclosure and Response
Interestingly, a separate vulnerability report describing the same flaw arrived via email shortly after the attack concluded, suggesting independent discovery by another researcher.
By the following morning, the Hex.pm team had rotated nearly all sensitive credentials potentially exposed during the incident. The registry signing key remains the sole credential not yet replaced, which is why maintainers are advising users to rely exclusively on the official package repository until the upcoming client release introduces additional signing protections.
The breach was also reported to multiple regulatory and cybersecurity agencies, including:
- Sweden's data protection authority
- The U.S. Cybersecurity and Infrastructure Security Agency (CISA)
- The European Union Agency for Cybersecurity (ENISA)
Related Vulnerabilities Uncovered in Popular Elixir Libraries
During the investigation, maintainers of several prominent Elixir ecosystem projects disclosed separate security issues involving unsafe handling of untrusted data structures.
Updated versions were released for:
- Ash
- DBConnection
- Flop
While these vulnerabilities share certain technical characteristics with the Hex.pm flaw, maintainers stressed that they are independent issues and were not used in the attack against Hex.pm.
The vulnerabilities require additional application-specific conditions to be exploitable, such as unsafe pagination cursor handling, insecure configuration defaults, or systems that deserialize untrusted data into application structures.
Organizations Running Private Registries Should Patch Immediately
While public users interact with the hosted Hex.pm service, organizations operating self-managed instances of the Hex package registry should take immediate action. The vulnerability resides in the Hex.pm server software, not the client tools used by developers, meaning any private deployments remained vulnerable until the vendor-issued patch was applied.
The incident serves as a reminder of how a seemingly minor parser weakness can remain hidden for years before being transformed into a critical unauthenticated remote code execution vulnerability capable of compromising production infrastructure at scale.
Found this article interesting? Follow us on X(Twitter) ,Threads and FaceBook to read more exclusive content we post.
