Back to skill

Security audit

随机数生成服务

Security checks for vulnerabilities and agentic risk

Overview

This skill is presented as a secure random-number generator, but it depends on a third-party API, collects and stores an API key, and contains inconsistent copied project references that users should review before installing.

Install only if you are comfortable giving a Xiaobenyang API key to this skill, having it saved in a local .env file, and relying on a remote service for random values. Do not use it for security-critical tokens, keys, or identifiers unless you have independently verified the provider, API behavior, and secret-storage handling.

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

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill exposes code capabilities for environment access, file read/write, and network communication without declaring permissions or clearly informing users. This reduces transparency and makes it easier for a seemingly simple random-number skill to access secrets, persist data locally, and contact external services unexpectedly.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The stated purpose is local cryptographically secure random generation, but the documented behavior includes storing an API key, reading local configuration, and proxying requests to a third-party service. This mismatch can mislead users into disclosing secrets and trusting output properties that are actually controlled by a remote service rather than a local CSPRNG.

Description-Behavior Mismatch

High
Confidence
99% confidence
Finding
Requiring an external API key and routing all randomness requests through a remote API contradicts the claim of a cryptographically secure random-number generator. Users may assume local, auditable entropy generation while instead sending requests and trust to an opaque third party, creating confidentiality and integrity risks.

Intent-Code Divergence

High
Confidence
97% confidence
Finding
The workflow references unrelated school-search behavior and a gaokao-themed project structure, indicating copy-pasted or inconsistent documentation. Such contradictions are a strong sign that the skill may not do what it claims, undermining user trust and increasing the risk of hidden or unintended data handling.

Intent-Code Divergence

Medium
Confidence
88% confidence
Finding
Instructing the agent to present raw API responses directly to the user reveals that the skill is acting as a generic passthrough to a remote service. This can expose unnecessary metadata or unexpected content from the backend and bypass validation or sanitization that should occur before user display.

Description-Behavior Mismatch

High
Confidence
92% confidence
Finding
该技能自称为“加密安全随机数生成服务”,但此文件实现的是一个通用上游 MCP 工具调用客户端,可将调用转发到任意工具名与参数,而不是受限的随机数接口。这种能力与声明功能明显不符,会扩大攻击面,并可能让调用方在不知情的情况下触发未预期的远程能力。

Context-Inappropriate Capability

High
Confidence
95% confidence
Finding
call_tool 接受外部提供的 tool_name 和任意 params,并将其连同 API key 一起发送到上游 /api,这本质上提供了按名称调用任意上游工具的通用代理能力。在一个应仅提供随机数的技能中,这意味着攻击者或误用方可能借此访问额外的远程操作面,造成权限扩张和越权调用。

Description-Behavior Mismatch

High
Confidence
99% confidence
Finding
The file’s functionality is materially inconsistent with the declared skill purpose: instead of a cryptographically secure random service, it implements configuration and credential persistence for an external 'gaokao' API. In an agent-skill ecosystem, this kind of capability mismatch is dangerous because it can hide unrelated secret-handling behavior under an innocuous label, increasing the risk of covert credential collection or unauthorized external service use.

Context-Inappropriate Capability

High
Confidence
98% confidence
Finding
This code reads, stores, and exposes an external business API key even though the advertised skill is only a random number generation service. Excess credential-handling capability outside the declared scope is high risk because users and integrators may grant trust or permissions they would not have given if the true behavior were disclosed.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
The in-code documentation identifies the module as a '高考Skill配置', directly conflicting with the package metadata that claims it is a random number generation service. Such provenance and labeling inconsistencies are strong indicators of repurposed or mislabeled code, which undermines trust and can conceal unrelated sensitive behavior.

Description-Behavior Mismatch

Medium
Confidence
93% confidence
Finding
The skill markets itself as a cryptographically secure random number generation server, but every exposed function simply forwards requests to an external API via call_api. This creates a trust-boundary mismatch: consumers may believe randomness is generated locally under the skill's control, while in reality entropy quality, logging, manipulation, availability, and privacy all depend on an undisclosed remote service.

