Back to skill

Security audit

图表工具免费版

Security checks for vulnerabilities and agentic risk

Overview

This Mermaid diagram skill is mostly coherent, but it gives a command-capable agent overly broad triggers and uses an unpinned npm execution path.

Install only if you need Mermaid diagram generation and optional PNG export. Restrict use to explicit Mermaid diagram or export requests, approve any npm/npx execution first, prefer a pinned Mermaid CLI version, avoid global installation where possible, and do not treat the broad API, network, file-processing, or analytics language as permission to expand the skill's scope.

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

T08 · Insecure Dependencies

Warning
Location
SKILL.md:122
Finding

Unpinned npm Package Is Downloaded and Executed Automatically

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 122
Vulnerability Type: Supply-chain risk caused by dynamic execution of an unpinned dependency
Risk Level: Medium

Vulnerable Code

bash
npx -y @mermaid-js/mermaid-cli mmdc -i diagram.mmd -o diagram.png -b transparent

A related installation instruction appears at SKILL.md, line 232:

text
| Mermaid CLI | npm package | Optional | `npm i -g @mermaid-js/mermaid-cli` |

Technical Analysis

The documented PNG export procedure invokes npx with the -y option and does not specify an exact package version or verify package integrity. As a result, npm can resolve, download, install, and execute a mutable package release and its transitive dependencies without an interactive confirmation step.

The package name is consistent with the Skill's declared diagram-rendering purpose, and there is no evidence that the package itself is malicious. Nevertheless, the execution model creates a supply-chain trust boundary: code executed during installation or rendering is retrieved from an external npm registry and is not included in the audited project. The effective executable payload can therefore change after this Skill has been reviewed.

The global installation alternative has the same lack of version pinning and additionally places the package in a shared environment, potentially affecting later executions.

Attack Path

  1. A user asks the agent to export a Mermaid diagram as PNG.
  2. The agent follows the documented command and invokes npx -y @mermaid-js/mermaid-cli.
  3. npm resolves the package and its transitive dependencies from the configured registry without requiring confirmation.
  4. A compromised release, registry account, registry endpoint, or transitive dependency supplies attacker-controlled installation or runtime code.
  5. npm executes that code with the operating-system privileges and environment available to the agent process.
  6. The malicious dependency can acce ...[truncated 717 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin Mermaid CLI to a reviewed, exact version rather than resolving the latest available release:

    bash
    npx --yes --package=@mermaid-js/mermaid-cli@<audited-exact-version> mmdc -i diagram.mmd -o diagram.png -b transparent
    
  2. Prefer declaring the dependency in package.json, committing a lockfile, and installing it through a reproducible workflow such as npm ci.

  3. Verify lockfile integrity metadata and use a trusted, explicitly configured npm registry.

  4. Separate dependency installation from normal Skill execution. Require explicit user or administrator approval before downloading executable packages.

  5. Run Mermaid rendering in an isolated sandbox or container with:

    • No unnecessary secrets or credentials
    • Read-only access to unrelated project files
    • A dedicated temporary output directory
    • Restricted outbound network access
    • No elevated operating-system privileges
  6. Avoid global package installation. A project-local, version-locked dependency reduces shared-environment impact and improves reproducibility.

  7. Regularly review the pinned package and transitive dependency tree for published vulnerabilities before upgrading.

Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

Vague Triggers

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger language is overly broad, including data analysis, reporting, statistics, and visualization, which extends well beyond Mermaid diagram generation. Overbroad triggers are dangerous because they can cause the agent to auto-select this skill in unrelated tasks, granting exec access where it is not necessary.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documented activation condition is vague and lacks concrete boundaries, making it easy for the agent to invoke the skill for loosely related requests. In a skill with exec permission, ambiguous activation materially increases risk by broadening when command-capable behavior may be selected.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest presents a narrow Mermaid diagram skill, but the body expands its scope to broad data analysis, reporting, file handling, API integration, and command execution. This scope drift is dangerous because it can cause the agent to invoke the skill in contexts far beyond diagram generation, increasing exposure to unnecessary tools and behaviors.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The description explicitly states '支持中文交互', and the rest of the document is written as if Chinese is the expected interaction mode, but it does not offer an opt-in language choice. This can constitute a language/locale policy issue because the skill appears to privilege a specific language without documenting user selection or a region-specific requirement.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding

The skill instructs use of npx -y @mermaid-js/mermaid-cli without pinning a specific package version, which makes execution dependent on the latest registry state at runtime. This creates a supply-chain risk: a compromised upstream release or dependency could cause unexpected code execution when the agent follows the documented export path.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation simultaneously states that no extra API key or external API calls are needed, while elsewhere advertising API integration and HTTPS communication as core capabilities. Contradictory trust-boundary statements are dangerous because they obscure when network access may occur, undermining safe policy enforcement and informed operator review.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Claiming external API integration and generic information retrieval in a skill meant for local diagram generation introduces unjustified operational breadth. Such claims can normalize network access or broader tool use, making it easier for an agent to perform actions outside the intended trust boundary.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The error-handling and security sections introduce HTTPS usage and ping-based connectivity testing even though the skill elsewhere says PNG export is local and requires no external API. This inconsistency is risky because it encourages unnecessary network-oriented behavior, expanding the skill's effective attack surface and confusing operators about expected isolation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.