Back to skill

Security audit

动物识别

Security checks for vulnerabilities and agentic risk

Overview

This animal-recognition skill uses a remote API, but it under-discloses image and API-key handling and stores the key in a local plaintext .env file.

Review before installing. Only use this skill with images and API keys you are comfortable sending to xiaobenyang.com infrastructure, and prefer not to provide sensitive photos or internal URLs. Treat the stored .env API key as plaintext local secret material and rotate it if the workspace may be shared, backed up, or committed.

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 File Without Access-Control Hardening

Content
View full analysis

Vulnerability Details

File Location: scripts/config.py, lines 43-63
Vulnerability Type: Plaintext storage of sensitive credentials
Risk Level: Medium

Vulnerable Code

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

The application persists the user-provided API key as plaintext in a working-directory-relative .env file. The implementation does not set or verify restrictive file permissions, reject symbolic links, use an atomic secure-file creation operation, or ensure that the destination is a private, Skill-specific configuration directory.

Path.write_text() relies on the process umask when creating a file and preserves the existing permissions when replacing its contents. Consequently, an existing .env file with permissive permissions can remain readable by unintended local users or processes. Because the path is relative to the current working directory, the secret may also be written into an unexpected directory, including a source repository that could later be archived or committed.

Attack Path

  1. The Skill asks the user for an API key as required by `SKIL ...[truncated 1379 chars]
Remediation
View remediation

Remediation Suggestions

  1. Prefer session-only credential handling or an operating-system credential store instead of persisting the key in plaintext.
  2. If file-based storage is necessary, use a fixed, Skill-specific configuration directory rather than the current working directory.
  3. Create the directory with permissions limited to the current user.
  4. Create the credential file atomically with mode 0600, and verify the resulting ownership and permissions.
  5. Refuse to read from or write through symbolic links. Where supported, use secure open flags such as O_NOFOLLOW, O_CREAT, and O_EXCL.
  6. Write updates to a securely created temporary file in the same private directory and atomically replace the destination.
  7. Add .env to version-control ignore rules and exclude it from logs, diagnostic bundles, build artifacts, and backups where appropriate.
  8. Document credential rotation and revocation procedures for users whose .env file may have been exposed.

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Open-Ended Dependency Constraints Permit Unreviewed Package Updates

Content
View full analysis

Vulnerability Details

File Location: requirements.txt, lines 1-4
Vulnerability Type: Non-reproducible dependency resolution and supply-chain exposure
Risk Level: Low

Vulnerable Code

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

Technical Analysis

Every dependency is specified using only a minimum version. A fresh installation may therefore resolve to any later release accepted by the package installer. Those releases are not necessarily the versions reviewed during this audit.

This creates non-reproducible builds and increases exposure to upstream account compromise, malicious future releases, newly introduced vulnerabilities, and security-relevant behavioral changes. The file also contains no package hashes to verify artifact integrity.

No evidence was found that the listed package names are typosquatted or currently malicious. The finding concerns the unsafe dependency-resolution policy rather than a confirmed malicious dependency.

Attack Path

  1. An upstream package account or distribution channel is compromised, or a later dependency version introduces malicious or vulnerable behavior.
  2. The attacker publishes a newer version satisfying the applicable minimum-version constraint.
  3. A user installs the Skill in a fresh environment without a lockfile or constraints file.
  4. The package installer selects the newer, unreviewed version.
  5. The introduced code executes during installation or when imported and used by the Skill.

Exploitation depends on a compromised or vulnerable upstream release and a subsequent dependency installation or update.

Impact Assessment

The impact depends on the behavior of the selected dependency release and the privileges of the installation or runtime process. In the worst case, compromised dependency code could access the API key, image data, local files readable by the process, and netwo ...[truncated 209 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin each direct and transitive dependency to a reviewed version through a lockfile or generated constraints file.
  2. Require cryptographic hashes for downloaded distributions, such as by using pip install --require-hashes.
  3. Generate lock data from a trusted package index in a controlled build environment.
  4. Update dependencies through a documented review process that includes vulnerability scanning, changelog review, tests, and provenance verification.
  5. Use automated dependency monitoring while preventing unattended production adoption of newly published versions.
  6. Rebuild and review the lockfile separately for each supported Python and platform combination when resolution differs across environments.
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 (35)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The description claims no additional input is required, yet the skill actually requires either an image URL or base64 image data. This is a material mismatch because it obscures both the need for user-supplied content and the fact that potentially sensitive images will be transmitted externally.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The description claims no additional input is required, yet the skill actually requires either an image URL or base64 image data. This is a material mismatch because it obscures both the need for user-supplied content and the fact that potentially sensitive images will be transmitted externally.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The description claims no additional input is required, yet the skill actually requires either an image URL or base64 image data. This is a material mismatch because it obscures both the need for user-supplied content and the fact that potentially sensitive images will be transmitted externally.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill is described as animal image recognition, but this file exposes a generic remote MCP invocation primitive where both the tool name and parameters are caller-controlled. That creates a capability mismatch: a seemingly narrow skill can be used to invoke arbitrary upstream tools or actions, expanding the attack surface well beyond image labeling and enabling unintended data access or side effects depending on the upstream MCP.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file is configured for a completely different 'Gaokao' service while the declared skill is animal recognition. This mismatch is a strong supply-chain/integrity red flag because users and reviewers may grant permissions or trust based on the declared purpose while the code is wired to unrelated infrastructure and identifiers.

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

This module manages credentials and remote service configuration for an external Gaokao-related API that is unrelated to the stated animal-labeling capability. In the context of a narrowly scoped image-labeling skill, unrelated credential handling and external connectivity materially increase the risk of hidden data exfiltration, unauthorized API use, or deceptive functionality.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
83% confidence
Finding

The code explicitly reads the .env file to extract XBY_APIKEY outside normal settings handling, which broadens secret access logic beyond what a simple animal-recognition skill should need. In this mismatched-scope skill, custom secret scraping from local files raises concern 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
83% confidence
Finding

Checking for and reading a local .env file as part of runtime initialization gives the skill direct access to locally stored secrets. In a skill whose advertised purpose is unrelated to external account management, this creates unnecessary credential exposure and weakens trust boundaries.

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 is expressly designed to persist an API key into a plaintext .env file, creating durable local secret storage. In the context of an unrelated animal-recognition skill, that behavior is especially dangerous because it enables undeclared credential retention, accidental disclosure, and potential reuse by unauthorized code or users.

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

Missing User Warnings

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

This function transmits raw base64-encoded image content to an external API without warning the user that the full image leaves the local environment. Since image contents can contain faces, documents, location data, or other sensitive material, silent remote transfer significantly increases privacy and compliance risk and is more dangerous than passing only a URL.

Content

No source excerpt is available for this finding.

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 clearly involves environment access, file writes, and network use. In an agent setting, missing scope declarations weakens least-privilege controls and makes it harder to constrain what the skill may access or modify.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill asks the model to collect an API key from the user and persist it, but it does not warn that the credential will be stored or explain the storage scope and risks. This can lead users to disclose secrets without informed consent and increases the chance of credential leakage through logs, files, or later reuse.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Instructing the model to solicit and store a user API key during ordinary conversation is dangerous because conversational channels are not ideal secret-entry paths and may be logged or exposed to other components. Persisting the credential amplifies the risk by creating a durable secret on disk or in configuration.

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 an unrelated school-search function, indicating copy-paste or documentation integrity problems. In security-sensitive skills, inaccurate tool examples can cause the model or maintainers to invoke the wrong capability, increasing the risk of unintended data handling or misuse.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill does not warn users that image URLs or base64 image content will be sent to an external API. Because images may contain sensitive personal or proprietary information, omitting this disclosure creates a privacy and data-governance risk.

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 display raw API response data bypasses minimization and filtering. Raw upstream responses may contain sensitive metadata, internal identifiers, error traces, or unexpected content that should not be shown to end users without validation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The function retrieves an API key and includes it in the XBY-APIKEY request header, which is a sensitive credential operation. While the code handles missing keys, it does not provide any user-facing disclosure that a stored credential will be used for outbound authentication.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The code forwards arbitrary params directly to an external API with no local validation, minimization, or user-visible disclosure. In the context of a skill advertised as simple animal recognition, this is risky because users may provide images or metadata expecting narrow processing, while the implementation can transmit any supplied content upstream and potentially leak excess data.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill persists API keys to a local .env file and process environment even though that behavior is unnecessary for a simple image-labeling tool. Persisting secrets locally increases exposure through accidental commits, local file disclosure, backups, logs, or reuse by other processes on the host.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Writing an API key into .env without a user-facing warning or explicit confirmation creates an unsafe secret-handling path. Users may not realize the credential is being stored in plaintext on disk, which can lead to inadvertent disclosure or long-term retention beyond the intended session.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The function sends a user-supplied image URL to an external API without any visible disclosure, consent flow, or privacy warning. Because image URLs may reveal personal, sensitive, or internal resources, undisclosed third-party transmission can create privacy, compliance, and data handling risks, especially in an agent skill context where users may assume local processing.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

L091 将项目根目录写为 xiaobenyang_gaokao_skill/,而当前技能从名称、描述到工具定义均为动物识别。该文档内容表明技能说明沿用了其他项目模板,主动传达了与实际技能意图不一致的上下文。

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency uses a lower-bound specifier (requests>=2.31.0) instead of a pinned or tightly constrained version, which makes builds non-reproducible and can result in different environments installing different releases. Because requests has multiple known advisories, lack of pinning also prevents verifying whether deployed versions are patched or vulnerable.

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