Back to skill

Security audit

人头人体检测

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to perform remote image detection, but it stores the user's API key in a plaintext .env file and sends image data to an external service without enough user-facing privacy and storage controls.

Review this skill before installing. Use it only if you are comfortable sending images to the XiaoBenYang remote API and storing the XBY_APIKEY credential in a local plaintext .env file. Prefer a dedicated low-privilege API key, keep .env out of source control and shared exports, and rotate the key if the workspace may have been shared.

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 a Plaintext Environment File

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") ``` ### Technical Analysis The `save_api_key_to_env` function persistently writes the user-supplied API key to a `.env` file in plaintext. The code does not explicitly create or update the file with restrictive permissions. Consequently, the effective access controls depend on the process umask and any pre-existing file permissions. The project instructions explicitly direct the agent to collect the API key and invoke `set_api_key`, which calls this function. Therefore, credential persistence is part of the normal execution path rather than an unreachable utility. Although exploitation requires access to the local filesystem, project workspace, backups, or exported artifacts, any process or user able to read the `.env` file can recover the credential without further decoding or privilege escalation. ### Attack Path 1. A user supplies an `XBY_APIKEY` credential as required by the Skill. 2. The agent calls `scripts.config.set_api_key(api_key)`. 3. `set_api_key` invokes `save_api_key_to_env`. 4. The function stores the complete credential as `XBY_APIKEY=` in the working directory's `.env` file. 5. A local use ...[truncated 1116 chars]
Remediation
View remediation
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 (29)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared purpose omits that the skill reads from .env, persists credentials, modifies environment state, and manages remote service configuration. These behaviors materially expand the skill from simple inference into credential handling and local configuration mutation, which raises security and privacy risk if users are not clearly informed.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose omits that the skill reads from .env, persists credentials, modifies environment state, and manages remote service configuration. These behaviors materially expand the skill from simple inference into credential handling and local configuration mutation, which raises security and privacy risk if users are not clearly informed.

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

The code forcibly reads a specific API key from the local .env file during initialization rather than relying on standard secret injection flows. In the context of a skill advertised for image detection, this undisclosed secret-harvesting behavior is suspicious because it increases coupling to local credential material and may enable unintended credential collection or reuse.

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

Opening and reading the .env file directly to extract an API key broadens access to local secrets beyond what is necessary for a narrowly described detection skill. If the skill or its environment is compromised, this direct secret-reading pattern makes credential exposure easier and less auditable than standard secret management.

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 explicitly designed to save an API key into a local .env file in plaintext. Plaintext credential persistence is high risk because it can lead to credential disclosure through filesystem access, backups, debugging artifacts, or accidental repository commits, especially when the skill's stated purpose gives users no reason to expect secret storage behavior.

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 boundary even though it clearly relies on environment access, file reads/writes, and network communication. In an agent setting, missing scope declarations increase the chance that the model or runtime will grant broader capabilities than users expect, weakening least-privilege controls.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill requires users to provide an API key and image input to an external service but does not clearly warn that credentials and image data will be transmitted off-platform. For an image-analysis skill, this context makes the omission more dangerous because uploaded images may contain faces or other sensitive personal data.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill instructs the agent to ask for a user API key and persist it via configuration, creating a credential retention risk. Storing user-supplied secrets in .env or similar local files can expose them to later reads, logs, backups, or unrelated skills, especially in shared agent environments.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documentation instructs the model to call scripts.tools.search_schools(...) and describes returning data for that flow, which contradicts this skill's stated purpose of head/person detection. The project structure also names xiaobenyang_gaokao_skill, reinforcing that the embedded documentation does not match the actual declared intent of this skill.

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 review, filtering, and minimization. If the upstream service returns unexpected sensitive fields, internal metadata, or error traces, the agent may leak them straight to the user or downstream systems.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code sends the params payload to an external HTTP endpoint via requests.Session.post, which may transmit user or system data off-host. Aside from internal logging and a brief docstring, there is no visible confirmation prompt or user-facing disclosure in the file warning that request data will be sent to a remote API.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The config class docstring describes a different skill domain (高考) than the declared skill (human head/body detection), which is a strong integrity signal that this code may have been copied from another project or repurposed without proper review. In security-sensitive agent skills, such mismatch increases the risk of hidden or unnecessary behaviors because the implementation no longer clearly matches the advertised purpose.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The presence of a remote base_url, MCP identifier, and API key configuration shows the skill depends on an external service rather than clearly operating as a local detector as described. That mismatch is dangerous because user images or metadata may be sent off-device to a third party without clear disclosure, creating privacy, data handling, and trust risks.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code accepts and persists an external API credential to a local .env file even though the stated purpose is image detection. Persisting secrets to disk expands the attack surface by exposing credentials to accidental source control inclusion, local file disclosure, or reuse by unrelated components, and the behavior is not transparently justified by the skill description.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The function silently persists the API key into a .env file and exports it into the process environment without any user-facing confirmation, warning, or audit trail. This can cause users or operators to unknowingly store sensitive credentials in plaintext on disk where they may be backed up, leaked, or committed to version control.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This function sends a user-supplied image URL to an external API, but the file shows no user-facing disclosure, consent flow, or data-handling notice. Because images may contain sensitive personal data and the skill’s purpose is person/head detection, transmitting them to a third-party service creates a real privacy and data-governance risk if users are unaware of the transfer.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This function transmits raw base64-encoded image content directly to an external API without any visible warning or consent mechanism in the file. Since the payload may contain highly sensitive biometric or personal imagery, undisclosed outbound transfer increases privacy, compliance, and misuse risks beyond ordinary API usage.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

All natural-language instructions and descriptions are written exclusively in Chinese, with no indication that the user may choose another language or that the locale restriction is intentional and justified. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency is specified with a lower-bound range instead of an exact version, which makes builds non-reproducible and can result in unexpectedly installing a vulnerable or incompatible release. Because requests has multiple known advisories, leaving the version unpinned weakens supply-chain assurance and makes it hard to verify whether deployments are affected.

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

requests has known advisories, but the manifest does not specify an exact version, so it is impossible to confirm whether the installed release is patched. The danger here is uncertainty: an environment may resolve to a vulnerable version, particularly in automated or fresh installs, enabling known issues such as credential leakage or TLS/verification-related flaws depending on the resolved release.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
92% confidence
Finding

Using pydantic>=2.7.0 allows any newer major-compatible release that satisfies the constraint, which can introduce vulnerable versions or breaking behavior without review. This is a supply-chain hygiene issue rather than an immediate exploit, but it reduces the ability to attest to what code actually runs.

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

pydantic has published advisories, and because the requirement is not pinned, the actual installed version cannot be verified as safe. If a vulnerable release is resolved, issues such as denial of service or parsing edge-case abuse may become reachable through data validation paths.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
90% confidence
Finding

pydantic-settings>=2.2.0 is unpinned, so installations may resolve to different versions over time, including versions later found vulnerable. This undermines reproducibility and makes advisory exposure difficult to determine, especially for configuration-handling libraries that may touch secrets or filesystem paths.

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