Back to skill

Security audit

BiliBili-Danmaku-Analyzer-v1

Security checks for vulnerabilities and agentic risk

Overview

This skill coherently fetches public Bilibili danmaku for a user-supplied video and saves local analysis files, with no evidence of hidden execution, credential use, persistence, or destructive behavior.

Install only if you are comfortable sending the Bilibili video identifier to Bilibili APIs and storing sampled public danmaku text locally. Treat generated prompts and reports as untrusted-content workflows: review sampled comments before submitting them to a tool-enabled model, and prefer running any downstream LLM analysis without tools or sensitive context.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T01 · Skill Instruction Hijacking

Error
Location
main.py:215
Finding

Prompt Injection Through Untrusted Danmaku Content

Content
View full analysis

Vulnerability Details

File Location: main.py, lines 215-228
Vulnerability Type: Prompt injection through untrusted external content
Risk Level: High

Vulnerable Code

python
for seg in analysis_data['time_segments']:
    prompt += f"### 时段 {seg['segment']} (共 {seg['count']} 条弹幕)\n"
    if seg['samples']:
        for sample in seg['samples']:
            prompt += f"- [{sample['time']}] {sample['text']}\n"
    else:
        prompt += "- (此时间段无弹幕)\n"
    prompt += "\n"

Technical Analysis

The application obtains publicly supplied danmaku from Bilibili and interpolates each sampled comment directly into a prompt intended for downstream LLM processing. The comments are attacker-controlled external data, but the generated prompt does not establish a clear trust boundary, encode the data in a structured data-only format, or instruct the downstream model to disregard instructions embedded in comments.

Because an LLM processes instructions and data as text, a malicious comment can contain directives such as requests to ignore the intended analysis requirements, produce attacker-selected output, conceal information, or invoke tools. The subsequent analysis instructions do not reliably neutralize such directives. Sampling limits exposure but does not eliminate it because an attacker can increase the likelihood that a malicious comment appears among the first sampled comments in a segment.

Attack Path

  1. An attacker posts instruction-like text as danmaku on a targeted Bilibili video.
  2. The skill downloads the comment through the public danmaku endpoint in get_danmakus().
  3. prepare_analysis_data() includes the malicious comment among the sampled comments.
  4. generate_analysis_prompt() inserts the comment verbatim into the generated prompt at line 228.
  5. A user or agent submits the generated prompt to an LLM, as directed by the documented workflow.
  6. The LLM may interpret the em ...[truncated 991 chars]
Remediation
View remediation

Remediation Suggestions

  1. Clearly identify all downloaded comments as untrusted data before and after the data block. Explicitly instruct the downstream model never to interpret text inside that block as commands, policies, or tool requests.
  2. Serialize comments as structured JSON rather than interpolating them into instruction-oriented Markdown. Keep system instructions and untrusted data in separate message or content channels where the downstream API supports this.
  3. Require the downstream model to analyze comment fields only and prohibit tool invocation or goal changes based on their contents.
  4. Normalize or reject control characters and unusual delimiters that could break out of the chosen data representation. Use a standard JSON serializer instead of manual concatenation.
  5. Validate the downstream response against an expected schema and reject output that contains unexpected actions, tool requests, or instruction changes.
  6. Run the analysis with no tools and minimum privileges whenever possible. If tools are necessary, require independent authorization before any consequential operation.
  7. Treat content filtering as defense in depth only; keyword-based removal cannot reliably prevent prompt injection.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (14)

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · main.py (reported line 260)May include surrounding context.

python
- 用3-5句话总结这个视频的弹幕舆情特征
"""

    return prompt


def generate_markdown_report(analysis_data: dict) -> str:

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill documents and appears to rely on both network access and file-writing behavior, but it does not declare any explicit tool scope or permissions. This weakens user and platform visibility into what the skill can do, increasing the risk of over-privileged execution or unexpected data handling if the runtime grants broad defaults.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 129)May include surrounding context.

md
def get_video_info(bvid: str) -> dict:
    """获取视频信息"""
    url = f"https://api.bilibili.com/x/web-interface/view?bvid={bvid}"
    resp = requests.get(url, headers=DEFAULT_HEADERS, timeout=10)
    data = resp.json()
    if data['code'] == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 130)May include surrounding context.

md
def get_video_info(bvid: str) -> dict:
    """获取视频信息"""
    url = f"https://api.bilibili.com/x/web-interface/view?bvid={bvid}"
    resp = requests.get(url, headers=DEFAULT_HEADERS, timeout=10)
    data = resp.json()
    if data['code'] == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · main.py (reported line 37)May include surrounding context.

python
def get_video_info(bvid: str) -> dict:
    """获取视频信息"""
    url = f"https://api.bilibili.com/x/web-interface/view?bvid={bvid}"
    resp = requests.get(url, headers=DEFAULT_HEADERS, timeout=10)
    data = resp.json()
    if data['code'] == 0:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill fetches and stores large amounts of user-generated danmaku text to local files without any disclosure, minimization, or consent warning. While the source is public platform data, exported comment text can still contain personal data, sensitive opinions, or harassment content, creating privacy/compliance risk when redistributed or further processed.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
71% confidence
Finding

This request downloads full danmaku content from an external service and the skill later exports that user-generated text locally for reuse. In context, the external transmission itself is expected, but the combination of bulk collection plus storage of comments increases privacy and content-handling risk, especially if users are not warned or if outputs are shared onward.

Content

Scanner excerpt · main.py (reported line 57)May include surrounding context.

python
def get_danmakus(cid: str) -> list:
    """获取视频所有弹幕"""
    url = f"https://api.bilibili.com/x/v1/dm/list.so?oid={cid}"
    resp = requests.get(url, headers=DEFAULT_HEADERS, timeout=15)
    resp.encoding = 'utf-8'
    danmakus = []

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest says the skill will '通过大模型分析'弹幕舆情, implying actual model-driven analysis. In code, prepare_analysis_data computes keyword counts and generate_analysis_prompt merely produces a prompt text for later use, while no LLM API/client call exists anywhere in the file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill description does not clearly warn users that supplied video links/BV identifiers will be transmitted to Bilibili and that external content metadata and danmaku will be fetched over the network. This is a transparency and privacy issue because users may not expect outbound requests or third-party data retrieval when invoking the skill.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest description only says the skill performs Bilibili danmaku sentiment and trend analysis, but it does not specify when the skill should be invoked, what user intents should trigger it, or any exclusions. In a manifest file, this lack of trigger specificity can lead to overly broad or unintended activation for general requests about videos, sentiment, or analysis.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The top-level documentation describes the tool as extracting danmaku and preparing data for downstream LLM analysis. However, generate_markdown_report produces a complete analysis report with conclusions such as overall sentiment, risk hints, and '主要发现', which goes beyond mere preparation and contradicts the stated intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The generated analysis prompt and report template are entirely in Chinese and instruct downstream analysis in that language, but the file provides no mechanism for user opt-in or language selection. This is a natural-language locale constraint that may violate organizational language-choice policy when not documented as region-specific.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The dependency is specified as requests>=2.28.0, which allows installation of many future or currently vulnerable versions and prevents reproducible builds. In a skill that fetches external video/link data, relying on an unpinned HTTP library increases supply-chain uncertainty and can expose the environment to known or newly introduced defects in whichever version gets resolved.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
requests>=2.28.0

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

The manifest uses an unpinned requests dependency even though the package has multiple published advisories, so there is no assurance that the installed version is free from known issues. Given this skill likely retrieves remote resources from user-supplied Bilibili URLs, defects in the HTTP client could matter in practice if an affected version is installed.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.