Back to skill

Security audit

随机数生成服务

Security checks for vulnerabilities and agentic risk

Overview

The skill is advertised as a random-number service, but it asks for and persistently stores a Xiaobenyang API key while carrying unrelated Gaokao/Xiaobenyang references, so it should be reviewed before installation.

Install only if you intentionally want to give this skill a Xiaobenyang API key and are comfortable with it being stored in plaintext .env in the working directory. Prefer a version that removes the Gaokao/Xiaobenyang mismatch, narrows the API client to the documented randomness calls, and uses safer secret storage or explicit non-persistent credentials.

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 .env File Without Access-Control Hardening

Content
View full analysis
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 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() if not save_api_key_to_env(api_key): return False # 更新全局 settings 实例 settings.api_key = api_key return True ``` The Skill instructions explicitly require this persistence behavior: ```markdown - 拿到用户提供的密钥后,调用 `scripts.config.set_api_key(api_key)` 保存,然后继续处理 ``` ### Technical Analysis The application stores the user-supplied `XBY_APIKEY` credential as unencrypted text in a predictable `.env` file in the current working directory. The file is written with `Path.write_text()` without explicitly enforcing owner-only permissions, validating that the destination is a regular file, or rejecting symbolic links. Actual file permissions depend on the process umask and the state of an existing `.env` file. Consequently, the code does not itself guarantee that on ...[truncated 2173 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Unbounded Dependency Constraints Permit Unreviewed Future Releases

