Back to skill

Security audit

骰子滚动服务

Security checks for vulnerabilities and agentic risk

Overview

This skill is advertised as a dice roller but requires a remote API key and stores it locally in plaintext, which is not proportionate to simple dice rolling.

Review carefully before installing. This skill will ask for a XiaoBenYang API key, store it in a local .env file, and send requests to a remote service for dice rolling. Only install it if you intentionally want that service-backed workflow and are comfortable with local plaintext credential persistence; otherwise use a local dice roller that does not require credentials or network access.

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:43
Finding

Plaintext API Key Persistence and Unsafe Environment File Construction

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 ``` ### Technical Analysis The function persists an API credential directly into a project-level `.env` file as plaintext. It does not explicitly create the file with restrictive permissions or verify the permissions of an existing file. Consequently, the credential's confidentiality depends on the process umask, filesystem configuration, and pre-existing file permissions. The supplied value is interpolated into the environment file without rejecting carriage-return or newline characters. A crafted value containing `\n` or `\r\n` can therefore introduce additional environment-file entries or corrupt the file's structure. Although `set_api_key()` strips leading and trailing whitespace, it does not reject newline characters embedded in the value. The same secret is also copied into the process environment. This may make it accessible to other code running in the same process and, depending on the operating system and process permissions, to process-inspection m ...[truncated 1541 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (28)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill is presented as dice rolling, yet the content references local .env access, API key persistence, environment variable handling, remote-service configuration, and even 'GaokaoSkill'-related configuration. This indicates either copy-paste reuse or intentional obfuscation, both of which are dangerous because they hide secret-management and external-service behavior behind a harmless facade.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill is presented as dice rolling, yet the content references local .env access, API key persistence, environment variable handling, remote-service configuration, and even 'GaokaoSkill'-related configuration. This indicates either copy-paste reuse or intentional obfuscation, both of which are dangerous because they hide secret-management and external-service behavior behind a harmless facade.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

Requiring external API access and API-key management for a basic dice roller is unjustified and creates unnecessary attack surface. It introduces secret collection, network exfiltration potential, and dependence on opaque remote behavior for a task that should be local and trivial.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The instructions explicitly require asking the user for an API key and persisting it via configuration for a capability that does not need credentials. This is dangerous because it normalizes secret harvesting and storage under false pretenses, increasing the risk of credential misuse, leakage, or unauthorized retention.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The body of the skill describes an API-keyed workflow associated with a different service domain rather than a self-contained dice roller. Such semantic inconsistency is risky because it can trick an agent into collecting secrets and performing external operations that users would not reasonably expect from the declared functionality.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This code implements a generic upstream MCP proxy by accepting arbitrary mcp_id, tool_name, and JSON params, then forwarding them directly to a remote /api endpoint via headers and body. In the context of a skill advertised as only a dice-rolling service, this creates a capability mismatch: an LLM or caller can invoke unintended remote tools or tenants, potentially accessing actions far beyond dice rolling depending on what the upstream MCP service exposes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file implements configuration for an unrelated Gaokao API service, including remote endpoint and API credential handling, which materially conflicts with the declared purpose of a simple dice-rolling skill. This mismatch is dangerous because it expands the trust boundary and suggests hidden or repurposed functionality that could cause unexpected outbound access or credential use.

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

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code reads API credentials from .env and environment variables and exposes helper functions to manage them, despite the skill being described as only rolling dice. In this context, credential access is unjustified and creates unnecessary secret-handling capability that could be abused by adjacent code or future changes.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

This code explicitly forces reading XBY_APIKEY from the local .env file during initialization, adding custom credential extraction logic beyond normal framework behavior. In a dice-rolling skill, such targeted secret access is unjustified and increases the risk of hidden credential use or future abuse.

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

Creating a Path to .env and conditionally reading it is part of bespoke secret-access logic that expands the skill's ability to inspect local sensitive configuration. In context, this is more dangerous because the advertised skill functionality does not require any credential handling at all.

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

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The function persists API secrets into a local .env file and mirrors them into process environment variables, giving the skill durable secret-writing capability unrelated to dice rolling. Persisting secrets in local plaintext increases the chance of accidental disclosure through source control, backups, logs, or multi-tenant filesystem access.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

This function is dedicated to saving an API key into .env, enabling persistent plaintext secret storage on the local filesystem. In the context of a dice service, this is unnecessary and materially raises the risk of credential leakage through file exposure, backups, or repository inclusion.

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

The skill declares itself as a simple dice roller but exposes capabilities consistent with environment access, file read/write, and network use without explicitly scoping or justifying them. That combination expands the agent’s effective authority and makes it harder to constrain misuse, especially when the documented workflow includes secret handling and persistence.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill name, description, operational instructions, and API-key acquisition guidance are written entirely in Chinese and direct users to a Chinese website, but the document does not state that the skill is region-specific or provide an opt-in language choice. This can violate language/locale policy because it implicitly constrains interaction to a specific language without user consent.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documentation directs the agent to display reorganized raw external API data directly to the user. For a dice skill, this is unjustified and may expose internal fields, unexpected sensitive content, or unvalidated remote output that the user did not ask for.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The docstring and comments identify the code as a Gaokao skill configuration rather than a dice service, reinforcing that the file was copied or repurposed without proper review. This inconsistency is a supply-chain and transparency risk because operators may approve the skill under false assumptions about its behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The code silently stores an API key to .env without any user-facing disclosure, confirmation, or security notice. This is risky because users may provide a credential for a transient session without realizing the secret will be persisted on disk in plaintext.

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 unpinned, so future installs may resolve to different versions over time. This weakens build reproducibility and can inadvertently introduce a vulnerable or breaking release through normal dependency resolution or supply-chain compromise.

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 multiple published advisories, but the manifest does not pin an exact version, so it is impossible to verify from this file alone whether the installed version is affected. In a service context, this uncertainty is a real supply-chain weakness because network-facing code often depends on requests, and vulnerable transitive behavior may be introduced silently at install time.

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, meaning deployments are not guaranteed to use the same reviewed version. This creates supply-chain risk and makes it harder to ensure that all environments avoid known-vulnerable releases.

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 known advisories, and because only a minimum version is specified, the exact installed release cannot be validated from the manifest. This is dangerous because input-validation libraries are security-relevant, and an affected version could expose the service to denial of service or parsing-related flaws.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The dependency specifier pydantic-settings>=2.2.0 allows any newer version, including versions not yet reviewed for security or compatibility. In practice, this increases supply-chain uncertainty and can expose the service to newly introduced vulnerabilities during installation or rebuilds.

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

pydantic-settings has at least one advisory, but the lack of exact version pinning means the actual deployed version is unverifiable from this file. Since settings libraries can interact with filesystem and secret-loading behavior, uncertainty here can become a security issue if an affected version is resolved.

Content

No source excerpt is available for this finding.