Skip to content

fix: harden the Gossip strategy, introduce new AuthenticatedGossip strategy - #226

Merged
bitwalker merged 4 commits into
mainfrom
gossip-hardening
Nov 25, 2026
Merged

bitwalker merged 4 commits into
mainfrom
gossip-hardening

Conversation

@bitwalker

Copy link
Copy Markdown
Owner

This address some known issues with use of the Gossip strategy in untrusted networks, and introduces the AuthenticatedGossip strategy as the new recommended strategy to use in those environments, leaving Gossip for use in trusted networks.

Received heartbeats were passed to binary_to_term without the safe option,
so anyone able to reach the gossip port could name thousands of new atoms
in one datagram and exhaust the atom table, aborting the VM. With a secret
the same was possible one atom per datagram by replacing ciphertext blocks
of a recorded heartbeat, because the encryption is not authenticated.

Match the payload against the exact external-term encoding of the
heartbeat map instead, accept only name@host node names, and create at
most max_new_node_names atoms per strategy process for names the VM has
not seen. The safe option is not usable here: a newly discovered node name
is an atom the receiver may not have yet. The wire format is unchanged.
Extract the bind, multicast and per-platform port-sharing options from
Cluster.Strategy.Gossip into Cluster.Strategy.Gossip.Socket so a second
gossip strategy can open the same kind of socket without duplicating the
Windows and BSD handling. Gossip behaves as before.
Gossip cannot tell a genuine announcement from a made-up one without
connecting, so on a network where other hosts can reach the port it can be
made to create atoms, block on connection attempts to unreachable hosts
and queue datagrams without bound. Add a separate strategy rather than
change Gossip, so existing clusters need no rollout and Gossip stays
simple for trusted networks.

Heartbeats are sealed with AES-256-GCM under a key derived from the
secret, or from the Erlang cookie when none is configured, and carry a
timestamp. Forged, altered, stale and replayed heartbeats are dropped
before anything is parsed. The socket is read one datagram at a time so a
flood stays in the kernel buffer, and connection attempts run outside the
receive loop with one in flight per node.
@bitwalker
bitwalker merged commit 2c8944c into main Nov 25, 2026
7 checks passed
@bitwalker
bitwalker deleted the gossip-hardening branch November 25, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant