Back to skill

Security audit

Sigil Nostr — P2P Encrypted Messaging for AI Agents

Security checks for vulnerabilities and agentic risk

Overview

The skill is purpose-related but needs Review because it overstates its working bridge behavior and includes under-scoped key handling, mutable install instructions, and a dormant unsafe Hermes command path.

Review before installing. Use a pinned, reviewed Sigil CLI version, protect ~/.sigil private keys with restrictive permissions or encryption, avoid public sharing unless service mode is intended, and do not connect the Node Hermes route to remote messages without replacing shell command construction and narrowing agent tools.

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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
bridge.js:103
Finding

Shell Command Injection Through Hermes Message Routing

Content
View full analysis
!l.startsWith("session_id:")) .join("\n") .trim(); } catch (e) { return `(hermes error: ${e.message})`; } } ``` ### Technical Analysis The `message` value is placed directly into a command string passed to `execSync()`. Node.js executes string commands through a system shell. The implementation only adds backslashes before double quotes, which does not prevent shell evaluation inside double-quoted strings. For example, shell command substitutions such as `$(command)` and backtick expressions can still be evaluated. Depending on the shell and payload, newline and other metacharacter-based injection techniques may also be possible. The current reference implementation never calls `routeToAgent()`, so this path is dormant in the submitted version. However, it becomes directly exploitable if the function is connected to the advertised Nostr message-processing flow or otherwise called with attacker-controlled messages. ### Attack Path 1. The bridge is started with the `--hermes` option. 2. The advertised message-processing implementation is completed or otherwise connected to `routeToAgent()`. 3. An authorized Nostr sender submits a message containing shell command substitution, such as `$(id)` or a command that writes a file. 4. `routeToAgent()` interpolates the message into the `hermes chat` command. 5. `execSync()` invokes a shell. 6. The shell evaluates the injected expression before or while launching Hermes. 7. The in ...[truncated 733 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
bridge.js:58
Finding

Nostr Private Key Written Without Explicit Restrictive Permissions

Content
View full analysis
/dev/null", { encoding: "utf-8" }); const nsec = readFileSync(join(SIGIL_DIR, "user.key"), "utf-8").trim(); writeFileSync(keyFile, nsec); return nsec; } catch { console.log(" Note: Install sigil-cli for key generation"); console.log(" cargo install --git https://github.com/lmanchu/sigil sigil-cli"); process.exit(1); ``` ### Technical Analysis The bridge copies a Nostr secret key into `~/.sigil/.key` using `writeFileSync(keyFile, nsec)` without specifying a restrictive file mode. The resulting permissions depend on the process umask and the permissions of the containing directory. The `~/.sigil` directory is likewise created without explicitly requesting mode `0700`. Although many systems use a protective default umask, the code does not enforce that security assumption. Under a permissive umask or an incorrectly permissioned existing directory, another local user may be able to read the private key. The documentation states that the keypair is persistent and identifies the agent. Consequently, disclosure of the `nsec` is equivalent to disclosure of the agent's long-term identity credential. ### Attack Path 1. The bridge runs in an environment with a permissive umask or a pre-existing `~/.sigil` directory with weak permissions. 2. `loadOrCreateKey()` obtains the private key from `~/.sigil/user.key`. 3. The bridge writes the key to the agent key file without an explicit `0600` mode. 4. Another local user or compromised local process reads the exposed key file. 5. The attacker imports the stolen `nsec` into a N ...[truncated 690 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
bridge.js:29
Finding

Environment-Controlled Agent Name Permits Path Traversal

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:25
Finding

Installation Instructions Use an Unpinned Git Dependency

Content
View full analysis
Remediation
View remediation
\ sigil-cli ``` Prefer publishing and installing a versioned crate with a committed lockfile and documented checksum where the ecosystem supports it. Additional controls should include: - Reviewing the pinned source and all transitive dependencies. - Updating pins only through a controlled security-review process. - Using `--locked` when the project supplies a reviewed `Cargo.lock`. - Verifying release signatures or checksums. - Building in an isolated, least-privileged environment. - Keeping the pinned reference consistent across every instruction in `SKILL.md` and `bridge.js`. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description promises a working Nostr messaging gateway that can send and receive end-to-end encrypted messages and make the agent reachable from Nostr clients. However, this code explicitly states it is only a reference implementation and that the real bridge logic lives in a Rust example. In the supplied JavaScript, there is no live relay connection, no WebSocket event loop, no Nostr protocol implementation, and no encryption/decryption flow. While there are helper routines for key/access management and for forwarding messages to an HTTP gateway or Hermes CLI, those paths are never connected to an actual Nostr transport in this chunk. Therefore the description materially overstates the delivered functionality of the provided code.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill describes behaviors that require network access and interaction with local environment state, but it does not declare any explicit tool scope or permissions boundary. In agent ecosystems, missing permission declarations can cause operators to grant broader access than intended or prevent meaningful review of what the skill may do, especially since it creates keys on disk and connects to external relays.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill notes that it creates a persistent Nostr keypair under ~/.sigil but does not present this as a prominent security warning or explain the sensitivity of that private key. Users may run setup without understanding that compromise of the local file enables identity theft, message decryption, and impersonation of the agent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The instructions encourage sharing a QR code or sigil:// URI but do not clearly warn that doing so makes the agent reachable by anyone who obtains the identifier, potentially increasing spam, abuse, or unauthorized interaction depending on configuration. In a messaging gateway context, discoverability and inbound access are security-relevant and should be called out explicitly.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file presents itself as a working Nostr bridge that connects to relays, listens for encrypted messages, forwards them to an agent, and replies, but it does not implement any live Nostr networking or NIP-04 handling. This mismatch is dangerous because operators may deploy it believing they have a functioning secure messaging gateway, leading to insecure assumptions, broken monitoring, and accidental exposure if they later enable the broader execution paths without understanding the gap.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The top-level comments explicitly describe active bridge behaviors that the program never performs, which is a security-relevant form of deceptive functionality even if likely unintentional. In agent infrastructure, inaccurate claims about encrypted transport and message handling can cause users to trust a component's confidentiality and availability properties when those properties are absent.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Hermes mode shells out to hermes chat with broad tool scopes (clarify,delegation,browser), expanding the component from a narrow messaging gateway into a local agent launcher with potentially powerful capabilities. Because the message content is externally sourced and forwarded into that agent context, this increases the risk that remote senders can trigger sensitive local actions, browsing, or delegated operations beyond simple message relay.

Content

No source excerpt is available for this finding.