Back to skill

Security audit

代码文档更新服务

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be an API-backed documentation helper, but it mixes Context7 branding with XiaoBenYang and gaokao leftovers and persists an API key in a plaintext local .env file.

Install only if you are comfortable giving a XiaoBenYang API key to this skill and having it stored in a local plaintext .env file. Review or change the credential storage behavior first if the workspace may be shared, committed, backed up, or indexed, and confirm the publisher intended this XiaoBenYang-hosted Context7 wrapper rather than an official Context7 integration.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/config.py:45
Finding

API Key Persisted in a Plaintext Environment File

Content
View full analysis

Vulnerability Details

File Location: scripts/config.py:45-79
Vulnerability Type: Plaintext credential storage with unrestricted file permissions
Risk Level: Medium

Vulnerable Code

python
def save_api_key_to_env(api_key: str) -> bool:
    """Store the API key in the .env file."""
    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"Failed to store API key: {e}")
        return False


def set_api_key(api_key: str) -> bool:
    """Set the API key and persist it to .env."""
    if not api_key or not api_key.strip():
        return False
    api_key = api_key.strip()
    if not save_api_key_to_env(api_key):
        return False
    settings.api_key = api_key
    return True

Technical Analysis

The Skill explicitly requests an API key from the user and persists it as an unencrypted XBY_APIKEY entry in a .env file located relative to the process working directory. The file is created through Path.write_text() without explicitly setting restrictive permissions.

Consequently, the actual access controls depend on the process umask and any permissions already present on the file. The implementation also rewrites an existing .env file without validating or tightening its permissions. This can expose the credential to other local users ...[truncated 1681 chars]

Remediation
View remediation

Remediation Suggestions

  1. Prefer session-only credential handling or an operating-system credential manager instead of writing secrets to the project directory.
  2. Obtain explicit user consent before persisting a credential; provide a non-persistent option.
  3. If file persistence is unavoidable, create .env atomically with owner-only permissions such as 0600.
  4. Validate and tighten the permissions of an existing .env file before reading or rewriting it.
  5. Resolve the storage path explicitly rather than relying on the current working directory.
  6. Add .env to .gitignore, packaging exclusions, backup exclusions, and container build exclusions.
  7. Avoid printing, logging, or returning the API key in errors.
  8. Document credential revocation and rotation procedures.
  9. Consider accepting the key through a process environment variable supplied by the runtime rather than collecting and storing it through the Skill.

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Dependencies Are Not Reproducibly Pinned

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1-4
Vulnerability Type: Unbounded dependency resolution and supply-chain exposure
Risk Level: Low

Vulnerable Code

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

Technical Analysis

All dependencies specify only minimum versions. The resolver may therefore install any compatible future release available at installation time. No lock file or package hashes are present to establish a reviewed, reproducible dependency set.

The package names appear legitimate, and the reviewed project does not provide evidence that any currently selected release is malicious. The risk arises because future installations implicitly trust later releases and their transitive dependency graphs without integrity verification.

If a dependency publisher account, package release process, or upstream package is compromised, an installation may automatically select attacker-controlled code. Python packages can execute code during installation or when imported by the Skill.

Attack Path

  1. An upstream dependency or its publishing account is compromised, or a future release contains malicious code.
  2. The malicious release still satisfies the project's broad minimum-version constraint.
  3. A user installs the Skill dependencies without a lock file or hash verification.
  4. The package resolver selects the compromised release.
  5. Malicious package code executes during installation or import with the privileges of the installing or running process.

Impact Assessment

The potential impact is arbitrary code execution under the account that installs or runs the Skill. Depending on that account's privileges, malicious dependency code could read accessible files and credentials, alter project data, make network requests, or compromise the execution environment.

