Back to skill

Security audit

域名查询服务

Security checks for vulnerabilities and agentic risk

Overview

The skill appears intended to perform domain lookups through a third-party API, but it persists the required API key in a plaintext .env file and contains copy-paste documentation mismatches that users should review before installing.

Review this skill before installing. It sends lookups and the XBY API key to XiaoBenYang's API and stores the key in a local .env file. Prefer using a limited-scope key, avoid shared workspaces, check file permissions, and remove the .env entry when finished.

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

API Key Persisted in a Plaintext File Without Restrictive Permissions

Content
View full analysis

Vulnerability Details

File Location: scripts/config.py, lines 46–68
Vulnerability Type: Plaintext storage of sensitive credentials with insufficient permission hardening
Risk Level: Medium

Vulnerable Code

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()
        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 permanently writes the user-supplied API key to a plaintext .env file in the process working directory. Path.write_text() does not explicitly enforce owner-only permissions.

For a newly created file, its permissions are determined by the process umask and may permit access by other local users. If .env already exists with overly broad permissions, rewriting it does not correct those permissions. The credential also remains on disk after the Skill finishes, increasing its exposure window.

The audit confirmed that this key is subsequently used as the XBY-APIKEY authentication header for requests to https://mcp.xiaobenyang.com/api. Disclosure may therefore allow unauthorized use of the associated API account.

