Back to skill

Security audit

SwarmRelay

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent messaging integration, but its setup and privacy model need review because it can run unpinned MCP code, persist credentials and keys, and weaken its end-to-end encryption claims in hosted mode.

Review this before installing. Prefer a pinned, reviewed MCP package version instead of `npx -y @swarmrelay/mcp`; avoid storing real API keys or private keys in plaintext config files unless you accept that local exposure risk; and use the local MCP path rather than hosted MCP if your threat model requires strict client-side end-to-end encryption.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T08 · Insecure Dependencies

Error
Location
SKILL.md:827
Finding

Unpinned Third-Party Package Is Automatically Retrieved and Executed

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 827–866
Vulnerability Type: T08: Insecure Dependencies
Risk Level: High

Vulnerable instructions:

bash
npm install -g @swarmrelay/mcp
# or run without installing
npx -y @swarmrelay/mcp
json
{
  "mcpServers": {
    "swarmrelay": {
      "command": "npx",
      "args": ["-y", "@swarmrelay/mcp"]
    }
  }
}
bash
claude mcp add swarmrelay -- npx -y @swarmrelay/mcp
json
{
  "mcpServers": {
    "swarmrelay": {
      "command": "npx",
      "args": ["-y", "@swarmrelay/mcp"]
    }
  }
}

Technical Analysis

The installation and MCP configuration instructions retrieve and execute @swarmrelay/mcp without pinning an exact package version or verifying an integrity hash or provenance signature. The npx -y option suppresses the normal confirmation prompt.

Because the reviewed project contains only SKILL.md, the source code, transitive dependencies, package lockfile, and lifecycle scripts of the executed package are outside the audited artifact. Its effective behavior can therefore change independently after this Skill has been reviewed.

Placing the unpinned npx command in persistent Claude Desktop or Cursor MCP configuration also causes subsequent client launches to invoke registry-selected package content. This creates a supply-chain execution boundary that is materially broader than the messaging functionality itself.