Content
View full analysis
=2.31.0 pydantic>=2.7.0 pydantic-settings>=2.2.0 python-dotenv>=1.0.1 ``` ### Technical Analysis Every dependency uses only a minimum-version constraint. A fresh installation may therefore select any later compatible version available from the configured package index, including versions that were never reviewed or tested with this project. This is a supply-chain hardening weakness rather than evidence that any listed package is currently malicious. Exploitation requires a future package release, compromised package publisher, compromised package index, or dependency-resolution event that introduces unsafe code. Without a lock file or hashes, installations are not reproducible and package artifacts are not cryptographically restricted to reviewed distributions. The project uses ordinary, correctly spelled package names and no unsafe package source was identified. The risk arises specifically from unrestricted future resolution and lack of artifact integrity pinning. ### Attack Path 1. An administrator or automated build installs the project dependencies from `requirements.txt`. 2. The resolver selects the newest releases satisfying the lower-bound-only constraints. 3. A selected release has been compromised, maliciously published, or contains a newly introduced exploitable behavior. 4. Package installation or subsequent import executes or loads the affected dependency under the privileges of the installer or Skill process. 5. The compromised dependency can access data and resources available to that process, potentially including the plaintext API key and outbound network connectivity. This path depends on an upstream compromise or unsafe future release; the audited repository itself does not contain a malicious dependency p ...[truncated 565 chars]
Remediation
View remediation
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 (27)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill claims to provide randomness retrieval, but it also reads, writes, and persists API keys in .env and modifies process environment state, while references suggest gaokao-related configuration rather than randomness functionality. This inconsistency creates a supply-chain and trust problem: users may be induced to disclose secrets to a skill whose actual configuration and persistence behavior does not match its advertised purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill claims to provide randomness retrieval, but it also reads, writes, and persists API keys in .env and modifies process environment state, while references suggest gaokao-related configuration rather than randomness functionality. This inconsistency creates a supply-chain and trust problem: users may be induced to disclose secrets to a skill whose actual configuration and persistence behavior does not match its advertised purpose.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The workflow includes copied instructions and an example invocation for an unrelated gaokao or school-search tool, which strongly suggests the skill documentation was repurposed without proper validation. In security terms, this can misroute user requests, cause unintended external calls, and conceal actual behavior behind misleading instructions, especially when combined with API-key collection requirements.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This configuration module is inconsistent with the declared random-number service and instead contains hard-coded references to another service ('小笨羊高考', XBY_GAOKAO, xiaobenyang.com) plus API-key handling and persistence. That mismatch strongly suggests code reuse or accidental inclusion of unrelated capability, which expands the skill’s trust boundary and may cause the agent to collect, store, or use credentials for an unrelated backend.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The docstring identifies the module as configuration for a different '高考' skill, directly contradicting the declared purpose of a random-number service. In security review, this kind of contextual mismatch is a strong indicator of repurposed or misplaced code that can introduce hidden behaviors, external dependencies, or data flows not expected by the user.

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

This code explicitly and forcibly reads XBY_APIKEY from a local .env file in custom logic, bypassing the normal settings abstraction and tying the skill to a credential for an unrelated service. In context, this makes the skill more dangerous because it reaches into local secret storage for functionality outside the declared random-number-service scope.

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

The existence check precedes direct reading of a local .env file for an unrelated API key, enabling the skill to consume locally stored secrets outside its apparent purpose. While not exfiltration by itself, this unauthorized secret intake broadens the attack surface and can facilitate misuse of credentials if other code paths transmit them.

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

This function is dedicated to writing an API key into a plaintext .env file, creating persistent local storage of a secret for an unrelated service. In the context of a random-number skill, that behavior is unnecessary and risky because it can expose credentials through filesystem access, accidental commits, logs, backups, or multi-user environments.

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 requests or implies access to sensitive capabilities such as environment variables, file reads/writes, and network access, but does not declare any explicit tool scope or permissions boundary. In a skill that also instructs the model to collect and persist an API key, this lack of scoping increases the chance of over-broad access, unintended secret handling, and misuse of available tools.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The project structure identifies the package as a gaokao skill and describes generic API-client components, which contradicts the claimed drand-specific purpose. These contradictions are a security concern because they indicate either careless reuse or concealed functionality, both of which undermine trust and make it harder to assess what code will actually do with user input and secrets.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code uses Chinese-only natural-language strings in user-facing docstrings and error messages, such as the client description and API failure text. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code exposes a generic remote invocation primitive by accepting arbitrary tool_name, mcp_id, and params and forwarding them upstream with only an API key check. In a skill advertised as a verifiable randomness service, this broader capability creates an unintended proxy surface that can be abused to access unrelated upstream tools or behaviors, violating least privilege and potentially enabling unauthorized actions through the skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The function implements generic remote tool execution despite the declared purpose being random-number generation, so the exposed behavior is more powerful than the advertised security boundary. That mismatch is dangerous because downstream users or orchestrators may trust the skill as low-risk while it can invoke arbitrary upstream MCP functionality, increasing the chance of privilege misuse, data exposure, or execution of unintended operations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
71% confidence
Finding

The visible natural-language text in this file is exclusively Chinese, including the main configuration docstring, which can indicate an implicit language constraint. Under the policy, forcing a specific language without offering user choice or documenting a justified locale restriction is a potential violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code provides local persistent storage of an API key in a .env file even though this behavior is not justified by the stated random-number-service purpose. Persisting secrets locally increases the chance of credential leakage through source control, backups, local compromise, or unintended reuse by other processes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The function saves the API key to .env without any built-in user-facing warning, confirmation, or visibility into the persistence side effect. Silent secret persistence is risky because users may expect a temporary session token, while the application actually leaves recoverable credentials on disk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The file presents core skill instructions in Chinese while the tool selection table uses English intent phrases, but nowhere states that the skill supports multiple languages or asks the user for a preferred language. This can violate a language/locale policy when a skill effectively assumes a language without explicit user opt-in.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
98% confidence
Finding

The dependency specification uses a lower-bound constraint (requests>=2.31.0) rather than pinning an exact version, which makes builds non-reproducible and can allow deployment of a later vulnerable or breaking release. In a service exposed to external inputs, dependency drift increases supply-chain risk and makes it difficult to verify whether known advisories affect the installed package.

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

requests has known advisories, and because the manifest does not pin the package, it is impossible to verify from this file alone whether deployment will use a fixed or vulnerable version. In a network-facing random-number service, use of an affected HTTP client could enable credential leakage, TLS/verification issues, or other request-handling flaws depending on the resolved release.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

pydantic>=2.7.0 is unpinned, so installations may resolve to different versions over time. That weakens reproducibility and can unintentionally introduce a vulnerable release or behavioral change into validation logic used by the service.

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

pydantic has published advisories, but the unpinned requirement prevents determining whether the installed version is affected. Since this library handles parsing and validation, an affected version could expose denial-of-service or parsing weaknesses when processing untrusted input.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

pydantic-settings>=2.2.0 is not pinned to an exact version, leaving room for uncontrolled dependency resolution. For configuration-handling libraries, this can expose the service to newly introduced flaws or unexpected parsing behavior that affects secrets and runtime settings.

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

pydantic-settings is associated with a known advisory, and the absence of version pinning means the actual installed version cannot be validated. Because this package may read configuration and secrets, a vulnerable release could affect file resolution or secret source boundaries if those features are used.

Content

No source excerpt is available for this finding.