Back to skill

Security audit

Mermaid文档生成服务

Security checks for vulnerabilities and agentic risk

Overview

This skill appears to advertise Mermaid documentation while its code handles unrelated XiaoBenYang/Gaokao API credentials and generic outbound tool calls, so it should be reviewed carefully before installation.

Do not install this as a Mermaid documentation skill unless the publisher explains the XiaoBenYang/Gaokao API dependency, removes or clearly scopes XBY_APIKEY handling, avoids silent .env credential persistence, and narrows outbound calls to documented Mermaid-only operations.

Vulnerability Patterns
  • 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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (20)

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill declares no permissions while its documented behavior includes reading environment variables, writing files, and making network calls. This undermines transparency and consent because a user or platform may approve the skill believing it is low-risk when it can actually persist secrets and contact external services.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The skill claims to be a Mermaid documentation service but instructs the model to obtain and persist an API key, call an unrelated external XiaoBenYang service, and references gaokao/school-search tooling. This mismatch is dangerous because it can trick users into providing secrets and approving external data flows unrelated to the advertised purpose.

Intent-Code Divergence

Medium
Confidence
90% confidence
Finding
The documentation mixes a Mermaid service identity with project/workflow references to gaokao or school-search tooling, indicating copy-paste contamination or misdirection. In security terms, inconsistent operational instructions make it easier to hide unrelated behavior and harder for reviewers and users to understand what the skill will actually do.

Intent-Code Divergence

Medium
Confidence
82% confidence
Finding
The skill advertises a capability to list available diagrams, but the documented tools only support retrieving documentation for a specific diagram. This is a security-relevant integrity issue because overstated capabilities can conceal the true scope of behavior and reduce user trust in the rest of the specification.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The file implements a generic upstream MCP tool invoker that accepts arbitrary mcp_id, tool_name, and params, which is broader than a Mermaid documentation service would reasonably need. This capability expands the skill's effective behavior beyond its declared purpose and can enable undisclosed external actions or data transmission if exposed through higher-level interfaces.

Context-Inappropriate Capability

Medium
Confidence
89% confidence
Finding
The code provides a generic outbound API execution path by letting callers choose the remote function via the func header and send arbitrary serialized parameters. In the context of a skill advertised as Mermaid documentation generation, this unjustified generality increases the risk of hidden functionality, data exfiltration, or misuse of trusted credentials against external services.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The file for a Mermaid documentation service is wired to a different Xiaobenyang/Gaokao service and handles a separate XBY_APIKEY credential. This creates a cross-skill secret confusion issue: users or the host may supply or persist an unrelated API key, causing unintended credential collection, misuse, or exfiltration risk if this package is distributed as a Mermaid-related tool.

Intent-Code Divergence

Medium
Confidence
91% confidence
Finding
The comments and configuration metadata are inconsistent with the advertised skill purpose, while the code explicitly reads a different credential source. Misleading documentation around secret handling is security-relevant because it can cause operators to provide sensitive credentials under false assumptions and obscures review of what the code actually accesses.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The code persists the provided API key into a local .env file without any user-facing notice, consent flow, or security controls. Silent credential persistence increases the chance of accidental disclosure through source control, backups, logs, workspace sharing, or later reuse by unrelated components on the same host.

Credential Access

High
Category
Privilege Escalation
Content
default_year: int = 2025

    def model_post_init(self, __context):
        # 强制从 .env 文件读取 XBY_APIKEY
        env_path = Path(".env")
        if env_path.exists():
            content = env_path.read_text(encoding="utf-8")
Confidence
93% confidence
Finding
The code explicitly opens and parses .env to force-read XBY_APIKEY, bypassing normal scoped settings expectations and targeting an unrelated credential for this skill. In the context of a Mermaid documentation service, this makes the secret access more suspicious and increases the risk of collecting or repurposing credentials that the user did not intend to share with this component.

Credential Access

High
Category
Privilege Escalation
Content
def model_post_init(self, __context):
        # 强制从 .env 文件读取 XBY_APIKEY
        env_path = Path(".env")
        if env_path.exists():
            content = env_path.read_text(encoding="utf-8")
            for line in content.splitlines():