Attack Path

  1. A user provides an XBY_APIKEY credential as required by the Skill.
  2. set_api_key() invokes `sav ...[truncated 1063 chars]
Remediation
View remediation

Remediation Suggestions

  1. Prefer session-only credential handling or an operating-system secret manager instead of persistent plaintext storage.
  2. If file persistence is necessary, store the credential in a dedicated application configuration directory rather than the current working directory.
  3. Create the secret file atomically with owner-only mode 0600; do not rely on the process umask.
  4. When updating an existing file, explicitly verify and correct its permissions before writing.
  5. Refuse to write through symbolic links and validate that the destination is a regular file owned by the expected user.
  6. Avoid retaining the key longer than required and provide a secure credential-removal mechanism.
  7. Document where the key is stored, how it is protected, and which remote service receives it.
  8. Add automated tests confirming that newly created and updated secret files are inaccessible to group and other users.
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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (24)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The file claims RDAP/WHOIS/DNS lookup functionality, yet the static evidence indicates no such core capability and instead references API-key storage and an unrelated service context. This can mislead operators into supplying credentials and domain queries to a skill whose real behavior is different, increasing risk of secret misuse, data exfiltration, or unauthorized third-party API access.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The file claims RDAP/WHOIS/DNS lookup functionality, yet the static evidence indicates no such core capability and instead references API-key storage and an unrelated service context. This can mislead operators into supplying credentials and domain queries to a skill whose real behavior is different, increasing risk of secret misuse, data exfiltration, or unauthorized third-party API access.

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

This code forcibly reads a specific key from .env outside the normal settings flow, creating bespoke secret-handling behavior that is harder to audit and easier to misuse. The manual parsing bypasses safer secret-management patterns and normalizes direct access to stored plaintext credentials.

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

Creating a hard-coded Path('.env') for secret access contributes to insecure credential handling by tying the application to a plaintext local file. In the context of a domain-query service, this is unnecessary secret-management complexity and increases the chance of accidental exposure.

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

This function explicitly persists an API key to a local .env file, creating a durable plaintext secret on disk. That materially increases exposure risk through accidental commit, local malware, shared workstations, backups, or unauthorized file reads; because API keys can often be reused immediately, compromise impact can be significant.

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

The skill declares no explicit tool scope or permission boundaries even though it appears capable of environment access, file read/write, and network operations. In an agent setting, missing scope declarations reduce transparency and can allow broader-than-expected actions such as persisting secrets or making arbitrary outbound requests.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill's name, description, required workflow, and operational instructions are entirely specified in Chinese, with imperative language directed at the model, but there is no indication that the user can choose another language or locale. Under the policy for natural-language violations, a skill that effectively enforces a specific language without opt-in should be flagged unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The workflow example references an unrelated function, search_schools, inside a supposedly domain-lookup skill. Cross-domain documentation drift is a strong signal that instructions may have been copied from another project, which can cause an agent to invoke unintended capabilities or expose user data to the wrong backend.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code embeds user-facing natural-language messages and documentation entirely in Chinese, including the class and function docstrings and the API-key error message. Under the policy, forcing a specific language without user opt-in or a documented regional justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The class docstring says "小笨羊高考Skill配置", indicating configuration for a gaokao/education-related skill, while the manifest says the skill is a domain query service. This is an active documentation-to-intent contradiction rather than a mere omission.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This file implements persistent API key storage and retrieval logic even though the declared skill is a domain-query service. That mismatch increases suspicion because credential-handling code expands the attack surface and may collect or retain secrets unnecessarily. If the skill or host is compromised, the plaintext key in .env can be exposed and reused.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The code writes the supplied API key directly into a local .env file without any warning, confirmation, or protection. Persisting secrets in plaintext can leak credentials through source-control mistakes, local compromise, backups, logs, or multi-user system access.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest presents this skill as a domain query service, but the documented project tree is labeled xiaobenyang_gaokao_skill, which suggests a different gaokao/admissions-oriented skill. This contradicts the file's stated identity and indicates the documentation does not accurately describe the codebase it claims to represent.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
98% confidence
Finding

The dependency uses a lower-bound constraint (requests>=2.31.0) rather than an exact pinned version, which makes builds non-reproducible and can cause different environments to install different releases. In a network-facing domain lookup service, this also makes it harder to verify whether a deployed version includes fixes for known security issues or unexpectedly pulls in a newly introduced vulnerable release.

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

The manifest does not pin requests, and the package has multiple known advisories, so it is impossible to determine from this file whether the deployed version is affected. For a service that performs external network queries, using an unverifiable HTTP client version increases the risk of credential leakage, request handling flaws, or other known library issues being present unnoticed.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The pydantic dependency is not pinned to a specific reviewed release, so installations may vary over time and across systems. This weakens supply-chain control and leaves uncertainty about whether an affected version is installed, especially relevant for a service likely to parse external input such as domain names and configuration.

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

Because pydantic is not pinned, the actual installed version cannot be verified against known advisories from the manifest alone. Since pydantic commonly processes untrusted input and settings, uncertainty about the exact version can expose the service to parser or validation-related vulnerabilities without obvious visibility.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

pydantic-settings is specified with a minimum version only, so dependency resolution can select different versions in different deployments. That creates uncertainty around exposure to package advisories and makes configuration-handling behavior less predictable in production.

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

The dependency pydantic-settings has a known advisory history, but the unpinned requirement prevents verification of whether a safe version is installed. Because this package influences configuration and secrets loading, version ambiguity can matter if a vulnerable release is selected during installation.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

python-dotenv is unpinned, which introduces supply-chain risk and non-reproducible builds by allowing any newer version satisfying the lower bound. Because this package can affect environment/configuration loading, uncertainty in version selection can have security consequences if a vulnerable or behavior-changing release is installed.

Content

Scanner excerpt · requirements.txt (reported line 4)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: python-dotenv has 2 known advisory(ies) (CVE-2026-28684 (python-dotenv: Symlink following in set_key allows arbitrary file overwrite via ); CVE-2026-28684 (python-dotenv reads key-value pairs from a .env file and can set them as environ)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
87% confidence
Finding

python-dotenv has known advisories, yet the manifest leaves the installed version undefined within a broad range, preventing reliable security verification. As a configuration-loading library, a vulnerable version could affect file handling or environment management in ways that are hard to detect after deployment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

Natural-language strings such as docstrings and messages are presented exclusively in Chinese, and the file does not indicate that the skill is intentionally region-specific or that users can choose another language. This can violate language/locale policy when no opt-in or justification is provided.

Content

No source excerpt is available for this finding.