Back to skill

Security audit

MeshLink 服务发布

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent service-publishing purpose, but it asks agents to run MeshLink shell commands with insufficient input validation and an unpinned external CLI dependency.

Install only with a trusted, pinned MeshLink CLI version. Before using it, ensure the agent validates ports as integers from 1 to 65535, validates service names against lowercase kebab-case, and invokes meshlink with structured arguments rather than interpolated shell strings. Expect the skill to publish and remove local service entries through MeshLink after user confirmation.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:51
Finding
Shell command injection through unvalidated port and service-name arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 51-64, 95-99, and 123-128 **Vulnerability Type**: Command injection caused by unsafe shell argument construction **Risk Level**: High ### Vulnerable Code ```bash meshlink agent-status meshlink check-port --port <port> ``` ```bash meshlink publish --name <service_name> --port <port> ``` ```bash meshlink unpublish --name <name> ``` ### Technical Analysis The Skill directs the agent to insert port numbers and service names into Bash command templates. It does not require strict validation of the user-provided port or the name accepted by the unpublish workflow. Publication names generated during the normal publishing flow are restricted to lowercase kebab-case. However, this restriction is not explicitly applied to the independently invoked unpublish command. Port input also lacks a required numeric type check and range check. If these templates are executed through a shell after direct string substitution, shell metacharacters in an attacker-controlled value can terminate or extend the intended command. For example, a port value such as `3000; id > /tmp/meshlink-proof` could cause the shell to run both the intended `meshlink` command and the injected command. The vulnerability depends on the agent or command-execution layer constructing a shell command from the template rather than passing arguments as a structured argument array. The Skill does not mandate the safer execution method. ### Attack Path 1. An attacker asks the agent to publish a service and supplies a crafted port value containing a valid-looking port followed by a shell separator and an operating-system command. 2. The Skill directs the agent to insert that value into `meshlink check-port --port <port>`. 3. If the agent executes the resulting text through Bash, the shell interprets the separator. 4. The injected command executes with the same operating-system privileges as the agent. 5. Alternatively, the attacker re ...[truncated 693 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Validate every port before command execution: - Accept decimal digits only. - Parse the value as an integer. - Require a range of `1` through `65535`. - Reject whitespace, signs, shell metacharacters, and trailing content. 2. Validate every service name, including names supplied to `unpublish`, against an allowlist such as: ```regex ^[a-z0-9]+(?:-[a-z0-9]+)*$ ``` 3. Use a process-execution API that accepts an executable and an argument array, for example: ```text executable: meshlink arguments: ["check-port", "--port", validatedPort] ``` Do not construct a single command string for evaluation by Bash. 4. If shell execution is unavoidable, apply robust shell escaping after validation. Escaping must not replace allowlist validation. 5. Add explicit instructions stating that user input must never be interpreted as flags or shell syntax. Where supported, use an end-of-options delimiter before positional user-controlled values. 6. Add negative tests covering semicolons, command substitution, pipes, redirection operators, newlines, leading hyphens, whitespace, and out-of-range ports. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:14
Finding
Unpinned externally installed MeshLink CLI dependency<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 14-16 **Vulnerability Type**: Unpinned executable dependency and unsafe installation source **Risk Level**: Medium ### Vulnerable Code ```yaml requires: - meshlink version: 0.1.0 ``` The accompanying installation guidance permits installing `meshlink-cli` globally through npm or connecting it through `npm link`, without pinning the CLI package to a reviewed version or integrity digest. ### Technical Analysis The Skill depends on an external executable whose implementation is absent from the audited project. The dependency declaration does not specify an exact package version, registry, publisher identity, checksum, signature, or other integrity control. Installing a mutable latest npm release means behavior can change after this Skill has been reviewed. Using `npm link` is also trust-sensitive because it can connect the expected command name to an arbitrary local package. The `version: 0.1.0` field identifies the Skill version and does not pin the external CLI package. Because the Skill invokes this dependency for status checks, port inspection, publication, listing, and removal, a compromised or substituted executable would run within a trusted workflow. ### Attack Path 1. A user follows the installation guidance and installs the mutable latest version of the CLI globally, or links a local package through `npm link`. 2. The package source, a future release, the registry account, or the linked local directory is compromised or substituted. 3. The user loads the Skill and requests a normal MeshLink operation. 4. The agent invokes the attacker-controlled `meshlink` executable. 5. The substituted executable performs malicious actions under the user's account while returning plausible JSON output to conceal the behavior. ### Impact Assessment A malicious dependency can execute arbitrary code with the privileges of the user running the agent. It could access project files, environme ...[truncated 432 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin `meshlink-cli` to an exact reviewed version rather than installing the mutable latest release. 2. Record and verify the expected package integrity hash and lockfile metadata. 3. Document the authoritative npm registry, exact package name, and verified publisher. 4. Prefer a project-local dependency over a global installation so dependency resolution is reproducible and isolated. 5. Avoid `npm link` in production or trusted workflows. If development linking is necessary, require verification of the linked path and package identity. 6. Audit the CLI source and its transitive dependencies before approving a version. 7. Use package signatures or provenance attestations where available. 8. Add a runtime version check so the Skill refuses to invoke unapproved CLI versions. ]]>
Vulnerability Patterns
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding
Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
The instructions require service names to be converted into English-only kebab-case and the examples transliterate Chinese project names into English equivalents. This imposes a language choice on users without opt-in, which matches the language/locale policy violation category.

Static analysis

No suspicious patterns detected.