Back to skill

Security audit

中药方剂知识图谱

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be an API-backed knowledge-graph tool, but it needs review because it collects an API key through chat, stores it in a plaintext .env file, and has inconsistent copied documentation.

Install only if you are comfortable giving this skill a XiaoBenYang API key and having it saved in a plaintext .env file in the working directory. Use a limited-scope key if possible, avoid sharing sensitive data through the graph queries, and remove the stored key when you no longer need the skill.

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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (20)

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill exposes effective capabilities to read environment state, write local files, and make network-backed tool calls, yet declares no permissions or trust boundaries. This undermines informed consent and platform policy enforcement because a user expecting a simple knowledge-graph helper may unknowingly authorize credential handling and external data access.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The declared purpose is a traditional-medicine knowledge graph, but the documented behavior includes external MCP connectivity, local API-key persistence, schema discovery, and arbitrary read-only Cypher execution. That mismatch is dangerous because it conceals the real attack surface and can be used to elicit secrets or query unintended backend data under the guise of a benign domain-specific skill.

Intent-Code Divergence

Medium
Confidence
79% confidence
Finding
The project structure references a gaokao-themed codebase that conflicts with the stated medicine-graph purpose, indicating probable copy-paste reuse or undocumented backend substitution. Such inconsistency increases the risk that users and reviewers misunderstand what service is actually being contacted and what data flows are occurring.

Intent-Code Divergence

Medium
Confidence
82% confidence
Finding
The workflow example invokes an unrelated school-search function despite the listed tools being graph schema retrieval and Cypher execution. This inconsistency suggests the instructions are not trustworthy and may hide unintended tool routing behavior, making misuse or accidental invocation of unrelated capabilities more likely.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The skill includes code to persist and manage an external API credential even though the declared skill is a traditional medicine knowledge-graph tool. This scope mismatch is suspicious because it expands the trust boundary and creates unnecessary secret-handling behavior unrelated to the stated purpose, increasing the chance of covert credential collection or misuse.

Intent-Code Divergence

Medium
Confidence
88% confidence
Finding
The class docstring refers to a different domain ('高考' skill) than the manifest description for a TCM knowledge graph. Such inconsistent identity signals can indicate copied code, repurposed components, or intentional misdirection, which undermines trust and can hide unauthorized behaviors like secret handling.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill tells the model to collect an API key from the user and save it locally without explaining retention, scope, masking, or storage risk. Credentials gathered through chat are sensitive secrets, and persisting them to a .env file can expose them to logs, later prompts, other tools, or unintended filesystem access.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The function writes the provided API key directly into a local .env file and updates process environment state without any confirmation, warning, or secure-storage safeguards. Persistent secret storage in plaintext can expose credentials through source directories, backups, logs, accidental commits, or other local users/processes.

Ssd 3

Medium
Confidence
96% confidence
Finding
The skill operationalizes secret collection and persistence as part of the natural-language workflow, normalizing credential capture by the model itself. This expands the attack surface because adversarial prompts, transcript retention, or downstream tooling could expose the secret, and the skill provides no guardrails around secure handling.

Ssd 3

Medium
Confidence
94% confidence
Finding
Repeatedly instructing the model to ask for missing API credentials via chat increases the likelihood of secret disclosure and conditions users to share credentials in an insecure medium. In the context of a skill that also performs file writes and external network access, this becomes more dangerous because the key can then be stored and used without clear visibility or consent boundaries.

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 reads the local .env file to extract XBY_APIKEY, bypassing normal settings abstractions and broadening direct access to stored credentials. In the context of a skill whose declared purpose does not require obvious secret management, this increases concern because the component is directly harvesting a credential from local storage.

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
Opening and reading the .env file directly gives this skill access to all secrets stored there, not just a scoped configuration value. That direct file-level credential access is unnecessary for a knowledge-graph skill and raises the impact of compromise or code repurposing.

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
This function is explicitly designed to save an API key into a local .env file, creating plaintext credential persistence in the project directory. That increases exposure through accidental commits, local file disclosure, backups, and unauthorized access by other tools or users on the same system.

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 setter function normalizes and persists the API key as part of ordinary operation, making secret storage a built-in behavior of the skill. Because the declared skill topic is unrelated to credential management, this hidden persistence is more dangerous in context and may violate user expectations about what the skill stores locally.

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
98% confidence
Finding
The dependency is specified with a lower bound only (`requests>=2.31.0`), which allows future installs to resolve to different versions over time. This weakens build reproducibility and can unintentionally introduce breaking changes or newly vulnerable releases into the skill environment.

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
98% confidence
Finding
`pydantic>=2.7.0` is unpinned, so installations are not deterministic and may pull newer releases with incompatible behavior or latent security issues. While not an exploit by itself, this is a real supply-chain hygiene weakness that increases risk over time.

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
98% confidence
Finding
`pydantic-settings>=2.2.0` permits uncontrolled upgrades, which can introduce security regressions or operational instability without code changes. This is a legitimate dependency-management weakness, though typically low severity on its own.

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
98% confidence
Finding
`python-dotenv>=1.0.1` allows any later version to be installed, reducing reproducibility and making it easier for vulnerable or incompatible versions to enter the environment unexpectedly. This is especially relevant because environment-variable tooling often interacts with sensitive configuration.

Known Vulnerable Dependency: requests==2.31.0 — 3 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)

Low
Category
Supply Chain
Confidence
95% confidence
Finding
The requirement allows installation of `requests` 2.31.0, a version with published advisories including credential leakage via malicious URLs and TLS verification/session-related issues. If the skill makes outbound HTTP requests using attacker-influenced URLs or relies on sessions, these flaws could expose secrets or weaken transport security; the research-oriented TCM knowledge-graph context does not inherently require hostile networking, so risk is somewhat contextual but still real.

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
92% confidence
Finding
The requirement permits `python-dotenv` 1.0.1, which is flagged for a symlink-following issue in `set_key` that can enable arbitrary file overwrite in unsafe usage patterns. This becomes exploitable if the skill writes `.env` files or allows an attacker to influence target paths or filesystem layout; the current skill description does not suggest such behavior, which lowers likelihood but not the underlying package risk.

Static analysis

No suspicious patterns detected.