Exploitation depends on a compromised or malicious ...[truncated 83 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin every direct dependency to a reviewed exact version.
  2. Generate and commit a lock file that also fixes transitive dependency versions.
  3. Use hash verification, such as pip's --require-hashes, for deployment installations.
  4. Update dependencies through a controlled review process rather than automatically accepting all future versions.
  5. Run dependency vulnerability and provenance scanning in CI.
  6. Install dependencies in an isolated, least-privileged virtual environment.
  7. Periodically regenerate pins to receive security updates after testing and review.
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
98% confidence
Finding

The skill presents itself as a documentation helper but explicitly persists API keys to local configuration and references a different service domain entirely. This inconsistency materially increases the risk of credential misuse, user deception, and accidental routing of sensitive inputs to an unintended service, especially because the described implementation appears copied from another project.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill presents itself as a documentation helper but explicitly persists API keys to local configuration and references a different service domain entirely. This inconsistency materially increases the risk of credential misuse, user deception, and accidental routing of sensitive inputs to an unintended service, especially because the described implementation appears copied from another project.

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
77% confidence
Finding

The custom post-init code explicitly opens and parses .env to extract XBY_APIKEY, creating direct credential access logic beyond normal environment resolution. In the context of a documentation-oriented skill, this broader secret-handling behavior is more sensitive because it enables the skill to ingest local secrets from disk rather than just receive configuration from the host.

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
77% confidence
Finding

This line participates in direct reading of the local .env file for credentials, which is sensitive credential access behavior. Although intended for configuration, it still increases the attack surface by giving the skill code explicit access to plaintext secrets stored in the workspace.

Content

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

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

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
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

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

This function writes the API key into a plaintext .env file, creating durable local credential exposure. If the workspace is shared, backed up, indexed, or accidentally committed, the secret may be disclosed and abused to access upstream services.

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
84% confidence
Finding

The skill declares no explicit tool scope or permissions, yet its documented behavior includes environment access, local file writes for API key persistence, and remote network/API calls. This creates an over-privileged and opaque execution model: a host may grant broader capabilities than users expect, increasing the chance of credential handling or outbound requests occurring without clear consent boundaries.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill file is predominantly written in Chinese and presents all operational instructions in that language, without offering users a language choice or stating that the skill is intended only for a Chinese-speaking or region-specific audience. This can violate language/locale policy because it effectively constrains interaction to a specific language without explicit opt-in or justification.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The workflow examples include a school-query function call inside a skill that claims to provide library documentation. Such pasted or mixed instructions indicate the skill may invoke the wrong backend or handle user inputs in unintended ways, which undermines trust and can cause data to be sent to unrelated services.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code performs an HTTP POST to a configured upstream service and transmits the caller-provided params payload, which may contain user or system data. The file includes logging for success/failure, but no confirmation prompt, user-facing disclosure, or explanatory comment/docstring warning that data is sent off-box.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest names the skill as '代码文档更新服务', but the Settings class docstring says '小笨羊高考Skill配置'. This is an active contradiction in the code documentation, indicating the file may have been repurposed from an unrelated skill or does not reflect the declared intent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code persists and mutates an API credential in a local .env file even though the skill is presented as a documentation service, which expands the skill's privileges beyond simple documentation lookup. Persisting secrets to disk increases exposure to accidental disclosure through local file reads, source control mistakes, backups, or other tools operating in the workspace.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The function silently stores the API key in .env without any user-facing warning, confirmation, or indication of persistence. Users may believe they are providing a transient credential, while the code leaves a durable secret on disk that may be readable by other local processes or later committed accidentally.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The document instructs the model to call a local configuration module to save an API key, while the rest of the skill describes a different documentation service and tool set. This stitched-together design is risky because it encourages secret persistence without a coherent trust model or clear linkage to the advertised feature, raising the chance of accidental secret exposure or misuse.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency specifier requests>=2.31.0 is not pinned to an exact version, which makes builds non-reproducible and can allow future vulnerable or breaking releases to be installed without review. In a service that retrieves and uses external documentation, dependency drift increases supply-chain risk because behavior may change across environments and time.

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
90% confidence
Finding

requests has known security advisories, but the manifest does not pin an exact version, so it is impossible to verify whether deployed environments are using a fixed or affected release. In a component that likely performs network access to fetch documentation, uncertainty around an HTTP client dependency increases supply-chain and runtime risk.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency specifier pydantic>=2.7.0 is unpinned, so installations may resolve to different versions over time. This weakens reproducibility and can silently introduce vulnerable or incompatible releases into the environment.

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
88% confidence
Finding

pydantic has published advisories, and because the version is not pinned, the actual installed release cannot be verified as safe. This creates uncertainty in validation logic and raises the possibility of consuming a vulnerable parser or validator version in some environments.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

pydantic-settings>=2.2.0 allows any newer version to be installed, including versions that may later contain security issues or behavioral changes. This is a supply-chain hygiene issue rather than an immediately exploitable flaw, but it still increases operational and security uncertainty.

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
87% confidence
Finding

pydantic-settings has at least one advisory, and the unpinned requirement means installations may resolve to an affected version without visibility. Since settings libraries often process filesystem- and secret-related inputs, unverifiable versions can become more dangerous when handling local configuration or secrets.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

python-dotenv>=1.0.1 is not version-pinned, so future installs may pull different releases with unknown security posture. Because dotenv libraries can affect configuration loading and file handling, version drift can be risky in deployment pipelines and local developer environments.

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
88% confidence
Finding

python-dotenv has known advisories, and the lack of version pinning prevents verification that an installed release is unaffected. Given dotenv tooling can read and write environment-related files, an affected version could have consequences for secrets handling or file safety depending on how the package is used elsewhere in the skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The class docstring contains Chinese-only user-facing descriptive text, and the file does not indicate any language selection or opt-in behavior. This can violate language/locale policy when a skill implicitly forces one language without giving the user a choice or documenting a locale-specific scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The printed failure message is a natural-language string in Chinese, with no indication that the user selected that language or that the tool is restricted to a Chinese-speaking context. Hard-coded user-visible strings in a single language can conflict with organizational language/locale policy.

Content

No source excerpt is available for this finding.