Node hijack: POST /cluster/heartbeat allows any authed user to overwrite primary node's api_url #106
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixed in
04ce096. Migration 019 addsapi_tokens.bound_hostname. Auth middleware exposes it asreq.tokenBoundHostname.POST /cluster/heartbeatrejects with 403 when the body hostname doesn't match the bound hostname; tokens without a binding can only post heartbeats if the caller is an admin user. Token-create endpoint acceptsbound_hostnamefor issuing node-agent credentials.zgaetano referenced this issue2026-05-26 18:22:49 -04:00
Fix Plan — #106 Node hijack via POST /cluster/heartbeat
Root cause:
cluster.js:102-147is behindrequireAuth(any authed user, including editor). Accepts arbitraryhostname+api_url. UsesON CONFLICT (hostname) DO UPDATE— any user can overwrite any node row. Downstream,resolveNodeTarget()inrecorders.js:51reads hijackedapi_urland forwards recorder traffic to attacker host.Fix:
/heartbeatoff JWT auth to internal-only with cluster secret:Set
CLUSTER_SECRETin.envon mam-api and all node-agents.Update node-agent heartbeat call to send
x-cluster-secretheader.Ignore non-whitelisted fields — only accept
hostname,api_url,gpu_count,bmd_count,capacity_score,version.Files:
src/routes/cluster.js,services/node-agent/index.js,.envEffort: ~2h
**Priority: P0 — security