On Monday, an attacker executed operating system commands on six production servers belonging to Hex.pm — the package registry that the entire Elixir and Erlang ecosystem depends on to fetch dependencies. The vulnerability carries a CVSS score of 10.0, the maximum possible severity, and according to the Hex team, the flawed code had been sitting in the registry's codebase since February 2016 — nearly a decade of silent exposure.
To the Hex team's credit, their incident response was exemplary: every server was running a patched build within approximately 15 minutes of the first malicious request. But speed of patching does not erase the fact that an attacker achieved remote code execution on infrastructure that sits at the root of trust for thousands of downstream projects. If you build, deploy, or operate anything written in Elixir or Erlang — and that includes a surprising amount of telecom, fintech, messaging, and embedded infrastructure — this incident demands immediate attention on two fronts: (1) verifying the integrity of every package you've pulled from Hex, and (2) hunting your own Elixir/Erlang application estates for the same class of flaw, because this bug class is almost certainly not unique to Hex.pm.
Package registries are the crown jewels of software supply chains. A compromise of Hex.pm isn't one breach — it's potentially thousands. This post breaks down what happened, how to hunt for the same attack pattern in your environment, and how to harden your dependency pipeline against registry-level compromise.
Technical Analysis
What Was Affected
| Item | Detail |
|---|---|
| Affected service | Hex.pm — the canonical package registry for Elixir and Erlang (hex.pm) |
| Affected component | Registry server-side code (web/API application) |
| Flaw introduced | February 2016 (latent for ~10 years) |
| Severity | CVSS 10.0 (Critical — network-exploitable, no authentication, no user interaction, full scope change) |
| Impact confirmed | OS command execution on 6 production registry servers |
| Exploitation status | Confirmed in-the-wild exploitation — this is not theoretical |
| Vendor response | All servers rebuilt/patched within ~15 minutes of first malicious request |
Note: No CVE identifier was published in the initial disclosure referenced here. Defenders should monitor the Hex blog and the Erlang/Elixir security channels for a formal advisory and CVE assignment.
How This Class of Attack Works (Defender's View)
A CVSS 10.0 remote code execution against a web-facing registry almost always reduces to one of a small number of root causes:
-
Command injection via unsanitized user-controlled input. Package registries process a torrent of attacker-controllable data: package names, version strings, metadata fields, tarballs, documentation uploads, search queries, and authentication tokens. If any of that data flows into a system call —
os:cmd/1in Erlang,System.cmd/2or:os.cmdin Elixir, or shell-outs to tools likegit,tar, orgpg— a crafted input breaks out into a shell. A decade-old code path in Hex.pm's codebase is entirely consistent with legacy input handling that predates modern validation discipline. -
Unsafe deserialization or archive extraction. Registries unpack
.tararchives on publish. Path traversal (../../etc/cron.d/...) or symlink attacks during extraction can write arbitrary files, which is frequently chained into code execution. -
Injection through downstream tooling. Even if the Elixir code is clean, passing package metadata into a shell-invoked helper (e.g., building docs, diffing versions) without proper argument separation yields classic
; id;or$(...)injection.
From a detection standpoint, all three converge on the same high-fidelity signal: the BEAM virtual machine process (beam.smp / beam) spawning child processes it shouldn't — shells, network tools, or reconnaissance binaries. In a well-architected registry, the BEAM node should essentially never fork sh, bash, curl, wget, id, or nc in production. That makes this an unusually low-noise detection opportunity.
Why Registry Compromise Is a Supply Chain Emergency
An attacker with code execution on registry servers can, in principle:
- Swap or backdoor published package tarballs so downstream
mix deps.getorrebar3fetches deliver poisoned code into thousands of builds. - Tamper with checksums stored in the registry database so poisoned packages still verify.
- Harvest publisher credentials and API keys, enabling direct malicious publishes under legitimate maintainer identities.
- Pivot into signing and release infrastructure.
Hex uses checksum verification (and the mix hex tooling verifies tarballs against registry-stored checksums), but if the attacker controls both the tarball and the checksum database, client-side verification alone is not a guarantee. This is precisely why you must compare against lockfiles generated before the incident window and, where possible, against independently mirrored checksums.
Detection & Response
This is a technical threat — confirmed active exploitation of a maximum-severity RCE against production infrastructure. The detections below target two things: (a) the exploitation pattern itself (BEAM/web processes spawning shells and running reconnaissance), and (b) post-exploitation behavior consistent with what an attacker does in the first minutes on a compromised registry host.
Sigma Rules
These rules assume Linux process creation telemetry (Sysmon for Linux, auditd, or EDR) on your Elixir/Erlang application hosts. Rule 1 is the crown jewel — it is exceptionally low-noise on properly deployed BEAM workloads.
---
title: BEAM VM Spawning Shell or Command Interpreter
description: Detects the Erlang VM (beam.smp/beam) spawning shell interpreters or command execution utilities — the primary observable of command injection against Elixir/Erlang web applications such as the Hex.pm registry RCE.
id: 3f8a2c71-9b4e-4d6a-a512-8c7e9f01ab23
status: experimental
references:
- https://thehackernews.com/2026/11/hackers-exploited-cvss-100-hexpm-rce.html
- https://attack.mitre.org/techniques/T1059/004/
author: Security Arsenal
date: 2026/11/04
tags:
- attack.execution
- attack.t1059.004
logsource:
category: process_creation
product: linux
detection:
selection_parent:
ParentImage|endswith:
- '/beam.smp'
- '/beam'
- '/beam.smp.exe'
selection_child:
Image|endswith:
- '/sh'
- '/bash'
- '/dash'
- '/zsh'
- '/python'
- '/python3'
- '/perl'
condition: selection_parent and selection_child
falsepositives:
- Deployment or release tasks that legitimately shell out from the BEAM node (review and baseline per host)
- Observer/debug tooling during active troubleshooting windows
level: high
---
title: Post-Exploitation Reconnaissance from Elixir/Erlang Service Account
description: Detects common first-hour reconnaissance and egress tooling (id, whoami, curl, wget, nc) executed under the service account running an Elixir/Erlang application — consistent with attacker activity following the Hex.pm RCE.
id: 8b1d5e42-3c7f-4a9e-b264-5d0a1c8e93f7
status: experimental
references:
- https://thehackernews.com/2026/11/hackers-exploited-cvss-100-hexpm-rce.html
- https://attack.mitre.org/techniques/T1033/
- https://attack.mitre.org/techniques/T1105/
author: Security Arsenal
date: 2026/11/04
tags:
- attack.discovery
- attack.t1033
- attack.command_and_control
- attack.t1105
logsource:
category: process_creation
product: linux
detection:
selection_user:
User|contains:
- 'hex'
- 'elixir'
- 'erlang'
- 'beam'
- 'app'
- 'www-data'
selection_tools:
Image|endswith:
- '/id'
- '/whoami'
- '/curl'
- '/wget'
- '/nc'
- '/ncat'
- '/nmap'
condition: selection_user and selection_tools
falsepositives:
- Health checks or startup scripts running under the application service account (tune User list to your deployment account)
- Outbound package fetch tooling if co-located on the app host
level: medium
---
title: Command Injection Patterns in Web Server Access Logs
description: Detects classic shell metacharacter injection attempts in HTTP request lines targeting web applications — the likely delivery vector for the Hex.pm command execution flaw.
id: 2c4e7a19-6f83-4b5d-9e1a-7f3c8d02b456
status: experimental
references:
- https://thehackernews.com/2026/11/hackers-exploited-cvss-100-hexpm-rce.html
- https://attack.mitre.org/techniques/T1190/
author: Security Arsenal
date: 2026/11/04
tags:
- attack.initial_access
- attack.t1190
logsource:
category: webserver
product: linux
detection:
selection:
c-uri|contains:
- '%3B'
- '%7C'
- '%60'
- '%24%28'
- '%26%26'
- ';id'
- '|id'
- '$(id'
- '%3Bid'
condition: selection
falsepositives:
- URL-encoded semicolons or pipes in legitimate query parameters (rare in package registry API paths; tune per application)
level: medium
KQL — Microsoft Sentinel / Defender
This query hunts process creation telemetry (from Defender for Endpoint on Linux, or Syslog/auditd ingestion) for BEAM processes spawning shells and for reconnaissance tooling under application service accounts. It works even for pure-Linux estates assuming you're forwarding auditd or EDR telemetry into Sentinel.
// Hunt: BEAM VM or Elixir/Erlang service accounts spawning shells/recon tooling
// Relevant to Hex.pm CVSS 10.0 RCE exploitation pattern
let ReconTools = dynamic(["/bin/sh", "/bin/bash", "/bin/dash", "/usr/bin/id",
"/usr/bin/whoami", "/usr/bin/curl", "/usr/bin/wget",
"/bin/nc", "/usr/bin/ncat", "/usr/bin/python3"]);
let BeamParents = dynamic(["beam.smp", "beam", "erl_child_setup"]);
union isfuzzy=true
(DeviceProcessEvents
| where TimeGenerated > ago(14d)
| where InitiatingProcessFileName in~ (BeamParents)
| where FileName in~ ("sh","bash","dash","zsh","python","python3","perl","curl","wget","nc","id","whoami")
| project TimeGenerated, DeviceName, AccountName, InitiatingProcessFileName,
InitiatingProcessCommandLine, FileName, ProcessCommandLine, SHA256),
(Syslog
| where TimeGenerated > ago(14d)
| where SyslogMessage has_any ("beam.smp", "erl_child_setup")
| where SyslogMessage has_any ("/bin/sh", "/bin/bash", "/usr/bin/curl", "/usr/bin/wget", "$(", ";id", "|sh")
| project TimeGenerated, HostName, ProcessName, SyslogMessage)
)
| order by TimeGenerated asc
A second, complementary hunt for outbound connections from registry/application servers to unusual destinations — the follow-on behavior once an attacker has a shell:
// Hunt: Unexpected outbound connections from Elixir/Erlang app hosts
let KnownGoodRemotePorts = dynamic([443, 80, 5432, 6379]); // tune to your stack
DeviceNetworkEvents
| where TimeGenerated > ago(14d)
| where InitiatingProcessFileName in~ ("beam.smp", "beam", "sh", "bash")
| where RemotePort !in (KnownGoodRemotePorts)
| where RemoteIPType == "Public"
| summarize ConnectionCount = count(),
FirstSeen = min(TimeGenerated),
LastSeen = max(TimeGenerated),
Processes = make_set(InitiatingProcessFileName)
by DeviceName, RemoteIP, RemotePort
| order by FirstSeen asc
Velociraptor VQL
Use this artifact for live triage of Elixir/Erlang hosts when you suspect injection — it surfaces any BEAM process tree with shell or tooling descendants, plus recent child process ancestry:
-- Hunt: BEAM VM child processes indicating command injection
-- Deploy across Elixir/Erlang application and build hosts
SELECT Pid,
Ppid,
Name,
Exe,
CommandLine,
Username,
CreateTime
FROM pslist()
WHERE CommandLine =~ '(sh|bash|dash|curl|wget|ncat|/nc |python|perl|whoami|/id$)'
AND (
Ppid IN (SELECT Pid FROM pslist() WHERE Name =~ 'beam')
OR Username =~ '(hex|elixir|erlang|app|www-data)'
)
ORDER BY CreateTime
Complementary artifact — enumerate outbound sockets held by BEAM processes to catch an active egress channel:
-- Hunt: Network connections owned by BEAM processes
SELECT Pid,
Name,
Status,
"Laddr.IP" AS LocalIP,
"Laddr.Port" AS LocalPort,
"Raddr.IP" AS RemoteIP,
"Raddr.Port" AS RemotePort
FROM netstat()
WHERE Name =~ 'beam'
AND Status =~ 'ESTABLISHED'
ORDER BY RemoteIP
Remediation & Verification Script (Bash)
The script below serves two purposes: (1) on your own Elixir/Erlang hosts, it snapshots suspicious BEAM child processes and outbound connections for triage; (2) on build/dev machines, it audits the dependency supply chain by diffing your current mix.lock against Hex metadata and flagging packages that changed recently — the window-of-compromise check every Elixir shop should run this week.
#!/usr/bin/env bash
# hex_rce_triage.sh — Triage Elixir/Erlang hosts for command-injection artifacts
# and audit Hex dependency integrity. Run as root or via sudo on app/build hosts.
set -euo pipefail
REPORT="/tmp/hex_triage_$(date +%Y%m%d_%H%M%S).log"
echo "=== [1] BEAM processes and their children ===" | tee -a "$REPORT"
for pid in $(pgrep -f 'beam' || true); do
echo "--- BEAM pid $pid ---" | tee -a "$REPORT"
ps --ppid "$pid" -o pid,ppid,user,comm,args 2>/dev/null | tee -a "$REPORT" || true
done
echo "=== [2] Suspicious shells/tools under app service accounts ===" | tee -a "$REPORT"
ps -eo user,pid,ppid,comm,args | \
grep -Ei '^(hex|elixir|erlang|app|www-data)\s' | \
grep -E '(sh|bash|dash|curl|wget|nc|ncat|python|perl|whoami|/id$)' | \
tee -a "$REPORT" || echo "[+] None found" | tee -a "$REPORT"
echo "=== [3] Outbound connections from BEAM processes ===" | tee -a "$REPORT"
ss -tupn 2>/dev/null | grep -i 'beam' | tee -a "$REPORT" || echo "[+] None" | tee -a "$REPORT"
echo "=== [4] Mix dependency audit (run in each project root) ===" | tee -a "$REPORT"
# Requires mix.hex_audit or: mix archive.install hex hex_audit --force
if command -v mix >/dev/null 2>&1; then
echo "[*] Checking for retired/vulnerable Hex packages..." | tee -a "$REPORT"
mix hex.audit 2>&1 | tee -a "$REPORT" || echo "[!] hex_audit not installed: mix archive.install hex hex_audit" | tee -a "$REPORT"
echo "[*] Verifying lockfile integrity against registry..." | tee -a "$REPORT"
mix deps.get --check-locked 2>&1 | tee -a "$REPORT" || true
else
echo "[!] mix not found on this host (not a build node)" | tee -a "$REPORT"
fi
echo "=== [5] Recently modified packages in deps/ (last 7 days) ===" | tee -a "$REPORT"
find ./deps -type f -mtime -7 2>/dev/null | head -50 | tee -a "$REPORT" || true
echo "[+] Triage complete: $REPORT"
Critical integrity step: compare your current mix.lock against a copy from source control committed before the incident window. Any dependency whose checksum changed without a corresponding, explainable version bump is a red flag requiring investigation:
# Diff lockfiles — any unexplained checksum change is a supply-chain red flag
git log --oneline --since="2026-10-01" -- mix.lock
git diff <pre-incident-commit> HEAD -- mix.lock
# For Erlang/rebar3 projects
rebar3 hex audit 2>/dev/null || echo "Check rebar.lock against SCM history"
git diff <pre-incident-commit> HEAD -- rebar.lock
Remediation
1. Treat this as a supply chain incident, not just a vendor advisory.
- Pull your
mix.lock/rebar.lockhistory from version control. Diff every dependency checksum against the state before the disclosure window. Unexplained changes → rebuild from a known-good lockfile, from clean caches (rm -rf deps _build ~/.hex), and investigate. - Run
mix hex.audit(install viamix archive.install hex hex_audit) across every project in CI. Fail builds on retired or flagged packages. - Rotate any Hex publisher API keys you hold (
mix hex.user revoke --allthen re-authenticate), especially CI/CD publish tokens. Assume publisher credentials touching the registry during the window could be exposed.
2. Patch and monitor vendor guidance.
- The Hex team deployed fixes within ~15 minutes of first exploitation — the registry itself is patched. Monitor hex.pm/blog and the Hex GitHub organization for the formal post-mortem and CVE assignment; if you self-host a Hex mirror or run the open-source Hex server components privately, update immediately when the fixed commit is published.
3. Audit your own Elixir/Erlang applications for the same bug class.
- Grep your codebase for dangerous sinks:
System.cmd,:os.cmd,Port.openwith:spawnof shell strings, and any place user-controlled input (package names, query params, uploaded filenames) reaches them without strict allowlisting and argument separation. - Prefer
System.cmd/3with an explicit argument list over any string-interpolated shell invocation. Never pass user input through a shell. - If you unpack archives server-side, validate every entry path against traversal (
.., absolute paths, symlinks) before extraction.
4. Deploy the detections above and baseline BEAM behavior.
- The BEAM-spawns-a-shell signal is near-zero false positive in production. Alert on it at high severity. Baseline the handful of legitimate cases (release scripts, observer tooling) explicitly.
5. Harden the pipeline structurally.
- Pin dependencies by checksum, mirror critical packages into an internal repository (self-hosted Hex mirror or artifact proxy), and gate promotion through review.
- Enforce signed commits/tags for your own publishes and enable 2FA on all Hex publisher accounts.
- Add dependency-diff review to your change management for any lockfile modification — lockfile changes should never ride along silently in unrelated PRs.
6. Incident response posture.
- If your builds fetched dependencies from Hex during the exploitation window and you cannot verify checksum stability, assume potential compromise: rebuild affected artifacts, review for unexpected network egress from build agents, and check application binaries for unexpected modules or native code.
The Hex team's 15-minute patch cycle is the gold standard — but the lesson for the rest of us is that a CVSS 10.0 bug can live in production for a decade before the wrong person finds it. Detection depth on your own BEAM workloads and lockfile integrity discipline are what stand between this disclosure and your own incident.
Related Resources
Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub
Is your security operations ready?
Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.