Back to skill

Security audit

DeFi收益分析服务

Security checks for vulnerabilities and agentic risk

Overview

The skill is advertised as a DeFi yield analyzer but routes work through a third-party Xiaobenyang MCP service and stores a user API key in a local plaintext .env file.

Install only if you understand that this is not a simple local DefiLlama reader: it requires a Xiaobenyang API key, sends requests to mcp.xiaobenyang.com, and stores that key in plaintext in .env. Prefer a version that clearly documents the proxy service, removes unrelated Gaokao references, limits remote tool scope, and uses managed secret storage instead of saving credentials in the project directory.

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

API Key Persisted in a Plaintext Environment File Without Permission Hardening

Content
View full analysis

Vulnerability Details

File Location: scripts/config.py:43-62
Vulnerability Type: Plaintext sensitive-data storage
Risk Level: Medium

The mandatory workflow in SKILL.md:14-17 instructs the agent to request an API key and pass it to scripts.config.set_api_key(). That function persists the credential in a plaintext .env file.

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 save API key: {e}")
        return False

Technical Analysis

Path.write_text() stores the API key unencrypted and does not explicitly enforce owner-only permissions. When the file already exists, its existing permissions are retained. When it is newly created, access permissions depend on the process umask.

This persistence exceeds the minimum privilege necessary to make an authenticated API request: the key could remain in memory for the current process or be supplied through a managed secret store instead. The implementation also does not verify whether .env is excluded from version control, protected from backups, or inaccessible to other local users and processes.