Attack Path

  1. An attacker compromises the package publisher account, npm package, or a transitive dependency.
  2. The attacker publishes a malicious version under the existing @swarmrelay/mcp package name.
  3. A user follows the documented npx -y @swarmrelay/mcp setup or has already added it to an MCP client configuration.
  4. The MCP host retrieves the currently selected package version without interactive confirmation.
  5. Package installation hooks ...[truncated 964 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin the dependency to an audited exact version, for example @swarmrelay/mcp@1.3.0, rather than relying on the latest registry-selected release.
  2. Publish and verify package integrity hashes or signed provenance before execution.
  3. Remove -y from the default instructions so that retrieval and execution require explicit confirmation.
  4. Prefer a locally installed, version-pinned binary in persistent MCP configuration instead of executing npx on every launch.
  5. Provide a lockfile or vendored, reviewable MCP implementation within the audited distribution.
  6. Audit transitive dependencies and package lifecycle scripts.
  7. Run the MCP server in a sandbox with minimal filesystem, environment-variable, and network access.
  8. Document a controlled upgrade process so package changes are reviewed before deployment.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:847
Finding

Automatic Persistence of API Credentials and Private Key Material

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 847 and 893–897
Vulnerability Type: T09: Insecure Skill Coding Practices
Risk Level: Medium

Documented credential-persistence behavior:

text
Restart Claude Desktop. On first run the server auto-registers a new SwarmRelay agent and writes credentials to `~/.config/swarmrelay/mcp.json`. Check the MCP logs for the printed claim URL and visit it to link the agent to a SwarmRelay account.
text
### Credentials precedence

1. Env vars: `SWARMRELAY_API_KEY`, `SWARMRELAY_API_URL`, `SWARMRELAY_PUBLIC_KEY`, `SWARMRELAY_PRIVATE_KEY`.
2. Config file: `~/.config/swarmrelay/mcp.json` (override with `SWARMRELAY_MCP_CONFIG` or `--config`).
3. Auto-register: calls `POST /api/v1/register`, stores the returned API key and keypair.

This conflicts with the earlier credential-handling requirements at lines 25–29 and 46–49:

text
Save the `apiKey` to the `SWARMRELAY_API_KEY` environment variable for all subsequent requests. Do NOT write the key to disk or any file without user consent.
text
The `SWARMRELAY_API_KEY` should be stored as an environment variable only, not written to disk

Technical Analysis

The general Skill instructions prohibit writing the API key to disk without user consent and state that it should be stored only in an environment variable. The MCP workflow nevertheless documents first-run automatic registration and persistence of both the API key and keypair in ~/.config/swarmrelay/mcp.json.

The Skill does not require an explicit persistence-consent step, owner-only file permissions, operating-system credential storage, encryption at rest, or validation that a user-supplied configuration path is secure. Persisting a private key and bearer token in a conventional configuration file expands secret exposure beyond the minimum privileges needed for an active messaging session.

An API bearer token may allow an ...[truncated 1539 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require explicit, informed user consent before registration or credential persistence.
  2. Default to session-only storage in memory or explicitly supplied environment variables.
  3. Store persistent secrets in the operating system's credential manager or keychain rather than a plaintext JSON file.
  4. If a file must be used, create it atomically with owner-only permissions and reject insecure existing files, directories, or symbolic links.
  5. Encrypt private keys at rest with a key that is not stored alongside the encrypted material.
  6. Separate non-sensitive configuration from bearer tokens and private keys.
  7. Validate custom paths supplied through SWARMRELAY_MCP_CONFIG and --config.
  8. Provide documented credential revocation, rotation, logout, and secure-deletion procedures.
  9. Reconcile the contradictory documentation so all setup paths follow the same consent and storage policy.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:935
Finding

Hosted MCP Mode Gives the Remote Service Access to Plaintext and Recoverable Private Keys

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 935–953
Vulnerability Type: T09: Insecure Skill Coding Practices
Risk Level: Medium

Vulnerable design description:

text
### Tool surface

Identical to the local `@swarmrelay/mcp` server — 25 tools across contacts, conversations, messages, and presence namespaces. See Module 6 for the full list.

### Encrypted DM note

`messages_send_encrypted_dm` works on the hosted endpoint. The server decrypts the agent's stored private key in memory, runs NaCl box, then drops the key — matches the web dashboard's decryption pattern. The agent key at rest is protected by `AGENT_KEY_ENCRYPTION_KEY`, and message ciphertext is the only thing stored.

If your threat model forbids any server-side key access, use the local `@swarmrelay/mcp` package instead.

Technical Analysis

The hosted messages_send_encrypted_dm operation performs encryption on the remote server. The hosted service consequently receives the plaintext submitted by the client and can decrypt the agent's stored private key in memory.

This architecture does not provide strict end-to-end encryption against the service operator or a compromised service process, even if only ciphertext is retained after processing. Encryption at rest using AGENT_KEY_ENCRYPTION_KEY does not remove this trust requirement because the live service must have access to both the encrypted key material and the key needed to recover it.

The limitation is disclosed at the end of the document, but it weakens the broader claims that all messages are end-to-end encrypted and that the server never handles plaintext. Server-side access to private keys also exceeds the privileges necessary for a design in which clients perform encryption locally.

Attack Path

  1. A user configures the hosted MCP endpoint and invokes messages_send_encrypted_dm.
  2. The client sends the plaintext message to the hosted SwarmRelay service ...[truncated 1321 chars]
Remediation
View remediation

Remediation Suggestions

  1. Make local client-side encryption the default and recommended mode.
  2. Do not transmit plaintext message content or recoverable private keys to the hosted service.
  3. Use a protocol in which the client obtains authenticated recipient public keys and generates ciphertext locally.
  4. Clearly distinguish strict end-to-end encryption from server-side encryption in all privacy and data-handling claims.
  5. Require explicit informed opt-in before enabling hosted server-side encryption.
  6. If hosted key processing must remain available, isolate it in a hardened key-management boundary such as an HSM or appropriately designed confidential-computing environment.
  7. Use per-agent key wrapping and strict access controls rather than relying on one broadly available application encryption key.
  8. Minimize plaintext and key lifetime in memory, disable sensitive logging and crash dumps, and implement key rotation and revocation.
  9. Document the hosted service trust model, operator-access assumptions, incident response process, and limitations of historical-message confidentiality.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (15)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

Remove contact

text
DELETE /api/v1/contacts/:id

Block agent

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

Leave conversation

text
DELETE /api/v1/conversations/:id

Add members to group (admin only)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

Remove member from group (admin only)

text
DELETE /api/v1/conversations/:id/members/:agentId

Response:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

Delete message

text
DELETE /api/v1/messages/:id

Response:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

md
- To fetch history: use `GET /api/v1/conversations/:id/messages` with pagination. Use the `after` parameter to fetch only new messages since the last known message ID.
- On receiving a message: send a read receipt with `POST /api/v1/messages/:id/receipts` to let the sender know the message was read.
- To edit a message: re-encrypt the updated content and call `PATCH /api/v1/messages/:id`. Only the original sender can edit.
- To delete a message: call `DELETE /api/v1/messages/:id`. This creates a soft-delete tombstone. Only the original sender can delete.

---

MCP Config Access

High
Category
Agent Snooping
Confidence
91% confidence
Finding

The skill explicitly writes credentials to ~/.config/swarmrelay/mcp.json, creating a sensitive local secret store accessible to the MCP host environment. In the context of agent tooling, config files are commonly readable by other local processes, backup systems, or users, so storing API keys and possibly key material there significantly increases the blast radius of local compromise.

Content

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

}

text

Restart Claude Desktop. On first run the server auto-registers a new SwarmRelay agent and writes credentials to `~/.config/swarmrelay/mcp.json`. Check the MCP logs for the printed claim URL and visit it to link the agent to a SwarmRelay account.

### Claude Code

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill markets the system as end-to-end encrypted, but the hosted MCP mode states that the server decrypts the agent's stored private key in memory and performs encryption for direct messages. That breaks strict end-to-end guarantees because the service can access key material and plaintext during processing, making the privacy claim materially misleading and expanding the server trust boundary.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The setup flow says not to write the API key to disk without user consent, but later sections describe automatic credential persistence. This inconsistency can cause agents or users to persist long-lived secrets locally without informed consent, increasing the chance of credential theft from config files, backups, or shared workstations.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The privacy section states the API key should be stored only as an environment variable, but later modules instruct saving credentials in config files. Contradictory secret-storage guidance weakens operator expectations and can lead to accidental persistence of sensitive credentials in files with broader exposure than intended.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The A2A section says authentication is optional while nearby endpoint documentation describes Ed25519 signature-based authentication. Conflicting security guidance leads implementers to omit request authentication, which can enable spoofed external-agent messages, forged task operations, or unauthorized relay usage.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

text
List all contacts or add a new contact by agent ID.

### Create a group
```bash
swarmrelay group create --name "Team" --members id1,id2

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

The skill instructs users to execute npx -y @swarmrelay/mcp without pinning a specific version. That causes whatever package version is current at execution time to be fetched and run, creating a supply-chain risk if a malicious or compromised release is published. In an agent skill, this is more dangerous because installation is presented as a routine setup step likely to be copied verbatim.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The MCP setup flow says the server auto-registers and writes credentials to ~/.config/swarmrelay/mcp.json without a clear warning in the same flow. Quiet persistence of long-lived credentials can surprise users and expose secrets through local compromise, backups, sync tools, or misconfigured file permissions.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

This is a second instance of the same unpinned npx execution pattern. Running an unversioned package directly from the registry allows silent code changes over time and increases exposure to registry compromise, maintainer compromise, or malicious dependency updates.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The hosted MCP examples place a bearer token directly into client configuration snippets without warning about secret handling. Users may paste real tokens into plaintext config files, shell history, screenshots, or shared repos, causing credential leakage and unauthorized access to the messaging account.

Content

No source excerpt is available for this finding.