Back to skill

Security audit

B站API服务

Security checks for vulnerabilities and agentic risk

Overview

This Bilibili-labeled skill actually routes broad tool calls through a third-party Xiaobenyang service and stores an API key in a local plaintext .env file.

Install only if you understand that this is not a direct Bilibili-only client: it relies on a third-party Xiaobenyang API/proxy and may store an API key in plaintext .env. Use a limited or test credential, inspect the remote service and supported tool list first, and avoid providing sensitive account credentials unless the publisher narrows the proxy scope and documents storage/deletion clearly.

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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (18)

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill describes capabilities to read environment variables, write files, and make network requests, but does not declare permissions or provide clear trust boundaries. In this context, the undocumented combination is risky because the workflow explicitly reads an API key, persists it to `.env`, and sends requests to a third-party service, which can surprise users and reviewers.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding
The skill is presented as a Bilibili API service, but the document indicates dependence on `https://xiaobenyang.com` / `mcp.xiaobenyang.com`, API-key management, and proxy-style tool invocation. This mismatch obscures the true data flow and trust model, increasing the chance that users provide credentials or content under false assumptions about who receives the data.

Intent-Code Divergence

Medium
Confidence
87% confidence
Finding
The workflow example references unrelated school-search functionality in a skill advertised for Bilibili users and videos. Such internal inconsistencies are dangerous because they suggest copy-paste reuse from another project, which can hide incorrect tool routing, unexpected data handling, or accidental invocation of unrelated capabilities.

Intent-Code Divergence

Low
Confidence
84% confidence
Finding
The documented project structure names the package `xiaobenyang_gaokao_skill`, which conflicts with the claimed Bilibili purpose. While not directly exploitable on its own, this inconsistency weakens trust and may indicate the skill was repurposed without fully removing unrelated logic or endpoints.

Description-Behavior Mismatch

High
Confidence
92% confidence
Finding
The implementation is a generic upstream tool proxy: it accepts arbitrary mcp_id, tool_name, and params and forwards them to a remote API with an API key, rather than enforcing Bilibili-specific operations. In an agent skill context, this broad forwarding behavior can enable capability expansion, data exfiltration, or invocation of unintended remote tools beyond the declared skill scope.

Description-Behavior Mismatch

Medium
Confidence
94% confidence
Finding
The code persists a supplied API key into a local .env file and keeps it in process environment state, which expands the skill's credential-handling scope beyond ordinary API request configuration. In an MCP/agent setting, local plaintext persistence increases the chance of accidental disclosure through filesystem access, backups, logs, or repository inclusion.

Intent-Code Divergence

Medium
Confidence
72% confidence
Finding
The configuration uses XBY/Xiaobenyang-specific prefixes, identifiers, and defaults that do not match the declared Bilibili service. In context, this mismatch is suspicious because it can route credentials or requests to unrelated infrastructure, causing unintended data disclosure or misuse of secrets.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill instructs the model to ask the user for an API key and persist it via `set_api_key(api_key)` to `.env` without warning the user about storage, scope, retention, or exposure risks. Storing secrets silently is dangerous because credentials may be written to disk in plaintext and later accessed by other processes, users, or tools.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The function stores API keys into .env in plaintext without any user-facing warning or consent mechanism. This is dangerous because users may assume ephemeral use while the secret is actually written to disk where other local processes, users, backups, or accidental commits can expose it.

Credential Access

High
Category
Privilege Escalation
Content
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")
Confidence
90% confidence
Finding
The code manually reads .env and extracts XBY_APIKEY, bypassing the normal env_prefix configuration and adding custom credential-parsing behavior. In this skill context, that increases concern because it deliberately targets a differently named secret tied to unrelated infrastructure, which can cause unintended credential consumption or disclosure.

Credential Access

High
Category
Privilege Escalation
Content
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()
Confidence
94% confidence
Finding
This function is dedicated to writing an API key into a local .env file, creating plaintext credential persistence. In an agent skill, such persistence increases the blast radius of any local compromise and creates opportunities for accidental leakage through source control or shared workspace files.

Credential Access

High
Category
Privilege Escalation
Content
def set_api_key(api_key: str) -> bool:
    """设置API key并持久化到.env"""
    if not api_key or not api_key.strip():
        return False
    api_key = api_key.strip()
Confidence
93% confidence
Finding
The helper explicitly persists the API key to .env as part of normal setup, normalizing unsafe secret storage behavior. This is particularly concerning because the skill metadata describes a Bilibili API service, yet the code handles unrelated XBY credentials, increasing the chance users store the wrong secret in an unexpected place.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
95% confidence
Finding
The dependency is specified with a lower-bound constraint only, which allows future installs to resolve to different versions over time. This weakens build reproducibility and can unintentionally introduce vulnerable or incompatible releases through the supply chain.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
95% confidence
Finding
Using an unpinned version for pydantic makes deployments non-reproducible and increases exposure to future upstream changes or vulnerable releases. While not an exploit by itself, it is a real supply-chain hardening weakness.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
95% confidence
Finding
The package pydantic-settings is not pinned, so installation may pull newer versions than expected. This creates a supply-chain risk and can introduce breaking changes or security issues without code changes in the skill itself.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
95% confidence
Finding
An unpinned python-dotenv dependency permits drifting to unreviewed versions during installation. That reduces reproducibility and can expose the environment-loading component to newly introduced vulnerabilities or unsafe behavior.

Known Vulnerable Dependency: requests==2.31.0 — 5 advisory(ies): 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); CVE-2026-25645 (Requests has Insecure Temp File Reuse in its extract_zipped_paths() utility func) +2 more

Medium
Category
Supply Chain
Confidence
90% confidence
Finding
The requirements allow installation of requests 2.31.0, and the static analysis indicates that exact version has multiple published advisories. In an MCP server that likely performs outbound HTTP requests to Bilibili APIs, flaws in the HTTP client can affect confidentiality or request integrity, making this more relevant than in a purely offline tool.

Known Vulnerable Dependency: python-dotenv==1.0.1 — 1 advisory(ies): CVE-2026-28684 (python-dotenv: Symlink following in set_key allows arbitrary file overwrite via )

Low
Category
Supply Chain
Confidence
77% confidence
Finding
The dependency set permits python-dotenv 1.0.1, which the finding associates with a file-overwrite issue in set_key via symlink handling. This is context-dependent and may not be reachable unless the skill calls dotenv file-writing functionality, but keeping a known vulnerable version in the dependency set is still a legitimate security weakness.

Static analysis

No suspicious patterns detected.