Poisoned Pipeline / Incidents / AS531
An unauthenticated Erlang-term body sent to hex.pm chained decoded structs through inspect implementations into a database driver's log callback, running commands on six registry web servers for thirteen minutes; no package changes were found, and the registry signing key was not rotated
Hex / ErlangCertificates / trust stores
Hex published an incident report after an unauthorized third party ran
commands on hex.pm's web servers on 23 November 2026, and
CVE-2026-129514 was published the next day. The attacker sent 69
malicious requests between 18:16 and 18:29 UTC; six web servers were
affected, and Sentry recorded its first error at 18:16:00 and an error
for each request. Hex added a firewall rule at 18:27, effective between
18:30 and 18:33, replaced all servers with a patched build at 18:30 to
18:31, and denied further requests from the attacking address from 18:33
to 18:38. An AWS access key was deactivated at 18:49, a security report
describing the same vulnerability arrived at 19:07, most infrastructure
credentials were rotated by 20:21 and the database password on 24
November. By 10:42 on 24 November every credential the attacker could
have read had been replaced except the registry signing key and a few
low-impact secrets. The incident was reported to IMY, CISA and ENISA on
the night of 23 November.
The entry point was a custom parser for the application/vnd.hex+erlang
content type. It decoded unauthenticated request bodies with
Plug.Crypto.non_executable_binary_to_term/2 and the [:safe] option,
which rejects functions and new atoms but never checks maps. An Elixir
struct is a map with a __struct__ key naming a module, so the attacker
could send a value the runtime treats as a real struct with every field
under their control. The endpoint ran the parser before routing and
authentication, so any unauthenticated POST with that content type
reached it on every route.
The chain from there used only code the servers already load. The
decoded struct became the request's body parameters; Plug.MethodOverride
read body_params["_method"], which on a struct calls fetch/2 on the
module named in __struct__. That function did not exist, so the request
raised an UndefinedFunctionError with the attacker's struct in the stack
trace. Sentry, Bandit's error logging and the JSON log formatter then
called inspect on the request data and stack-frame arguments. Inspect is
a protocol, so for a struct it runs the implementation of the module
named in __struct__ — the attacker chose Ecto.Query.DynamicExpr. Its
Inspect implementation enumerated the binding field without checking
that it was a list, and enumeration is itself a protocol call, so a
struct in that field dispatched to another implementation:
DBConnection.Stream. Its Enumerable implementation calls
DBConnection.reduce/3 and then declare/4; encoding the query failed
before any connection was checked out, but the error path still ran the
stream's :log option, which was a {module, function, args} tuple taken
from the request, applied with the log entry prepended. That gave the
attacker functions in loaded libraries and the standard library, and
from there OS command execution as the BEAM's user.
While investigating, Hex found the same class of vulnerability in Ash:
keyset pagination accepted crafted structs in client-supplied cursors,
which could lead to command execution or SQL injection. The Ash team
released a fix in 3.38.0 on 24 November under CVE-2026-124283. The hexpm
fix, commit 379b0a2, rejects any term containing a map with a __struct__
key — the decoder's promise of non-executable terms was not enough on
its own, because the code that consumed the decoded value dispatched on
what it found.
Hex found no evidence of unauthorized package modifications, database
changes, or that the attacker maintained access. It cannot rule out
reads. Database reads are not logged, so email addresses, password
hashes, API key hashes, 2FA secrets, sessions and audit logs may have
been accessed; every file written to package storage during the incident
was checked against the database and nothing unexpected was found; reads
of private packages in the period came from Hex's own servers and
coincide with releases the same organizations published at the time, but
a read from a compromised server would look like one of Hex's own, and
reads of private documentation are not logged. Affected organizations
are to be contacted directly.
The credential rotation covered storage, CDN, email and database
credentials and the keys that sign sessions and access tokens, which
logged everyone out of hex.pm and Hex clients. It did not cover the
registry signing key. Hex is building a new registry signing system that
supports key rotation, with new client releases to follow; until then it
tells users not to trust third-party mirrors and to fetch packages only
from repo.hex.pm. Users are asked to change their password, reset 2FA
through Setup New App so they get a new secret and recovery codes, and
treat email claiming to come from Hex with suspicion, checking that
links lead to hex.pm. Clients update with mix local.hex --force; rebar3
and Gleam users update those.
Mapped techniques
- T0265 Chain decoded request structs into a callback the server already trusts
- T0180 Compromise services / servers
- T0209 Compromise package registry or CDN origin
- T0199 Secret leak
supply-chain A crafted struct in an unauthenticated request body reaches a log callback
The decoder blocked functions and new atoms but not maps, so a
__struct__ map chose the module whose fetch/2 raised the error;
inspect dispatched to Ecto.Query.DynamicExpr, enumeration to
DBConnection.Stream, and the stream's :log option was a
{module, function, args} tuple from the request, applied with the
log entry prepended. Every hop was a legitimate protocol
implementation in code the server already loads.
The parser ran before routing and authentication on every route, so
an unauthenticated POST with application/vnd.hex+erlang reached it
without a credential. The attacker ran OS commands as the BEAM user
on six web servers for thirteen minutes, 69 requests in all, before
the firewall rule and patched build took effect.
The target was the registry's own serving infrastructure, not a
publisher account. Hex checked every file written to package storage
during the incident against its database and found nothing
unexpected, so no artifact is known to have been changed; the
compromise is command execution at the origin that serves Hex
packages.
post-supply-chain Server credentials and user records become readable, and the signing key stays
The commands could read the credentials the servers use, so storage,
CDN, email and database credentials and the session and
access-token signing keys were replaced, logging every user out.
Database reads are not logged, so email addresses, password hashes,
API key hashes, 2FA secrets, sessions and audit logs cannot be ruled
out. The registry signing key was not rotated; Hex is building a
rotatable signing system and until then advises using only
repo.hex.pm.
Framework gaps noted
- Reads cannot be excluded. Hex found no unauthorized package modifications or database changes, but database reads are not logged and private documentation reads are not logged, so access to user records and private package data remains possible rather than observed.
- The signing key did not rotate. Every other credential the attacker could read was replaced, but the registry signing key was left in place while a rotatable system is built, so the trust anchor for Hex packages is unchanged and third-party mirrors are still told to be avoided.
- The attacker's commands are not recorded. Hex reports the requests and the server effects but not a command log, so what was run on the six servers beyond the exploit chain is unknown.
- Attribution is absent. The report names no actor and does not say whether the requests were automated or whether the vulnerability was being probed before 18:16.
- The same class was found elsewhere. Ash's keyset pagination accepted crafted structs in client cursors (CVE-2026-124283, fixed in 3.38.0); other consumers of Plug.Crypto's term decoding were not surveyed in the report.