Back to skill

Security audit

加密货币数据API服务

Security checks for vulnerabilities and agentic risk

Overview

This skill needs review because it advertises a no-configuration DexPaprika crypto service but requires and stores a XiaoBenYang API key and routes calls through a different backend.

Install only after the publisher reconciles the DexPaprika/XiaoBenYang identity mismatch, explains exactly which backend receives requests and API keys, and replaces plaintext .env key storage with explicit consent and safer credential handling. Treat any key entered into this skill as a XiaoBenYang/XBY key that may persist on disk.

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

API Key Persisted in Plaintext Without Secure File Controls

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 ``` ### Technical Analysis The function stores the user-provided API key as plaintext in a `.env` file resolved relative to the process's current working directory. It does not enforce restrictive file permissions, verify file ownership, reject symbolic links, or use an atomic and securely created credential file. When a new file is created, its effective permissions depend on the process umask. An unsafe umask can make the credential readable by other local users. If `.env` already exists with permissive permissions, `Path.write_text()` does not correct those permissions. The use of a current-working-directory-relative path also creates a symbolic-link risk. If an attacker can prepare the working directory and replace `.env` with a symbolic link, the write operation follows that link. This can disclose the API key at an attacker-selected same-privilege location or overwrite the linked file with reconstructed environment-file content. The Skill instructions require collecting and saving the API key when it is absent, so this behavior occurs ...[truncated 1422 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 (31)

Description-Behavior Mismatch

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The configuration identifies a different service/domain and namespace (XBY_GAOKAO, xiaobenyang.com) than the declared crypto data skill. That cross-service identity mismatch is a strong supply-chain red flag because credentials intended for one skill could be redirected to an unrelated service, enabling secret capture or unauthorized data flow to an unexpected backend.

Content

No source excerpt is available for this finding.

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill description says it is a crypto/DEX data service without configuration, but the content indicates local .env access, persistent API-key storage, and references to an unrelated gaokao-themed project structure. Such inconsistencies strongly suggest copy-paste drift or repurposed code, which raises the risk of hidden behaviors, wrong endpoints, and mishandling of sensitive credentials.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill description says it is a crypto/DEX data service without configuration, but the content indicates local .env access, persistent API-key storage, and references to an unrelated gaokao-themed project structure. Such inconsistencies strongly suggest copy-paste drift or repurposed code, which raises the risk of hidden behaviors, wrong endpoints, and mishandling of sensitive credentials.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The implementation materially contradicts the declared skill identity: instead of a DexPaprika crypto/DEX data client, it is a generic client for a different upstream service ('小笨羊MCP') using externally supplied API credentials and custom headers. This kind of capability/identity mismatch is dangerous because users and hosting platforms may grant trust, network access, or secrets based on the manifest, while the code actually proxies requests to an unrelated remote service.

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

This code explicitly reads the .env file at runtime to extract a specific API key outside the standard settings framework. In the context of a skill whose declared purpose does not mention credential management and whose identity mismatches the manifest, this direct secret scraping behavior raises the risk of undisclosed credential collection and confusing secret provenance.

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

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill metadata claims this is a no-configuration crypto/DEX data service, but the code implements persistent API key management and writes secrets to a local .env file. This mismatch is dangerous because users and hosting agents may provide or store credentials under false assumptions, increasing the risk of undisclosed secret collection and retention.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
89% confidence
Finding

The save routine opens and rewrites the local .env file specifically to store an API key. In a skill context advertised as requiring no configuration, this persistent secret handling is more dangerous because users and orchestrators may not anticipate local credential retention or secure the file appropriately.

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 no explicit tool scope while its documented workflow requires environment access, local file read/write, and network calls. In an agent ecosystem, missing scope boundaries increases the chance of over-privileged execution, unintended side effects, and abuse of credential-handling or filesystem capabilities.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs the agent to solicit an API key from the user and persist it locally via set_api_key without warning about storage location, retention, or security controls. This creates a credential-handling risk: users may disclose secrets without informed consent, and persisted keys may be exposed through filesystem access, logs, backups, or later misuse.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The example tool call references an unrelated gaokao school-search function instead of the declared cryptocurrency tools, indicating documentation and likely implementation drift. This can cause an agent to invoke unintended functionality or signal that the skill was repurposed from another project without adequate review.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The class documentation explicitly identifies this code as a '小笨羊MCP API客户端', which directly conflicts with the manifest's DexPaprika service identity. While a docstring alone is not exploitable code, in this context it corroborates deceptive packaging and indicates the mismatch is intentional rather than accidental, increasing the likelihood of users being misled about what service receives their requests and API key.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The client exposes a generic remote tool invocation primitive by allowing arbitrary tool_name, params, and mcp_id to be sent upstream, rather than enforcing a narrow set of crypto/DEX data operations. In an AI-agent skill context, this broad remote execution/proxy behavior can be abused to invoke unintended capabilities on the external MCP service, expanding the attack surface beyond the declared purpose of simple market data retrieval.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The function docstring states it calls the '小笨羊MCP API', again contradicting the advertised DexPaprika crypto data service. This inconsistency reinforces that the skill is masquerading as one service while routing data and credentials to another, which is a supply-chain trust issue especially dangerous in agent ecosystems that rely on manifest descriptions for approval decisions.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The settings model is configured with the XBY_GAOKAO_ prefix, but the custom loader bypasses that and directly reads XBY_APIKEY from .env and the environment. This inconsistency can cause operators to misunderstand which secret is being consumed, leading to accidental use of the wrong credential and weakening auditability of secret handling.

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 persists the provided API key to a local .env file and also exports it into the process environment without any user-facing warning. Secret persistence expands exposure because the key may be committed, backed up, read by other local tooling, or remain on disk longer than users expect.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The document is primarily written in Chinese, but the core tool-selection rules are presented as imperative English instructions such as 'REQUIRED FIRST STEP' and 'Always call this first' without indicating that English is required or optional. This can violate language/locale policy expectations when a skill imposes a language format without user opt-in or justification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documented project structure names an unrelated gaokao_skill directory, which is inconsistent with the advertised cryptocurrency service. Although lower severity by itself, this discrepancy suggests packaging or provenance issues that reduce confidence in what code will actually run and may conceal unintended behaviors.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The dependency declaration uses a lower-bound constraint only (requests>=2.31.0), which allows future unreviewed versions to be installed and prevents reproducible builds. In a security-sensitive service that fetches external cryptocurrency data, this increases supply-chain risk and makes it harder to ensure vulnerable or breaking releases are excluded.

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

The manifest does not pin requests, and the package has multiple published advisories, so it is impossible to verify from this file whether a safe version will be installed. In an API service that makes outbound network requests, unresolved version selection materially increases the chance of deploying a version affected by request-handling or credential-leak issues.

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 pull different versions over time, including versions with newly introduced security issues or behavioral changes. For an API-facing skill, inconsistent dependency resolution can affect validation logic and weaken assurance that known-safe versions are deployed.

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

Because pydantic is not pinned and has known advisories, the dependency state is unverifiable from the manifest alone. For a service likely to parse and validate untrusted external data, uncertainty around the exact validation library version can expose the system to avoidable parser or denial-of-service flaws.

Content

No source excerpt is available for this finding.