Back to skill

Security audit

文献综述助手

Security checks for vulnerabilities and agentic risk

Overview

This skill appears intended to proxy literature searches through XiaoBenYang, but it has mismatched Gaokao leftovers and stores the user's API key in a plaintext .env file.

Review this before installing if you are comfortable sending search queries through XiaoBenYang and storing an API key locally in plaintext. Use a throwaway or limited-scope API key if possible, keep .env out of source control, and treat the Gaokao naming leftovers as a reason to ask the publisher for a cleaned and better-scoped release.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/config.py:44
Finding

API Key Stored in a Plaintext File Without Enforced Access Controls

Content
View full analysis

Vulnerability Details

File Location: scripts/config.py:44-66
Vulnerability Type: Plaintext storage of sensitive credentials
Risk Level: Medium

Vulnerable Code

python
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()
        found = False
        new_lines = []
        for line in lines:
            if line.startswith("XBY_APIKEY="):
                new_lines.append(f"XBY_APIKEY={api_key}")
                found = True
            else:
                new_lines.append(line)
        if not found:
            new_lines.append(f"XBY_APIKEY={api_key}")
        env_path.write_text("\n".join(new_lines) + "\n", encoding="utf-8")
        os.environ["XBY_APIKEY"] = api_key
        return True
    except Exception as e:
        print(f"保存API key失败: {e}")
        return False

Technical Analysis

The function persistently writes the user-provided API key as plaintext into a .env file located relative to the process's current working directory. It uses Path.write_text() without explicitly creating the file with owner-only permissions or verifying the ownership and permissions of an existing file.

For a newly created file, effective permissions depend on the process umask. An existing .env file retains its current access controls, which may allow unintended local users or processes to read the credential. Using a current-working-directory-relative path also increases the chance that the secret will be stored in a shared directory, backed up, packaged, or accidentally committed to source control.

The function additionally copies the key into the process environment. Processes with sufficient local inspection privileges may be able to access that environment, although this does not indepen ...[truncated 1436 chars]

Remediation
View remediation

Remediation Suggestions

  1. Prefer non-persistent, session-scoped credential injection through a protected environment or secret-management facility.
  2. If persistence is necessary, use an operating-system credential store or dedicated secret manager instead of a plaintext .env file.
  3. Store configuration under a fixed, user-specific configuration directory rather than the current working directory.
  4. On POSIX systems, create the credential file atomically with owner-only mode 0600; verify that any existing file is owned by the expected user and is not a symbolic link.
  5. Apply restrictive permissions to the parent directory, such as 0700, and reject files with unsafe ownership or access modes.
  6. Avoid placing secrets in project directories. Add .env to source-control, packaging, and backup exclusion rules.
  7. Use atomic replacement with a temporary file created in the same protected directory to avoid partial writes and reduce race-condition exposure.
  8. Document credential revocation and rotation procedures so users can promptly invalidate a key after suspected disclosure.
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 (25)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented purpose says this is a literature-review assistant, but the content also references a gaokao-related project, xiaobenyang.com API key handling, and unrelated naming/comments. This mismatch is dangerous because users may disclose credentials or trust actions under false pretenses, while the underlying workflow appears tied to a different service and data flow than advertised.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The configuration class and identifiers clearly target a different skill domain ('gaokao') than the declared literature-review assistant. This mismatch is a real supply-chain integrity issue because it can cause operators to trust the wrong backend, load the wrong environment variables, or connect to unintended services, undermining review and deployment assumptions.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/config.py (reported line 13)May include surrounding context.

python
model_config = SettingsConfigDict(
        env_prefix="XBY_GAOKAO_",
        env_file=".env",
        env_file_encoding="utf-8",
        extra="ignore",
    )

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/config.py (reported line 32)May include surrounding context.

python
model_config = SettingsConfigDict(
        env_prefix="XBY_GAOKAO_",
        env_file=".env",
        env_file_encoding="utf-8",
        extra="ignore",
    )

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/config.py (reported line 31)May include surrounding context.

python
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")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/config.py (reported line 39)May include surrounding context.

python
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")

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

This function explicitly writes the provided API key to a plaintext .env file, creating a persistent local copy of a secret. In an MCP/client tooling context, that is more dangerous because users may run the skill in shared workspaces or repositories where plaintext secrets can be leaked, copied into backups, or accidentally committed.

Content