Confidence
93% confidence
Finding
Checking for and reading .env directly to extract XBY_APIKEY is a concrete secret-access behavior unrelated to the advertised purpose of the skill. This broadens access to locally stored credentials and can mislead operators into exposing a Xiaobenyang/Gaokao API key inside an unrelated package.

Credential Access

High
Category
Privilege Escalation
Content
if line.startswith("XBY_APIKEY="):
                    self.api_key = line.split("=", 1)[1].strip()
                    break
        # 如果环境变量有值,覆盖 .env 的值
        env_val = os.getenv("XBY_APIKEY", "")
        if env_val:
            self.api_key = env_val
Confidence
90% confidence
Finding
Reading XBY_APIKEY from the environment is not inherently unsafe, but here it compounds the cross-service credential confusion by prioritizing an unrelated secret in a Mermaid-labeled skill. That can lead to accidental credential ingestion and use under false pretenses.

Credential Access

High
Category
Privilege Escalation
Content
def save_api_key_to_env(api_key: str) -> bool:
    """将API key保存到.env文件"""
    try:
        env_path = Path(".env")
        lines = []
        if env_path.exists():
            lines = env_path.read_text(encoding="utf-8").splitlines()
Confidence
95% confidence
Finding
The helper is explicitly designed to store an API key in .env, creating a persistent local credential store for an unrelated service inside this skill. In a redistributed agent skill, this is dangerous because secrets can be left on disk, committed accidentally, or consumed by other components without the user's awareness.

Credential Access

High
Category
Privilege Escalation
Content
def set_api_key(api_key: str) -> bool:
    """设置API key并持久化到.env"""
    if not api_key or not api_key.strip():
        return False
    api_key = api_key.strip()
Confidence
94% confidence
Finding
The API exposes a convenience method that both sets and persists the key to .env, normalizing long-term storage of a sensitive credential. Given the mismatch between the advertised Mermaid function and the actual Xiaobenyang credential handling, this increases the chance of unintentionally storing the wrong secret for the wrong component.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
97% confidence
Finding
The dependency is specified with a lower bound only (`requests>=2.31.0`), which permits future versions to be installed without review and also allows the currently vulnerable 2.31.0 release to satisfy the constraint. This weakens build reproducibility and can expose deployments to known or newly introduced supply-chain issues.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
92% confidence
Finding
`pydantic>=2.7.0` is unpinned, so builds are not reproducible and may unexpectedly consume future releases with breaking changes or security regressions. While no specific vulnerable version is identified here, permissive dependency ranges increase supply-chain risk.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
92% confidence
Finding
`pydantic-settings>=2.2.0` allows uncontrolled version drift, which can introduce unreviewed code changes into deployments. This is primarily a supply-chain hygiene issue rather than an immediate exploit path in this file alone.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
96% confidence
Finding
`python-dotenv>=1.0.1` is unpinned and permits installation of the specifically flagged vulnerable 1.0.1 release as well as other unreviewed future versions. This creates both reproducibility and dependency-security concerns.

Known Vulnerable Dependency: requests==2.31.0 — 5 advisory(ies): CVE-2024-47081 (Requests vulnerable to .netrc credentials leak via malicious URLs); CVE-2024-35195 (Requests `Session` object does not verify requests after making first request wi); CVE-2026-25645 (Requests has Insecure Temp File Reuse in its extract_zipped_paths() utility func) +2 more

Medium
Category
Supply Chain
Confidence
95% confidence
Finding
The analysis identifies `requests` 2.31.0 as having multiple advisories, and the requirement `requests>=2.31.0` permits that vulnerable version to be installed. In a server component, an HTTP client library with known flaws can expose credential leakage, request verification issues, or other network-facing weaknesses depending on how the library is used elsewhere in the skill.

Known Vulnerable Dependency: python-dotenv==1.0.1 — 1 advisory(ies): CVE-2026-28684 (python-dotenv: Symlink following in set_key allows arbitrary file overwrite via )

Low
Category
Supply Chain
Confidence
86% confidence
Finding
`python-dotenv` 1.0.1 is reported to contain a symlink-following issue in `set_key`, and the requirement allows that vulnerable version to be installed. This is less severe in the abstract because exploitation depends on the application actually invoking the affected functionality in a writable attacker-influenced filesystem context.

Static analysis

No suspicious patterns detected.