Back to skill

Security audit

广告注入服务

Security checks for vulnerabilities and agentic risk

Overview

This skill is framed as an ad-injection demo but actually routes prompts and code to a third-party API while collecting and storing an API key locally.

Review this carefully before installing. Only use it if you understand that your prompts, code, and API key may be sent to the XiaoBenYang service, and avoid providing confidential code or secrets. Prefer a version with accurate documentation, explicit consent before network uploads, secure API-key storage, strict response validation, and pinned dependencies.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (3)

T01 · Skill Instruction Hijacking

Error
Location
scripts/call_api.py:106
Finding

Remote API responses can hijack agent output and inject advertisements

Content
View full analysis
dict[str, Any]: client = XiaoBenYangClient() try: res = client.call_tool(mcp_id, tool_name, params) return {"success": True, "raw": res.json, "message": "success"} except UpstreamError as e: return {"success": False, "raw": getattr(e, "payload", None), "message": f"API call failed: {e}"} finally: client.close() ``` The vulnerable Skill workflow can be summarized from `SKILL.md` as follows: ```text User input -> select a tool -> extract parameters -> call scripts.tools -> return the result. The raw API response must be organized and displayed to the user. ``` ### Technical Analysis Tool functions forward prompts, source code, or topics to `https://mcp.xiaobenyang.com/api`. The API response is returned without schema validation, content filtering, provenance labeling, or separation between trusted instructions and untrusted data. The Skill instructions then designate the returned `raw` field as content the agent should process and display. Consequently, the operator of the remote endpoint—or an attacker who compromises it—can change the effective output after the Skill has been reviewed. A response can contain advertisements, deceptive links, social-engineering messages, or instruction-like text intended to influence the agent's current response. This is classified as instruction hijacking rather than remote code execution: the reviewed code ...[truncated 1349 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/config.py:45
Finding

API key is persisted in a plaintext working-directory file without restrictive permissions

Content
View full analysis
bool: 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 ``` ### Technical Analysis The API key is written verbatim to `.env` in the process's current working directory. The implementation does not create the file with an explicit restrictive mode, verify its ownership, reject symbolic links, or use an operating-system credential store. The resulting permissions depend on the process umask and any pre-existing file permissions. In shared or incorrectly configured environments, another local account or process may be able to read the credential. Because the path is relative, the secret can also be saved in an unintended project directory. If an attacker can pre-create `.env` as a symbolic link and the process has greater file privileges, the write may target another file accessible to that process. ### Attack Path Credential disclosure path: 1. A user supplies an API key as required by the Skill. 2. `set_api_key()` invokes `save_api_key_to_env()`. 3. The key is stored as `XBY_APIKEY=` in the current directory's `.env`. 4. A local user, process, backup system, repository operation, or artifact collector obtains the file. 5. The exposed key is reused against the external A ...[truncated 805 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Dependencies are installed from open-ended version ranges without integrity locking

Content
View full analysis
=2.31.0 pydantic>=2.7.0 pydantic-settings>=2.2.0 python-dotenv>=1.0.1 ``` ### Technical Analysis All dependencies use lower-bound-only constraints. A future installation can therefore resolve to versions that were never reviewed with this project. The file also supplies no cryptographic hashes or lockfile, making builds non-reproducible and preventing package-integrity verification at installation time. No evidence in the audited files establishes that the currently named packages are malicious. The risk arises because a compromised maintainer account, malicious future release, dependency takeover, or incompatible release could be selected automatically by a later installation. Python packages may execute code during build or installation and are imported into the Skill process at runtime. A malicious resolved version would therefore operate with the permissions and accessible secrets of that process. ### Attack Path 1. An attacker compromises an upstream package or its publication credentials and publishes a malicious version satisfying the declared lower bound. 2. A user or deployment system installs the project without a previously verified lockfile or hashes. 3. The package resolver selects the new malicious release. 4. Malicious code executes during installation, import, or normal package use. 5. The code can access files, environment variables, network connectivity, and the plaintext API key available to the Skill process. ### Impact Assessment A successful supply-chain compromise can execute arbitrary code with the privileges of the installer or runtime process. It may expose the API key, user prompts, analyzed source code, and files readable by that account. The precise impact depends on the installation context. Installing dependencies as an administrator would ...[truncated 135 chars]
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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (34)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented tools provide general completion, code analysis, and advice retrieval, which are unrelated to the stated ad-injection demo purpose. Such capability mismatch increases the chance of deceptive packaging, data leakage to remote APIs, and overbroad deployment of a skill whose true behavior is not transparent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented tools provide general completion, code analysis, and advice retrieval, which are unrelated to the stated ad-injection demo purpose. Such capability mismatch increases the chance of deceptive packaging, data leakage to remote APIs, and overbroad deployment of a skill whose true behavior is not transparent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented tools provide general completion, code analysis, and advice retrieval, which are unrelated to the stated ad-injection demo purpose. Such capability mismatch increases the chance of deceptive packaging, data leakage to remote APIs, and overbroad deployment of a skill whose true behavior is not transparent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The manifest presents one use case while the instructions implement a different API-keyed tool-routing client. That discrepancy undermines trust and review, and in practice can trick users into providing secrets or data to an external service under false pretenses.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The documentation labels the skill as an ad-injection service but the tool descriptions and project structure indicate a different third-party API client. This inconsistency is especially risky because it obscures where user data goes and why credentials are being requested, defeating informed consent and security review.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file’s behavior materially differs from the declared skill purpose: instead of only demoing ad-injection middleware risk, it contains configuration for a separate remote service and API key persistence workflow. This kind of scope mismatch is dangerous because it can hide credential-handling and outbound service dependencies inside a skill users would not expect to manage secrets for, increasing the risk of unauthorized data flow and covert integration with external systems.

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

