Back to skill

Security audit

医药知识图谱

Security checks for vulnerabilities and agentic risk

Overview

This medical knowledge graph skill is not clearly malicious, but it should be reviewed because it stores an API key in a local .env file and has unclear runtime disclosure.

Install only if you trust the XiaoBenYang service and are comfortable giving it a service API key. Use a scoped or disposable key if possible, avoid using this in a repository or workspace with sensitive .env contents, and remove XBY_APIKEY from .env 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
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (19)

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill declares no permissions even though its documented behavior requires environment access, file read/write, and network use for API-key handling and remote API calls. This mismatch weakens security review and user consent because the actual capability surface is broader than what is transparently declared.

Intent-Code Divergence

Medium
Confidence
92% confidence
Finding
The configuration class and comments refer to an unrelated '高考Skill' while the package is declared as a medical knowledge graph skill. This inconsistency is a supply-chain trust signal: it suggests code reuse from another project or undeclared functionality, which makes review and safe deployment harder and can hide inappropriate behavior.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The file implements API key persistence to .env and process environment mutation even though the declared skill purpose does not justify credential management. Storing secrets locally without clear necessity expands the attack surface, can leak credentials through workspace access, backups, or accidental commits, and is especially concerning given the mismatch between claimed and actual functionality.

Description-Behavior Mismatch

Medium
Confidence
94% confidence
Finding
The skill claims to be a medical knowledge graph, but the code centers on remote API configuration and key handling for another service context. This undeclared capability increases operational and privacy risk because users and reviewers may enable the skill under false assumptions about what it needs and where data may be sent.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill instructs the agent to solicit an API key from the user and persist it without any guidance on secure handling, masking, storage scope, or consent. This creates a realistic path to credential exposure, accidental logging, or unsafe long-term retention of secrets.

Missing User Warnings

Low
Confidence
86% confidence
Finding
Directly presenting raw API responses without screening can expose sensitive, irrelevant, or malformed content to users. Even if the source is intended to be medical graph data, upstream systems may include internal fields, identifiers, or unexpected text that should not be shown verbatim.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The code persists the API key into a local .env file without any user-facing warning, disclosure, or consent mechanism. This is dangerous because plaintext secret storage can be exposed via local file access, logs, backups, shared workspaces, or source control mistakes, and users are not informed that persistence is happening.

Ssd 3

Medium
Confidence
93% confidence
Finding
The combination of collecting a user-supplied API key and then following a workflow that may display raw tool output creates a natural disclosure channel for secrets or sensitive backend data. If the secret is mishandled by tools, logs, or responses, the instructions provide no safeguards to prevent leakage.

Ssd 3

Medium
Confidence
95% confidence
Finding
Instructing the model to directly show raw API data to the user without sensitivity filtering can leak confidential fields, internal metadata, or harmful content returned by the backend. Because this is a medical-domain skill, unreviewed raw output may also expose patient-related or regulated information if the backend is ever connected to such data.

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
90% confidence
Finding
The code explicitly and forcibly reads XBY_APIKEY from a local .env file outside the normal settings abstraction. This manual secret parsing bypasses clearer secret-management patterns, increases the chance of reading unintended local credentials, and is harder to audit in a skill whose declared purpose does not justify custom credential handling.

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
90% confidence
Finding
Checking for and reading the .env file directly is part of a custom credential access path that is unnecessary for the declared medical knowledge graph function. In this context, direct secret-file access is suspicious because it normalizes collection of local secrets and can capture credentials from the workspace without clear user awareness.

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
96% confidence
Finding
This function is explicitly designed to save an API key into a plaintext .env file. Persisting credentials locally in cleartext materially increases the chance of disclosure through filesystem access, backups, shared project directories, or accidental repository inclusion.

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
93% confidence
Finding
The function advertises that setting the API key will also persist it to .env, making long-term local secret storage part of the normal workflow. In the context of a skill that does not transparently justify credential management, this is a risky design that can surprise users and leave secrets behind on disk.

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
95% confidence
Finding
The dependency is specified with a lower-bound constraint only, which allows future installs to resolve to different versions over time. This weakens build reproducibility and can unintentionally introduce vulnerable or incompatible releases into the 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
95% confidence
Finding
Using an unpinned version range for pydantic means deployments are not reproducible and may silently pick up breaking or insecure releases. Even if the current minimum version is acceptable, the open-ended constraint increases 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
95% confidence
Finding
An unpinned pydantic-settings dependency permits uncontrolled upgrades during installation. That can lead to non-deterministic environments and accidental introduction of vulnerable transitive dependency versions.

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
95% confidence
Finding
The python-dotenv package is not fixed to a specific version, so installations may vary and unexpectedly include insecure or incompatible releases. This is especially relevant because the package family has a cited advisory in the analysis results.

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
98% confidence
Finding
The requirements file permits installation of requests 2.31.0, which is identified as having multiple published advisories. If the skill performs outbound HTTP requests—as suggested by inclusion of the requests library—an affected version could expose credentials, weaken request verification behavior, or introduce other transport-related security issues depending on how the code uses the library.

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
90% confidence
Finding
The file allows python-dotenv 1.0.1, which is flagged with an advisory involving symlink following in set_key that may enable arbitrary file overwrite in affected usage patterns. This is only exploitable if the skill actually invokes vulnerable write/update functionality on attacker-influenced paths, so the contextual risk is lower than a remotely reachable flaw but still real.

Static analysis

No suspicious patterns detected.