T09 · Insecure Skill Coding Practices
- Location
SKILL.md:30- Finding
Insecure Erlang Distribution Cookie Handling Enables Unauthorized Cluster Access
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:30-31,SKILL.md:57,SKILL.md:69, andSKILL.md:411
Vulnerability Type: Hardcoded, command-line-exposed, and unnecessarily disclosed authentication secret
Risk Level: MediumVulnerable Code
erlang %% erl -name node1@hostname -setcookie secret %% erl -sname node2 -setcookie secreterlang %% Node configuration start_distributed() -> {ok, _} = net_kernel:start([mynode, shortnames]), erlang:set_cookie(node(), secret_cookie).erlang %% Get node information node_info() -> #{ name => node(), cookie => erlang:get_cookie(), nodes => nodes(), alive => is_alive() }.markdown 2. **Set same cookie** on all nodes in trusted cluster for securityTechnical Analysis
Erlang distribution cookies are shared authentication secrets used when nodes establish distributed connections. The examples use predictable literals such as
secretandsecret_cookie, encourage passing a cookie through the command line, and expose the active cookie through the general-purposenode_info/0result.Hardcoded or predictable cookies are vulnerable to guessing and accidental reuse. Command-line cookies may be recorded in shell history, deployment logs, diagnostic output, or process metadata available to other users on the host. Returning the cookie from
node_info/0also creates unnecessary opportunities for disclosure through logs, monitoring systems, debugging output, or callers of that function.A distribution cookie authenticates a node but does not provide fine-grained authorization for individual distributed operations. If an attacker acquires the cookie and can reach the Erlang distribution ports, the attacker may be able to join the trusted node mesh and invoke distributed functionality. The Skill explicitly documents remote spawning and RPC operations, including:
er ...[truncated 2373 chars]- Remediation
View remediation
Remediation Suggestions
- Replace all literal cookies with explicit placeholders and state that production cookies must be generated using a cryptographically secure random source with sufficient entropy.
- Do not pass cookies directly through
-setcookie, because command-line arguments and shell history may expose them. Provision the cookie through a protected.erlang.cookiefile or an appropriately secured secret-management mechanism. - Restrict the cookie file to the Erlang runtime account and enforce owner-only permissions, normally mode
0600. - Remove
cookie => erlang:get_cookie()fromnode_info/0. Authentication secrets must never be included in routine status maps, logs, metrics, exception reports, or monitoring output. - Use separate cookies for separate environments and trust domains. Do not reuse development, staging, and production credentials.
- Establish a documented cookie-rotation and incident-response procedure. Rotate the shared credential immediately if it appears in logs, source control, process output, or unauthorized systems.
- Restrict EPMD and Erlang distribution ports with host firewalls, security groups, private networks, and explicit node allowlists. Distribution services should not be exposed directly to the public internet.
- Configure TLS-protected Erlang distribution when communication crosses host or network trust boundaries, including proper certificate validation.
- Update the best-practice section to explain that a cookie is a shared authentication secret, not a complete security boundary or fine-grained authorization mechanism.
- Add a secure example such as:
erlang node_info() -> #{ name => node(), nodes => nodes(), alive => is_alive() }.The startup documentation should refer to a securely provisioned cookie file rather than embedding or displaying a concrete cookie value.
