Back to skill

Security audit

JSON对比工具

Security checks for vulnerabilities and agentic risk

Overview

This skill is a remote JSON-diff wrapper that asks for an API key, sends comparison data to a third-party service, and stores the key locally in plaintext.

Review before installing. Use this only if you are comfortable sending the JSON contents and your XBY API key to the Xiaobenyang service. Do not compare secrets, tokens, personal data, or proprietary records unless external processing is approved. If installed, keep .env out of source control and know that the key may persist in the current working directory.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/config.py:44
Finding

API Key Persisted in a Plaintext File Without Explicit Permission Controls

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 writes the supplied API key to a plaintext `.env` file in the process's current working directory. It does not explicitly create the file with restrictive permissions, verify the permissions of an existing file, or repair permissions after writing. The effective permissions of a newly created file therefore depend on the process umask. If `.env` already exists, its potentially permissive permissions remain in effect. Using a path relative to the working directory also means the secret can be written to an unintended project, shared directory, or source-controlled workspace. The key is additionally copied into the process environment. This is expected for application configuration, but it expands the locations in which the credential is present and may expose it to process diagnostics or child processes created later by the host application. ### Attack Path 1. The skill asks the user for an API key. 2. The user supplies a valid crede ...[truncated 1200 chars]
Remediation
View remediation

other

Warning
Location
scripts/tools.py:21
Finding

User-Provided JSON Is Transmitted to a Third-Party Service Without a Clear Data-Sharing Warning

Content
View full analysis
Remediation
View remediation
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
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
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
97% confidence
Finding

The documentation indicates the skill reads and writes local credential material and manages remote service configuration, which is far beyond the expected behavior of a simple JSON diff tool. Mislabeling sensitive configuration management as benign comparison functionality creates a material risk of secret collection and persistence without informed user consent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The documentation indicates the skill reads and writes local credential material and manages remote service configuration, which is far beyond the expected behavior of a simple JSON diff tool. Mislabeling sensitive configuration management as benign comparison functionality creates a material risk of secret collection and persistence without informed user consent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The code exposes a generic remote MCP invocation primitive by accepting arbitrary tool_name, mcp_id, and params and forwarding them directly upstream. In a skill advertised as a JSON comparison tool, this creates unintended capability expansion: any caller who can reach this function may invoke unrelated upstream tools with the skill's configured API key and trust context.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

This function exposes arbitrary upstream tool selection through request headers (func, mcpid) without any local policy enforcement tying usage to the stated JSON comparison purpose. That mismatch increases the risk of privilege misuse, data exfiltration, or unintended actions through upstream tools under the skill's credentials.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file implements configuration and credential persistence for an unrelated service ('小笨羊高考' / XBY) rather than functionality needed for a JSON comparison tool. This mismatch materially increases the risk of hidden data flows, unnecessary secret handling, and supply-chain style abuse because users would not reasonably expect a JSON diff skill to read or persist API credentials.

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

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code explicitly reads API credentials from .env and the process environment, and writes them back to persistent storage, despite no clear need for a JSON-diff tool to manage secrets at all. Unnecessary credential collection and persistence broadens exposure through accidental commits, local disclosure, environment leakage, and misuse by unrelated code paths.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

This code forcibly reads an API key from .env during model initialization, creating an undisclosed credential access path in a skill that is supposed to compare JSON. In the context of an unrelated tool, automatic secret loading is dangerous because it silently expands the set of sensitive data the skill can access.

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

The existence check on .env is part of a code path that conditionally accesses locally stored credentials without user awareness. In a JSON diff skill, probing for and reading a secrets file is unjustified and increases the chance of credential exposure or misuse.

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

This logic prefers an environment-provided XBY_APIKEY and stores it into the settings object, extending credential handling for an unrelated service. Because the skill context does not justify secret access, this behavior increases the blast radius of any compromise and undermines least-privilege expectations.

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

The function is dedicated to saving an API key into .env, which is persistent credential handling unrelated to the declared JSON comparison purpose. Writing secrets to disk creates a durable exposure channel and can lead to leakage through source control, backups, or unintended file access.

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

The skill advertises capabilities that include environment access, file read/write, and network use, but it does not declare any explicit tool scope or permission boundaries. This increases the risk of over-privileged execution, especially because the workflow includes reading configuration, persisting secrets, and calling remote services.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The skill metadata and all instructions are written exclusively in Chinese and present the skill as a general JSON comparison tool, without indicating that Chinese is optional or that the tool is region-specific. This can amount to a language policy violation because it effectively forces a specific language without user opt-in or justification.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

A tool described as a local or general JSON comparison utility unexpectedly requires a third-party API key and external service access. This exceeds normal user expectations for the stated purpose and can trick users into granting credentials or network privileges that are unnecessary for basic JSON diff operations.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs the agent to collect and persist a third-party API key despite the limited declared purpose of JSON comparison. Collecting sensitive credentials without strong functional justification expands the attack surface and creates unnecessary risk of leakage, misuse, or unauthorized retention.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill requires the user to provide an API key and says it will be saved, but it does not warn about where it is stored, how long it persists, or who can access it. This lack of transparency can lead users to expose credentials without understanding the retention and security implications.

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 gaokao or school-search functions instead of JSON comparison, indicating copied or residual instructions from a different skill. Such inconsistencies undermine trust in the documentation and can cause the agent to invoke unintended tools or mishandle user data under the wrong operational assumptions.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The project structure and API notes expose remnants of a different 'gaokao' skill, suggesting the package may be repurposed without proper isolation or review. This raises the risk that unrelated code paths, endpoints, or credential logic remain active and could process data in ways users do not expect.

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 identifies the module as configuration for a different skill, directly contradicting the published skill identity. This inconsistency is a strong indicator of code reuse without proper review and raises trust and provenance concerns, especially when paired with secret-handling behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The function persists the API key into a local .env file without any visible confirmation, warning, or security boundary. Persisting secrets by default can expose them to other local users, backups, logs, or accidental version-control inclusion, and users of a JSON comparison tool would not expect this side effect.

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 only, which allows future installs to resolve to different versions over time. This weakens reproducibility and can unintentionally pull in vulnerable or breaking releases, especially relevant for a network-facing library like requests.

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 known advisories across versions. Because the installed version is unverifiable from this file, deployments could resolve to an affected release, which is more concerning here because requests commonly handles outbound HTTP and potentially credentials or session state.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

Using pydantic>=2.7.0 leaves dependency resolution open-ended, so different environments may install different releases. This creates supply-chain and stability risk because a later vulnerable version could be selected without any manifest change.

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

pydantic has known advisories, but this requirements entry does not identify which exact version will be installed. That uncertainty means the project may unknowingly consume an affected release, though the actual impact depends on how pydantic features are used elsewhere in the skill.

Content

No source excerpt is available for this finding.