Back to skill

Security audit

Bilibili Transcriber

Security checks for vulnerabilities and agentic risk

Overview

This Bilibili transcription skill is mostly purpose-related, but it needs review because cloud mode can upload audio to Alibaba and an unsafe fallback may send an OpenAI API key to Alibaba.

Review before installing. Use cloud mode only for audio you are willing to send to Alibaba DashScope/OSS, remove or avoid the OPENAI_API_KEY fallback, set a real DASHSCOPE_API_KEY only when intentionally using DashScope, and prefer pinned dependencies and model revisions. For sensitive videos, force local transcription and avoid arbitrary URL transcription.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
cloud_transcriber.py:25
Finding

Cross-provider disclosure of an OpenAI API credential to Alibaba DashScope

Content
View full analysis
str: """获取 API Key(优先 DASHSCOPE_API_KEY,其次 OPENAI_API_KEY)""" key = os.environ.get("DASHSCOPE_API_KEY") or os.environ.get("OPENAI_API_KEY") if not key: raise ValueError( "未找到 API Key,请设置环境变量 DASHSCOPE_API_KEY 或 OPENAI_API_KEY\n" "例如: export DASHSCOPE_API_KEY=sk-xxxxxxxx" ) return key ``` ```python policy_url = "https://dashscope.aliyuncs.com/api/v1/uploads" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } params = { "action": "getPolicy", "model": model } resp = requests.get(policy_url, headers=headers, params=params, timeout=30) ``` ```python submit_url = "https://dashscope.aliyuncs.com/api/v1/services/audio/asr/transcription" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json", "X-DashScope-Async": "enable", "X-DashScope-OssResourceResolve": "enable" } request_body = { "model": model, "input": { "file_urls": [oss_url] }, "parameters": { "language_hints": language_hints or ["zh"] } } resp = requests.post(submit_url, headers=headers, json=request_body, timeout=30) ``` The URL-based transcription path repeats this behavior: ```python api_key = api_key or _get_api_key() submit_url = "https://dashscope.aliyuncs.com/api/v1/services/audio/asr/transcription" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json", "X-DashScope-Async": "enable" } ``` ### Technical Analysis The credential selection function treats `OPENAI_API_KEY` as a fallback for `DASHSCOPE_API_KEY`. However, every authenticated request made by this module targe ...[truncated 1841 chars]
Remediation
View remediation
str: key = os.environ.get("DASHSCOPE_API_KEY") if not key: raise ValueError( "DASHSCOPE_API_KEY is required for Alibaba DashScope transcription." ) return key ``` 2. Bind credentials explicitly to providers. If additional providers are supported later, use separate clients, endpoints, and credential variables for each provider. 3. Update `README.md` and `SKILL.md` to remove all instructions suggesting that `OPENAI_API_KEY` can be used as a DashScope credential. 4. Require callers supplying `api_key` directly to select or confirm the intended provider. 5. Avoid including credentials in exceptions, debug logs, or telemetry. 6. Advise affected users who previously invoked this fallback to rotate their OpenAI API keys and review account usage. ]]>

other

Warning
Location
cloud_transcriber.py:38
Finding

Cloud audio upload conflicts with the advertised local-processing privacy boundary

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
transcriber.py:24
Finding

Unpinned dependencies and unverified third-party model distribution sources

Content
View full analysis
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
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (42)

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · README.md (reported line 63)May include surrounding context.

��往 阿里云百炼控制台 注册并创建 API Key(即 DashScope Key),新用户有免费额度。

2. 设置环境变量

Windows (PowerShell):

powershell
[System.Environment]::SetEnvironmentVariable("DASHSCOPE_API_KEY", "sk-你的key", "User")

Windows (CMD):

cmd
setx DASHSCOPE_API_KEY "sk-你的key"

macOS / Linux:

bash
echo 'export DASHSCOPE_API_KEY=sk-你的key' >> ~/.bashrc
source ~/.bashrc

3. 优先级

技能会按以下顺序查找 Key:DASHSCOPE_API_KEY → OPENAI_API_KEY(兼容百炼的 OpenAI 兼容接口)。两个都没设置时,自动使用本地 faster-whisper,无需联网。

处理流程

text
输入URL → 解析BV号 → 获取视频信息 → 检查官方字幕
                                          ├─ 有字幕 → 直接使用 → 生成摘要
                                          └─ 无字幕 → 下载音频 → whisper转录 → 生成摘要

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

代码的核心功能是云端音频转写,而声明描述的是一个端到端的“B站视频转文字摘要专家”。当前代码确实覆盖了声明中的一部分——阿里云 Paraformer 云转写——但缺少多个关键的对外承诺能力:1) 没有任何 Bilibili 相关解析或下载逻辑;2) 没有本地 faster-whisper 引擎;3) 没有摘要生成;4) 输入对象实际上是本地音频路径或任意公网 URL,而不是专门的 B站视频 URL/BV号。因此描述明显超出了该代码块的实际行为,属于能力与主要用途不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

整体上,代码与“Bilibili 视频转文字”这一大方向基本相关,但声明中的两个核心能力没有在提供的代码中体现:第一,代码导入的转录接口看起来依赖本地 transcriber/faster-whisper 路线,未见任何阿里云 Paraformer API、鉴权、网络请求或云端引擎切换逻辑;第二,代码只保存带时间戳的转录文本,没有任何摘要、总结、结构化提炼或摘要输出字段。因此描述对能力范围有明显夸大。另一个行为差异是,代码会优先调用 B 站官方字幕接口并直接使用字幕,只有无字幕时才下载音频转录,这与“自动下载音频、转录成文字”并不完全一致,不过这更像实现策略差异。综合判断,描述不能准确代表该代码块的实际能力,属于实质性不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

声明描述的是一个端到端的 B 站视频转写与摘要技能:接受 URL/BV 号、下载音频、使用双引擎(阿里云 Paraformer + 本地 faster-whisper)转录,并输出结构化摘要。实际代码仅覆盖其中一部分,而且重点是“转录模块”。它实现了 faster-whisper / whisper 后端检测、模型下载与缓存、音频文件和字节流转录、时间戳输出、批量转录,以及通过 B 站 API 获取官方字幕。虽然这与“B 站视频转文字”部分相关,但缺失了声明中的关键能力:没有阿里云 Paraformer;没有 URL/BV 解析与音频下载;没有摘要生成。与此同时,代码实际增加了对 B 站官方字幕抓取和 openai-whisper 回退的支持。综合看,代码行为与声明的主要用途存在实质性偏差,因此应判定为 mismatch。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The README states the tool performs processing '全程本地处理' (entirely local), but later documents optional cloud transcription via Alibaba DashScope. This is a security-relevant disclosure inconsistency because users may reasonably believe no content leaves the machine, when in some configurations audio/content may be transmitted to an external provider.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · README.md (reported line 37)May include surrounding context.

md
ffmpeg 需要单独安装:
- Windows: `winget install ffmpeg`
- macOS: `brew install ffmpeg`
- Linux: `sudo apt install ffmpeg`

云端转写还需要:`pip install dashscope requests`

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation explains how to enable Alibaba DashScope cloud transcription but does not explicitly warn that video audio or derived content may be uploaded to a third-party service. This omission can lead to accidental disclosure of sensitive content, especially because the skill processes user-supplied media that may contain private or regulated information.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill declares broad tools (WebFetch, WebSearch, Bash, Write, Read) and describes network access, shell execution, environment variable use, and file creation, but it does not define any explicit permission or allowed-tool scope. That increases the chance an agent executes high-risk operations such as downloads, shell commands, or writes without clear containment or policy review.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The description presents the skill as a Chinese-only video-to-text summarization expert, and later examples hard-code language="zh" for transcription. There is no indication that users may choose another language or that the locale restriction is an explicitly justified policy exception.

Content

No source excerpt is available for this finding.

External Model or Provider Selection

Medium
Category
Excessive Agency
Confidence
90% confidence
Finding

Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

Content

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

md
- video
  - chinese
tools: WebFetch, WebSearch, Bash, Write, Read
model: performance
---

你是Bilibili视频内容处理专家。你的任务是将B站视频转换为文字并生成高质量摘要。

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

The skill performs external network requests to Bilibili APIs as part of processing user input. External transmission is expected for this skill's purpose, but it still carries data-exposure, tracking, and dependency risks if not transparently documented and constrained.

Content

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

优先方案:获取CC字幕

bash
# 调用B站API检查是否有官方字幕
curl "https://api.bilibili.com/x/player/wbi/v2?cid={cid}&bvid={bvid}"

备选方案A(推荐):阿里云 Paraformer 云端转写

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The cloud transcription path uploads audio to an external provider but does not clearly warn the user that media content will leave the local environment. This creates privacy and compliance risk, especially if videos contain sensitive, copyrighted, or personal audio.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

ffmpeg 需要单独安装

Windows: winget install ffmpeg

macOS: brew install ffmpeg

Linux: sudo apt install ffmpeg

text

## 工具说明

Tainted flow: 'policy_data' from requests.get (line 79, network input) → requests.post (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · cloud_transcriber.py (reported line 99)May include surrounding context.

python
'file': (file_name, f)
        }

        upload_resp = requests.post(policy_data['upload_host'], files=files, timeout=120)
        if upload_resp.status_code != 200:
            raise Exception(f"文件上传失败 (HTTP {upload_resp.status_code}): {upload_resp.text}")

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code uploads local audio content to a remote cloud provider and stores it temporarily without any explicit user-facing warning or confirmation. In a transcription skill, this matters because users may assume processing is local or Bilibili-scoped, while the implementation transmits potentially sensitive audio off-device.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The request body sets language_hints to ["zh"] whenever the caller does not provide a value, and the same behavior appears again in the URL-based transcription path. This imposes a language preference by default rather than letting the user choose or documenting a justified locale-specific constraint.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This code transmits audio reference data to an external cloud transcription service, which is a real security-relevant behavior because it sends user content off-system. In the context of a transcriber, the transmission is expected functionality, but it is still sensitive and can affect privacy if not clearly disclosed and consented to.

Content

Scanner excerpt · cloud_transcriber.py (reported line 159)May include surrounding context.

python
}

    print(f"[CloudASR] 提交转写任务 (模型: {model})...")
    resp = requests.post(submit_url, headers=headers, json=request_body, timeout=30)

    if resp.status_code != 200:
        raise Exception(f"提交任务失败 (HTTP {resp.status_code}): {resp.text}")

Tainted flow: 'request_body' from requests.get (line 148, network input) → requests.post (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · cloud_transcriber.py (reported line 159)May include surrounding context.

python
}

    print(f"[CloudASR] 提交转写任务 (模型: {model})...")
    resp = requests.post(submit_url, headers=headers, json=request_body, timeout=30)

    if resp.status_code != 200:
        raise Exception(f"提交任务失败 (HTTP {resp.status_code}): {resp.text}")

Tainted flow: 'query_url' from requests.post (line 339, network input) → requests.get (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · cloud_transcriber.py (reported line 184)May include surrounding context.

python
time.sleep(poll_interval)
        elapsed = time.time() - t2

        query_resp = requests.get(query_url, headers=query_headers, timeout=30)
        if query_resp.status_code != 200:
            print(f"[CloudASR] 查询失败,重试中...")
            continue

Tainted flow: 'query_url' from requests.post (line 339, network input) → requests.get (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · cloud_transcriber.py (reported line 348)May include surrounding context.

python
time.sleep(poll_interval)
        elapsed = time.time() - t2

        query_resp = requests.get(query_url, headers=query_headers, timeout=30)
        if query_resp.status_code != 200:
            print(f"[CloudASR] 查询失败,重试中...")
            continue

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill metadata says it operates on Bilibili video URLs, but this function allows any public audio URL to be sent to DashScope for remote retrieval and transcription. That scope expansion increases privacy and abuse risk because the skill can be used as a generic third-party URL submission mechanism rather than the narrower advertised workflow.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

In the public-URL transcription function, the request body again falls back to ["zh"] when no language hints are supplied. This creates the same language-policy concern by forcing a locale preference in natural-language behavior across another execution path.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
93% confidence
Finding

The URL mode sends an attacker- or user-supplied remote audio URL to an external provider for fetching and transcription. This is more dangerous than the local upload path because it combines external transmission with arbitrary URL handling, enabling privacy issues and misuse beyond the skill's declared Bilibili scope.

Content

Scanner excerpt · cloud_transcriber.py (reported line 326)May include surrounding context.

python
}

    print(f"[CloudASR] 提交转写任务 (URL模式, 模型: {model})...")
    resp = requests.post(submit_url, headers=headers, json=request_body, timeout=30)

    if resp.status_code != 200:
        raise Exception(f"提交任务失败 (HTTP {resp.status_code}): {resp.text}")

Tainted flow: 'request_body' from requests.get (line 148, network input) → requests.post (network output)

Medium
Category
Data Flow
Confidence
88% confidence
Finding

The URL-based path accepts an arbitrary public audio_url and forwards it to a third-party cloud transcription service. This broadens the skill from Bilibili-only handling into a generic URL fetcher/transcription proxy, which can be abused to submit unintended remote resources, create privacy issues, or trigger provider-side fetching of attacker-chosen URLs.

Content

Scanner excerpt · cloud_transcriber.py (reported line 326)May include surrounding context.

python
}

    print(f"[CloudASR] 提交转写任务 (URL模式, 模型: {model})...")
    resp = requests.post(submit_url, headers=headers, json=request_body, timeout=30)

    if resp.status_code != 200:
        raise Exception(f"提交任务失败 (HTTP {resp.status_code}): {resp.text}")

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 · fast_transcribe.py (reported line 273)May include surrounding context.

python
def get_video_info(bvid: str) -> dict:
    """获取视频基本信息"""
    api_url = f'https://api.bilibili.com/x/web-interface/view?bvid={bvid}'
    req = urllib.request.Request(api_url, headers={
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
    })