· 8 min read

Hex.pm Was Breached Through an Unauthenticated Request Parser. Here Is What an Elixir Solo Dev Should Do This Week, and the Bug Class to Grep For in Your Own App.

On November 23, 2026, between 18:16 and 18:29 UTC, an unauthenticated attacker sent 69 exploit requests to hex.pm and ran commands on its web servers. Hex is the package registry for Elixir and Erlang, so if you write Elixir, your dependencies come from there. The team's write-up, posted November 24, says they found no evidence of tampered packages. It also says they "cannot rule out" that the attacker read email addresses, password hashes, API key hashes, 2FA secrets, sessions and audit logs.

I've read a lot of incident reports this year. This is one of the better ones, and it's useful twice: once for what you need to do as a Hex user, and once for the bug, which could easily exist in your own app.

What to do as a Hex user

The post lists three steps. Change your password at hex.pm. Reset your 2FA: go to the security page in your dashboard, choose "Setup New App" under the authenticator section, and verify a code from the new entry. That gives you a new secret and new recovery codes, so store them somewhere sensible. It also works if your organization requires 2FA and won't let you disable it.

The third step isn't available yet. The team is shipping a new registry signing system "in the coming days," and when it lands you run mix local.hex --force, plus update rebar3 or Gleam if you use them. Until then, fetch packages only from repo.hex.pm and not from third-party mirrors.

What the post does not ask: it doesn't tell you to rotate API keys. Those are 128-bit random values stored as HMAC-SHA256, and the team says it doesn't see a need. Passwords are bcrypt hashes, which slow an attacker down but don't make a weak password safe, hence the reset.

Because email addresses may have leaked, expect phishing that claims to come from Hex. The post asks you to check that links go to hex.pm and to forward anything suspicious to security@hex.pm. Infrastructure credentials and the keys that sign sessions were rotated, which logged everyone out. That's why you're signed out, and it's not a reason to click a "re-verify your account" email.

Did anything change in my dependencies?

The team checked. All 23 releases published during the incident match the audit log, no older release changed, and the package and registry files written since 18:00 match the database checksums. Documentation archives had no stored checksum, so those couldn't be compared.

My own habit here, not something from the post: mix.lock stores a checksum for every Hex dependency. If it's committed, git log -p mix.lock shows exactly when each one changed. I'd look for any entry that moved on November 23 or 24 that I didn't cause. On most projects that list will be empty.

The bug, and why I'd grep for it

The root cause is a pattern many Elixir apps could have. Hex.pm accepted request bodies with the application/vnd.hex+erlang content type and decoded them with Plug.Crypto.non_executable_binary_to_term/2. That parser ran before routing and authentication, so any anonymous POST reached it.

The "non-executable" decoder blocks functions and new atoms. It doesn't look inside maps, so a map with a __struct__ key passes as a fake Elixir struct. The attacker built fake structs that got passed through method override, logging and inspect calls, ending in Ecto's inspect implementation and DBConnection's :log option, which produced OS command execution as the BEAM's user. The post says the safety check that would have caught this was removed in February 2016. Nobody noticed for almost eleven years.

The team found the same class of bug in Ash's keyset pagination (CVE-2026-124283), fixed in ash 3.38.0, released November 24. They say it "could lead to command execution or SQL injection." If you use Ash, that update comes first.

For your own code, this is the grep I'd run:

grep -rn "binary_to_term" lib/ --include=*.ex --include=*.exs
grep -rn "x-erlang\|+erlang" lib/ config/

Any hit that touches bytes from a request, a cookie, a webhook or a queue an outsider can write to deserves a hard look. "Non-executable" and [:safe] limit what can be created. Neither makes untrusted terms trustworthy. If you need structured input from the outside, JSON with explicit validation is the boring answer for a reason.

What a small team got right

The patched build was on every server by 18:31, about 15 minutes after the first exploit request. The firewall rule went in at 18:27. A security report describing the same bug arrived at 19:07, after they'd already fixed it. Before midnight UTC they had reported to Sweden's data protection authority, CISA and ENISA. The post includes a timeline with seconds, the exact exploit chain, what they checked, and what they couldn't check.

One detail I like: a restart at 18:28 brought up three new servers still running the vulnerable build. They wrote that down instead of smoothing it over. If I ever have to write one of these, this is the template I'll copy.

Where I could be wrong

I'm taking the "no tampered packages" finding at face value because the checks described are specific and the team published them. Database reads weren't logged, though, and direct reads from cloud storage weren't either, so private packages and docs can't be fully cleared. If you publish private packages through Hex, I'd treat their contents as possibly exposed and think about whether anything in them, like an internal URL or a hardcoded test credential, needs changing.

The registry signing key also hadn't been rotated at the time of writing. The new signing system is the fix for that, and until it ships the advice to avoid mirrors is the whole defense.

What I'd actually do

Today: change the Hex password, reset 2FA and store the new recovery codes. Update Ash to 3.38.0 if you use it. Run the binary_to_term grep on every Elixir app you own. Check mix.lock history for surprises. Then put a reminder on your calendar to run mix local.hex --force when the signing release lands, and update CI images at the same time, because CI is where an old Hex client tends to live longest.

Author

Sources

Newsletter

The week, in one email.

The weekly summary of what happened and what it means for people who build alone. No spam, unsubscribe any time.

Form not showing? Subscribe on this page instead.

Related Posts