Repository navigation
fix: harden the Gossip strategy, introduce new AuthenticatedGossip strategy - #226
Merged
Merged
Conversation
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
force-pushed
the
gossip-hardening
branch
from
November 25, 2026 19:11
5b81310 to
2c8944c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.