Back to skill

Security audit

子网计算服务

Security checks for vulnerabilities and agentic risk

Overview

This subnet skill is not clearly malicious, but it asks for an API key, stores it in a plaintext .env file, sends subnet inputs to an external service, and contains unrelated gaokao project remnants.

Install only if you are comfortable giving this skill a XiaoBenYang API key and having subnet inputs sent to that service. Use a limited/revocable key, avoid shared or committed workspaces, and delete or protect the generated .env file after use. The gaokao naming mismatch should be clarified by the publisher before routine use.

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

API Key Persisted in a Plaintext File Without Enforced Access Restrictions

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 persistently stores the supplied API key as plaintext in a relative `.env` file. `Path.write_text()` does not explicitly enforce owner-only permissions. When a new file is created, its effective permissions depend on the process umask. If that umask is permissive, other local accounts or processes may be able to read the credential. The relative path also means that the destination depends on the current working directory. The implementation does not verify that an existing `.env` is a regular file owned by the current account, nor does it reject symbolic links before overwriting the file. The confirmed primary weakness is plaintext credential storage without enforced access restrictions; unsafe destination replacement is an additional hardening concern. The API client later sends this key in the `XBY-APIKEY` request header to the configured upstream service. Consequently, disclos ...[truncated 1265 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unbounded Dependency Ranges Prevent Reproducible and Auditable Installation

Content
View full analysis
=2.31.0 pydantic>=2.7.0 pydantic-settings>=2.2.0 python-dotenv>=1.0.1 ``` ### Technical Analysis Every dependency is specified only with a minimum version. A future installation can therefore resolve to package releases that did not exist when the Skill was reviewed. The file also provides no cryptographic hashes or lockfile, so the installed dependency graph cannot be reliably reproduced or verified against the audited environment. No evidence was found that the listed package names are currently malicious or typosquatted. The weakness is that later, unaudited releases and transitive dependency changes are accepted automatically. If an upstream project or package-distribution account is compromised, or a future release introduces malicious or vulnerable behavior, a new installation may retrieve and execute that release. Python packages can execute code during installation, and imported dependency modules execute under the privileges of the process running the Skill. The lack of exact pins and hashes therefore expands the supply-chain trust boundary beyond the versions actually audited. ### Attack Path 1. An attacker compromises a listed dependency, one of its transitive dependencies, or its package-publishing account and publishes a malicious version satisfying the declared minimum constraint. 2. A user or deployment pipeline installs the project at a later time with `pip install -r requirements.txt`. 3. The resolver selects the malicious version because no upper bound, exact pin, lockfile, or approved hash prevents it. 4. Malicious package code executes during installation or when the Skill imports the dependency. 5. That code operates with the installer or Skill process's privileges and may access files, environmen ...[truncated 764 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (40)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The file claims subnet-planning functionality but also references reading and writing .env, managing external-service configuration, and even unrelated gaokao-oriented semantics. Such contradictions strongly indicate copy-paste or deceptive packaging, which can conceal secret handling and external communication not expected for a subnet utility.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The file claims subnet-planning functionality but also references reading and writing .env, managing external-service configuration, and even unrelated gaokao-oriented semantics. Such contradictions strongly indicate copy-paste or deceptive packaging, which can conceal secret handling and external communication not expected for a subnet utility.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The documentation claims an IPv4 subnet service but instructs the agent to obtain an API key for an external service and includes unrelated tool references. In context, this makes the skill more dangerous because a simple network-planning skill should not need hidden third-party dependencies and secret collection without clear disclosure.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The operational documentation contradicts the stated purpose by describing unrelated gaokao/school-search API usage and project structure. This undermines user trust and creates a realistic risk that the agent will route data to the wrong backend or execute workflows unrelated to the user’s subnet task.

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

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file implements API key loading, retrieval, and persistence for an external service, which is unrelated to an IPv4 subnet calculation tool's stated purpose. This capability expands the skill's trust boundary and introduces unnecessary secret-handling behavior that could be abused to store, read, or redirect credentials to a service users do not expect.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code reads a secret from .env and environment variables, exposes it through getters, and persists updated values back to disk. For a subnet planning tool, this is disproportionate functionality that creates unnecessary credential exposure risk, especially in shared workspaces, repositories, or agent execution environments.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

This code explicitly forces reading XBY_APIKEY from a local .env file, bypassing the expectation that a subnet tool should operate without handling unrelated credentials. In the context of a mislabeled skill, explicit secret file parsing is more dangerous because it enables undeclared credential collection and use.

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

The existence check precedes direct reading of a local .env file containing secrets, enabling the skill to access persisted credentials from the workspace. In a tool that claims to provide IPv4 subnet calculations, this secret-access behavior is unnecessary and increases the risk of credential exposure or covert reuse.

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

This function persists an API key to a plaintext .env file, creating durable local secret storage that may be exposed through filesystem access, backups, sync tools, or accidental commits. Because the skill is presented as a subnet calculator, this credential persistence is unexpected and materially increases the risk profile.

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

The skill declares no explicit tool scope or permission boundaries while the described/project capabilities imply environment access, file read/write, and network use. In an agent setting, missing scope declarations weakens least-privilege controls and makes it harder to constrain unexpected behavior such as credential persistence or outbound API access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs the model to ask the user for an API key and persist it, but provides no safeguards on storage, masking, retention, or user consent. In an agent context this creates a clear secret-handling risk, especially since the secret may be written to .env or other persistent storage accessible beyond the current session.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill creates a natural-language flow for collecting and retaining a user-provided API key, including saving it via configuration. This is dangerous because users may disclose secrets in chat that are then persisted, logged, or exposed to components not intended to handle credentials.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The instructions tell the model to directly display raw API response data to the user without review or filtering. If the upstream service returns sensitive fields, debugging data, tokens, or unexpected content, the skill could leak that information verbatim to the user or downstream logs.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This file implements a generic remote MCP/API invocation primitive that accepts arbitrary mcp_id, tool_name, and params and forwards them upstream, which exceeds the stated subnet-calculation purpose of the skill. In a narrowly scoped networking utility, this creates an unnecessary capability expansion that can be abused to invoke unintended remote tools, exfiltrate user-supplied data, or bypass local business restrictions by using this component as a general-purpose proxy.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The code retrieves a credential and forwards arbitrary parameters to a remote API even though the skill is described as an IPv4 subnet planning service. That mismatch indicates overbroad remote-execution/forwarding capability without strong justification, increasing the attack surface and making it easier for the skill to be repurposed beyond its advertised function.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The function retrieves an API key via get_api_key() and then uses it for an upstream request, but this file provides no user-visible disclosure that stored credentials are being accessed. Internal exceptions and comments do not inform the user about credential use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code sends user-provided parameters and an API key to an external service but contains no mechanism in this layer to ensure disclosure, consent, or minimization. While not a memory-safety flaw, it is a real data-transfer and secret-handling risk because users may reasonably assume a local subnet calculator is not transmitting their inputs or using remote credentials.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The class docstring references an unrelated '高考Skill配置', which conflicts with the declared subnet service purpose. This mismatch is a supply-chain trust signal: it suggests code reuse from another project or undeclared functionality, making the credential-handling behavior more suspicious and increasing the chance of hidden or unintended behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

User-facing natural-language strings and documentation in this file are entirely in Chinese, including configuration descriptions and error messages, with no indication of language choice or opt-in. This can constitute a language-policy violation if the skill is expected to support users without forcing a specific language.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The function persists an API key to a local .env file without any user-facing consent, warning, or indication of storage location and retention. Silent credential persistence can lead to accidental disclosure through local file access, backups, logs, workspace sharing, or repository commits.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This code sends user-supplied network information to an external API via call_api, which is a network transmission covered by the missing-warning rule for code files. The function contains no confirmation prompt, logging, or meaningful docstring disclosure that user data will be sent off-process or off-host.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This wrapper forwards IP addressing data to an external API using call_api, but the surrounding code and docstring do not disclose that the data leaves the local process. Under the rule, network/HTTP transmission in code should have some visible warning, comment, or documentation unless already clearly disclosed elsewhere.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The function sends the provided IP and network values to an external API through call_api, but there is no local disclosure, prompt, or explanatory comment about that transmission. Because the data may reflect system or user network details, a warning or clear documentation is expected.

Content

No source excerpt is available for this finding.