Scanner excerpt · scripts/config.py (reported line 48)May include surrounding context.

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

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill declares behavior that implies access to environment variables, local file reads/writes, and network access, but it does not define any explicit tool scope or permissions boundaries. In an agent setting, this increases the risk of overbroad capability use, especially because the skill also instructs collecting and persisting credentials.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill explicitly instructs the agent to ask the user for an API key and persist it via set_api_key() into .env, but it provides no warning, consent flow, storage safeguards, or secret-handling limits. Collecting and locally storing credentials in an agent workflow is highly sensitive because it can expose secrets through logs, file access, later prompts, or unintended reuse.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Residual instructions referencing school-search behavior inside a literature-review skill indicate the skill may be repurposed or misconfigured. That inconsistency undermines trust and can cause the agent to invoke the wrong functions or request sensitive inputs for an unrelated workflow.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The project structure still identifies itself as xiaobenyang_gaokao_skill, contradicting the stated identity of a literature-review assistant. This inconsistency suggests code reuse from another project and increases the chance that hidden logic, endpoints, or configuration handling are unrelated to the declared function.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code performs a network POST and sends the caller-provided params payload to an external endpoint, which may include user or system data. While the code logs success and error metadata, it does not provide a user-facing warning, confirmation, or explanatory comment/docstring disclosing that data will be transmitted off-system.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The class docstring explicitly says "小笨羊高考Skill配置", which describes a college-entrance-exam skill rather than a literature review assistant. This is not merely incomplete documentation; it actively identifies a different intent from the manifest.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code persists the API key into a local .env file automatically and without any explicit user notice, consent flow, or storage-safety guardrails. This increases the risk of credential disclosure through source control commits, local file exposure, backups, or multi-user environments, especially in developer tooling contexts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

Nearly all instructional content, headings, and operational guidance are written in Chinese, with no indication that the user may choose another language. This can constitute a language/locale policy issue because the skill imposes a specific language experience without explicit user opt-in or documented regional justification.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The dependency is specified with a lower bound only, which allows future installs to resolve to different versions over time. This weakens build reproducibility and can unintentionally introduce vulnerable or breaking releases into the skill's environment.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1

Unverifiable Dependency: requests has 16 known advisory(ies) (CVE-2014-1830 (Exposure of Sensitive Information to an Unauthorized Actor in Requests); 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) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
89% confidence
Finding

requests has multiple published advisories, but the manifest does not pin an exact version, so it is impossible to verify whether installed environments are using a fixed or affected release. In a network-facing literature review assistant, this uncertainty is more relevant because requests likely handles outbound HTTP interactions and could expose credentials or transport behavior if an affected version is resolved.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

Using pydantic>=2.7.0 permits any newer version to be installed, making the runtime environment non-deterministic. If an upstream release contains a security regression or incompatible behavior, deployments may become vulnerable without any code change in this skill.

Content

Scanner excerpt · requirements.txt (reported line 2)May include surrounding context.

text
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1

Unverifiable Dependency: pydantic has 4 known advisory(ies) (CVE-2021-29510 (Use of "infinity" as an input to datetime and date fields causes infinite loop i); CVE-2024-3772 (Pydantic regular expression denial of service); CVE-2021-29510 (Pydantic is a data validation and settings management using Python type hinting.) +1 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
87% confidence
Finding

pydantic has known advisories, and the absence of exact version pinning makes it unverifiable whether deployments include a vulnerable release. Since this package commonly validates untrusted input, an affected version could enable denial of service or parsing issues depending on how the skill uses it.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

An unpinned pydantic-settings dependency means the resolved package version can vary across installations. This creates supply-chain and patch-verification uncertainty, especially for configuration-handling code that may process secrets or local files.

Content

Scanner excerpt · requirements.txt (reported line 3)May include surrounding context.

text
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1

Unverifiable Dependency: pydantic-settings has 1 known advisory(ies) (CVE-2026-58203 (pydantic-settings: NestedSecretsSettingsSource follows symlinks outside secrets_)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
84% confidence
Finding

pydantic-settings has a known advisory, and because the dependency is not pinned, the actual risk cannot be assessed for any given installation. This is especially relevant for a skill that may load configuration or secrets at startup, where vulnerable file-handling behavior could matter if the affected code paths are used.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

python-dotenv is also only lower-bounded, so installations may pull in any later version. Because this library often interacts with environment files and secrets, version drift can expose the skill to newly introduced vulnerabilities or unsafe behavior.

Content

Scanner excerpt · requirements.txt (reported line 4)May include surrounding context.

text
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1

Unverifiable Dependency: python-dotenv has 2 known advisory(ies) (CVE-2026-28684 (python-dotenv: Symlink following in set_key allows arbitrary file overwrite via ); CVE-2026-28684 (python-dotenv reads key-value pairs from a .env file and can set them as environ)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
86% confidence
Finding

python-dotenv has published advisories related to file handling, but the manifest leaves the installed version unspecified beyond a minimum. That makes it impossible to prove that deployments avoid affected versions, which is risky for a package that may read or modify .env files containing sensitive configuration.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The class docstring specifies a Chinese-language API client description, and all user-visible messages in this file are Chinese, with no indication that language is configurable or user-selected. This can violate language/locale policy when a skill implicitly forces one language without opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
74% confidence
Finding

The file's human-readable docstrings and comments are entirely in Chinese, with no indication that language choice is optional or configurable. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.