Context-Inappropriate Capability

Medium
Confidence
89% confidence
Finding
Introducing an external dependency for security-sensitive randomness increases risk because the remote service can fail, bias output, observe usage patterns, or return predictable values without the caller being able to independently validate the entropy source. In the context of an RNG skill for AI and other systems, this is more dangerous because downstream consumers may rely on the randomness for tokens, identifiers, or security decisions.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The function persists the provided API key directly into a local .env file without any visible confirmation, warning, or discussion of security implications. Silent secret persistence increases the chance of credential exposure through source control commits, backups, shared workspaces, or later unintended disclosure by other tooling.

Credential Access

High
Category
Privilege Escalation
Content
model_config = SettingsConfigDict(
        env_prefix="XBY_GAOKAO_",
        env_file=".env",
        env_file_encoding="utf-8",
        extra="ignore",
    )
Confidence
88% confidence
Finding
Loading configuration from a .env file is common, but in this skill context it is notable because the declared functionality does not require external business credentials. The mismatch between claimed purpose and secret-loading behavior makes credential access more suspicious and increases the chance of unjustified secret collection.

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
94% confidence
Finding
The code explicitly and 'forcibly' reads XBY_APIKEY from .env during model initialization, bypassing ordinary configuration expectations and reinforcing that credential acquisition is a primary behavior of this module. In a mislabeled skill, proactive secret loading is especially dangerous because it can collect usable credentials under false pretenses.

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
Reading the .env file content directly to extract a specific API key constitutes direct credential access logic. In the context of a supposed random-number service, this is unjustified secret processing and increases the risk of hidden credential dependency or abuse.

Credential Access

High
Category
Privilege Escalation
Content
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
Confidence
84% confidence
Finding
Reading XBY_APIKEY from the environment is standard configuration behavior, but within this mislabeled skill it still represents unjustified credential access relative to the declared random-service scope. The danger comes less from the API call itself and more from the deceptive or inaccurate context surrounding it.

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 dedicated to persisting an API key into .env, which goes beyond transient credential use and creates a long-lived local secret footprint. Persistent plaintext storage of secrets in a mislabeled skill materially raises the risk of accidental disclosure and unauthorized reuse.

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 set_api_key function formalizes credential ingestion and persistence as a supported feature, despite that feature being unrelated to the advertised service. This broadens the attack surface by enabling secret capture and storage within a context where users may not expect any credential management at all.

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
94% confidence
Finding
The dependency is specified with a lower bound only, which allows future installs to pull in newer, unreviewed versions and makes builds non-reproducible. In a security-sensitive random-number service, supply-chain drift increases the chance of silently introducing vulnerable or behavior-changing releases.

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
94% confidence
Finding
Using an unpinned pydantic version permits installation of any later release, reducing reproducibility and weakening supply-chain control. While not an immediate exploit by itself, it increases the risk that future environments resolve to a flawed or incompatible version.

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
94% confidence
Finding
The pydantic-settings package is not pinned, so deployments may consume different versions over time. This creates avoidable supply-chain risk and can introduce vulnerable or breaking releases without code changes.

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
python-dotenv is defined with only a minimum version, allowing uncontrolled upgrades and non-reproducible installs. Because this package can influence configuration loading, unexpected version changes may affect runtime security posture.

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
97% confidence
Finding
The allowed range includes requests 2.31.0, which has multiple published advisories, including credential leakage and TLS/session verification issues. If the service makes outbound HTTP requests, these flaws could expose secrets or weaken transport security; the MCP/randomness context does not eliminate that risk and may make integrity especially important.

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
88% confidence
Finding
The allowed dependency range includes python-dotenv 1.0.1, which is reported as vulnerable to symlink-following arbitrary file overwrite in set_key. This is lower risk unless the skill uses dotenv file modification features on attacker-influenced paths, but it remains a valid dependency risk.

Static analysis

No suspicious patterns detected.