The key is subsequently transmitted as the XBY-APIKEY header to `https://mcp.xiaobenyang.com/ ...[truncated 1185 chars]

Remediation
View remediation

Remediation Suggestions

  1. Prefer a platform-managed secret store, operating-system credential manager, or session-scoped environment variable instead of persistent plaintext storage.
  2. Do not persist the key unless the user explicitly opts in.
  3. If file persistence is unavoidable, create the file atomically with owner-only permissions such as 0600.
  4. Verify and repair the permissions of an existing .env before reading or updating it.
  5. Store secrets outside the project working tree and ensure .env is excluded from version control, logs, diagnostics, and backups where practical.
  6. Document that the credential is sent to mcp.xiaobenyang.com, including the purpose, destination, retention expectations, and revocation procedure.
  7. Provide a function that removes the stored key and clears it from the process environment when no longer needed.

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Unbounded Dependency Constraints Permit Installation of Unreviewed Future Releases

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1-4
Vulnerability Type: Unpinned third-party dependencies
Risk Level: Low

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

Technical Analysis

Every dependency uses a minimum-only version constraint. A future package release will satisfy these constraints regardless of whether that release has been reviewed or tested with the Skill. Consequently, installations performed at different times may resolve to different dependency versions.

This weakens build reproducibility and expands the supply-chain attack surface. If a dependency account or release process is compromised, a malicious future version could be selected automatically. Even without malicious activity, incompatible releases may change security-sensitive behavior.

The audit found no evidence that the named packages are currently malicious or that dependencies are fetched from an unsafe package index. The risk arises from accepting arbitrary future releases without lockfile or hash verification.

Attack Path

  1. An attacker compromises the publication process or maintainer account of a listed dependency.
  2. The attacker publishes a malicious version whose version number remains compatible with the applicable >= constraint.
  3. A later installation resolves dependencies without a reviewed lockfile or hashes.
  4. The package manager downloads and installs the malicious release.
  5. Malicious package code executes during installation or when imported by the Skill.

Impact Assessment

Impact depends on the privileges of the process installing or running the Skill. A compromised dependency could access the API key held in .env or the process environment, inspect data available to the process, make network requests, alter Skill behavior, or execute code under the Skill process account. There is no evidence that this issue indep ...[truncated 69 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin each dependency to a reviewed exact version.
  2. Generate and commit a lockfile containing transitive dependency versions.
  3. Require cryptographic package hashes during installation, for example through a hash-locked requirements file.
  4. Install packages only from an explicitly trusted package index over authenticated TLS.
  5. Use automated vulnerability and integrity scanning while requiring human review before dependency updates are merged.
  6. Test upgrades in an isolated environment before deploying them to the Skill runtime.
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 (31)

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

The skill claims to be a DeFi yield analyzer but the documentation describes reading and writing a local .env file, persisting an API key, and references unrelated '小笨羊高考' configuration. This discrepancy strongly suggests copy-paste drift or deceptive packaging that could lead to credential capture and unauthorized local configuration changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill claims to be a DeFi yield analyzer but the documentation describes reading and writing a local .env file, persisting an API key, and references unrelated '小笨羊高考' configuration. This discrepancy strongly suggests copy-paste drift or deceptive packaging that could lead to credential capture and unauthorized local configuration changes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill mandates collecting an API key for xiaobenyang.com even though the stated purpose is DefiLlama-based DeFi analysis. In context, this mismatch materially increases the risk of phishing-like secret collection because users are asked for credentials unrelated to the declared service.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The code is a generic remote tool invocation client that accepts arbitrary mcp_id, tool_name, and params and forwards them to an external MCP API, while the skill is described as only analyzing DeFi yield opportunities. This scope mismatch is dangerous because an AI agent integrating the skill may assume it is constrained to DefiLlama-style read-only analytics, but in practice it can invoke any upstream tool exposed by the remote service, creating a confused-deputy capability expansion and possible unauthorized external actions or data access.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The configuration clearly targets an unrelated 'gaokao' service (XBY_GAOKAO_, xiaobenyang.com, mcp_id) instead of the advertised DeFi yield analysis skill. In a security review, this mismatch is dangerous because it indicates repurposed or misbound infrastructure and credentials, which can route user data or authentication material to an unexpected third-party 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
91% confidence
Finding

The code forcefully reads .env and extracts XBY_APIKEY manually, bypassing normal settings abstractions and increasing the likelihood of hidden credential handling. In the context of an unrelated service identity inside a DeFi skill, this manual secret retrieval is more suspicious because it appears designed to ensure access to a third-party credential regardless of declared 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
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
96% confidence
Finding

This function explicitly persists an API key into .env, creating a durable local secret that may be exposed through repo commits, filesystem access, backups, or other local tooling. Given that the credential appears unrelated to the skill's advertised DeFi purpose, the persistence is more dangerous because users may not realize they are storing access to another service.

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

The skill declares no explicit tool scope or permission boundaries even though it appears to rely on environment access, file read/write, and network operations. In an agent setting, missing scope declarations weakens least-privilege controls and makes it harder for operators to understand or restrict what the skill may do.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill name and description are presented only in Chinese, and the instructions throughout the file are written as mandatory guidance without offering the user any language choice. This can violate language/locale policy when a skill effectively requires a specific language absent an explicit opt-in or documented regional justification.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill explicitly instructs the agent to ask the user for an API key in natural language and then persist it. This creates a sensitive-data collection path that is easy to abuse, hard to audit, and especially concerning here because the key is for an unrelated external service.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The workflow example references unrelated school-search behavior, contradicting the DeFi analysis use case. Such inconsistencies make it difficult to trust the skill's actual behavior and can mask accidental or unauthorized calls to unrelated tools or services.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The instruction to directly present raw API response data to the user can expose secrets, internal metadata, or unexpected sensitive content returned by upstream services. Raw passthrough also removes an opportunity to filter malicious or irrelevant data before display.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill persists and manages an API credential unrelated to the stated DeFi data analysis functionality. Even if not overtly malicious, collecting and storing a credential outside the declared scope expands trust boundaries and can enable unauthorized reuse of user secrets or silent calls to another backend.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

save_api_key_to_env writes secrets directly into .env and updates the process environment without any visible consent, warning, or secure storage controls. This increases the chance of accidental exposure through source control, backups, local file disclosure, or other tooling that reads dotenv files.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documented project structure names an unrelated gaokao skill directory, which indicates the package may have been repurposed without proper review. While lower impact by itself, in combination with other mismatches it reinforces the risk that the skill's real behavior is not what it claims.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency specification uses a lower bound (requests>=2.31.0) rather than a pinned or tightly constrained version, which makes builds non-reproducible and can allow installation of later releases with breaking changes or newly introduced vulnerabilities. In a service that fetches external DeFi data, dependency integrity matters because network-facing libraries are part of the attack surface.

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 requests has multiple published advisories across versions, so the project cannot verify at review time whether the installed version is affected. This is dangerous because requests is a core HTTP client and any vulnerable resolved version could impact outbound request security, credential handling, or TLS behavior.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

pydantic>=2.7.0 is unpinned, so deployments may resolve to different versions over time, weakening reproducibility and making it hard to verify whether a vulnerable release is in use. Since pydantic handles parsing and validation, unexpected version drift can affect both security and correctness of input handling.

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

Because pydantic is unpinned and known advisories exist for some versions, the deployed package may unknowingly fall on a vulnerable release. Since pydantic processes structured input and configuration data, vulnerable versions can create denial-of-service or validation bypass risks depending on usage.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
93% confidence
Finding

pydantic-settings>=2.2.0 is not pinned, leaving the installed version dependent on resolver timing and upstream releases. For configuration-loading components, version drift can expose the service to newly introduced flaws or behavior changes in environment/secret handling.

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

The project does not pin pydantic-settings despite known advisories affecting some versions, so there is no assurance the installed release is safe. This is particularly relevant for settings and secret-loading code, where vulnerable behavior can affect local file access or secret boundary enforcement.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.