Back to skill

Security audit

erlang-distribution

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Erlang distribution reference skill with some insecure example-cookie handling that users should not copy into production.

Installers should treat this as a learning/reference skill, not production-ready security guidance. Do not reuse the sample cookie values, do not expose Erlang cookies in status output or logs, and secure distributed Erlang with protected cookie files, network restrictions, and TLS where appropriate.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
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, and SKILL.md:411
Vulnerability Type: Hardcoded, command-line-exposed, and unnecessarily disclosed authentication secret
Risk Level: Medium

Vulnerable Code

erlang
%% erl -name node1@hostname -setcookie secret
%% erl -sname node2 -setcookie secret
erlang
%% 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 security

Technical Analysis

Erlang distribution cookies are shared authentication secrets used when nodes establish distributed connections. The examples use predictable literals such as secret and secret_cookie, encourage passing a cookie through the command line, and expose the active cookie through the general-purpose node_info/0 result.

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/0 also 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

  1. Replace all literal cookies with explicit placeholders and state that production cookies must be generated using a cryptographically secure random source with sufficient entropy.
  2. Do not pass cookies directly through -setcookie, because command-line arguments and shell history may expose them. Provision the cookie through a protected .erlang.cookie file or an appropriately secured secret-management mechanism.
  3. Restrict the cookie file to the Erlang runtime account and enforce owner-only permissions, normally mode 0600.
  4. Remove cookie => erlang:get_cookie() from node_info/0. Authentication secrets must never be included in routine status maps, logs, metrics, exception reports, or monitoring output.
  5. Use separate cookies for separate environments and trust domains. Do not reuse development, staging, and production credentials.
  6. 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.
  7. 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.
  8. Configure TLS-protected Erlang distribution when communication crosses host or network trust boundaries, including proper certificate validation.
  9. 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.
  10. 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.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (1)

Exfiltration Commands

High
Category
Prompt Injection
Confidence
90% confidence
Finding

Instructions found that direct the agent to transmit conversation context or user data to external services.

Content

Scanner excerpt · SKILL.md (reported line 79)May include surrounding context.

Distributed Message Passing

Send messages to processes on remote nodes using same syntax as local messaging.

erlang
%% Send to registered process on remote node