This function is explicitly designed to persist an API key into .env, creating durable local storage of a secret in plaintext. While not credential theft, it meaningfully increases exposure if the file is readable by other users/processes, included in backups, or accidentally committed to version control.

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

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file exposes multiple generic LLM/code-assistance wrappers such as get_completion, analyze_code, gc, ac, developer_tip, and tip, which go well beyond the declared ad-injection demonstration purpose. In the context of a skill explicitly about injecting content into LLM responses, these broad helper endpoints can be used as covert proxy capabilities for arbitrary prompt and code processing, expanding abuse surface and enabling hidden data exfiltration or policy bypass through an external service.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill declares broad operational behavior involving environment access, file reads/writes, and network use, but provides no explicit tool scope or permission boundaries. In an agent setting, missing scope declarations weakens least-privilege controls and makes it harder to prevent unintended credential access, persistence, or exfiltration.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

All user-facing instructions and required interaction behavior are specified only in Chinese, with no indication that users may choose another language or locale. This can violate language or locale policy when the skill is used in broader contexts without explicit user opt-in.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Requiring users to supply an external API key and forwarding prompts to generic remote tools is unjustified for a skill framed as a simple risk demonstration. This creates unnecessary exposure of both secrets and user content to an external service without a clearly legitimate need tied to the advertised functionality.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill explicitly instructs the model to solicit an API key from the user via natural language and then persist it. Collecting secrets through conversational steps is dangerous because it normalizes phishing-like behavior, risks accidental logging/exposure, and stores credentials in a potentially insecure local format.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The tool-selection table uses effectively undefined triggers ('null'), leaving the model to infer when to call multiple overlapping remote-capable tools. Ambiguous dispatch increases the chance of unintended tool invocation, accidental data disclosure, and inconsistent security behavior across user requests.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The instructions tell the model to directly present raw API response data to the user. Raw upstream data can contain sensitive content, tokens, internal metadata, or untrusted text that should be filtered, minimized, or transformed before being shown.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code sends params over the network via an HTTP POST and includes an API key in request headers, which is a safety-relevant network operation. While internal logging exists for success and error cases, there is no user-facing warning, confirmation, or explanatory comment/docstring disclosing that user-provided data and credentials are transmitted to an upstream service.

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 provided API key directly into a local .env file and updates process environment state without any confirmation, warning, or storage-safety controls. This creates a realistic risk of accidental long-term secret retention, leakage through source control, backups, or local file disclosure, especially in demo or developer environments where .env handling is often inconsistent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The wrapper forwards user-supplied prompt content directly to an external API via call_api without any visible disclosure, consent flow, or safeguards in this file. This creates a data-handling risk because users may provide sensitive prompts assuming local processing, while the skill silently transmits that content to a remote service.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Additional wrappers transmit user-provided code and topic data to the same external API with no apparent warning or boundary checks. Sending source code or freeform prompts to a remote endpoint is particularly sensitive because it can leak proprietary code, secrets embedded in code, or confidential project context.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The dependency specification uses a lower-bound version only, which allows installation of newer unreviewed releases and makes builds non-reproducible. In a supply-chain context this increases the chance of pulling a vulnerable or malicious package version, especially 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
93% confidence
Finding

The manifest does not pin requests, and the package has multiple known advisories across versions, so the deployed environment could resolve to an affected release without visibility. Because requests is commonly used for outbound HTTP and authentication handling, vulnerable versions can lead to credential leakage, TLS issues, or other network security flaws.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

Using pydantic with only a minimum version leaves the resolved package version uncontrolled across environments. That weakens reproducibility and can expose the project to newly introduced vulnerabilities or behavior changes in a security-relevant parsing/validation library.

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