Back to skill

Security audit

Bili Collection Pipeline

Security checks for vulnerabilities and agentic risk

Overview

This skill appears to be a legitimate media transcription pipeline, but its transcription script has unsafe handling of video IDs that could let a crafted collection file run Python code or delete files outside the intended temp directory.

Review before installing. Only run this on collection JSON files you generated yourself or have inspected, use a dedicated temp/output directory, and avoid processing sensitive transcripts through remote LLM APIs unless you understand where the text is sent. The code should validate video IDs, remove python -c interpolation, confine generated paths, and delete only exact files it created.

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
scripts/transcribe_collection.py:122
Finding

Arbitrary Python Code Execution Through an Untrusted Video Identifier

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/transcribe_collection.py:143
Finding

Path Traversal and Arbitrary File Deletion Through Unvalidated Video Identifiers

Content
View full analysis
|]', '', title[:60]).strip() if not safe_title: safe_title = vid_key md_file = os.path.join(output_dir, f'{safe_title}.md') with open(md_file, 'w', encoding='utf-8') as f: f.write(f'# {title}\n\n') f.write(f'> ID: {vid_key} | Platform: {platform}') if duration: f.write(f' | 时长: {duration_str}') f.write('\n\n') if text: f.write(text) ``` Finally, the identifier controls wildcard cleanup patterns: ```python for pattern in [f'{vid_key}.mp4', f'{vid_key}.wav', f'{vid_key}.*.mp4', f'{vid_key}.*.wav']: for f in glob.glob(os.path.join(temp_dir, pattern)): try: os.remove(f) except: pass ``` ### Technical Analysis The `bvid` or `id` field comes from the supplied collection JSON and is not restricted to a valid platform identifier. `os.path.join()` does not confine a path to its first argument. Traversal components such as `..`, and absolute paths where supported, can cause the resulting path to reference files outside `temp_dir`. The cleanup operation is additionally dangerous because the untrusted identifier becomes part of a `glob` pattern. Wildcard metacharacters can broaden the set of matched files, while traversal components can direct the ...[truncated 1745 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Non-Reproducible Installation Through Unpinned Python Dependencies

Content
View full analysis
=1.1.0 requests>=2.28.0 ``` The installation metadata also requests mutable package names without exact versions: ```yaml install: - id: python kind: pip package: faster-whisper requests label: Install Python deps ``` ### Technical Analysis The dependency declarations use minimum-version constraints without upper bounds, exact versions, hashes, or a lock file. Installation can therefore select any future compatible release and its current transitive dependency graph. No evidence was found that either named package is intentionally malicious or typosquatted. The risk is that the package set reviewed today is not necessarily the package set installed later. A future compromised release, dependency takeover, or unexpected incompatible update could introduce code that executes during installation or runtime. ### Attack Path 1. A dependency or transitive dependency publishes a compromised or unexpectedly unsafe future release. 2. A user installs the Skill dependencies at a later date. 3. The `>=` constraints permit the package resolver to select that new release. 4. Package installation or runtime imports execute the changed dependency code in the Skill environment. 5. The compromised component gains the privileges of the account performing the installation or running the Skill. ### Impact Assessment Impact depends on the behavior of a compromised dependency and the privileges used for installation. Potential consequences include: - Arbitrary code execution during package installation or import. - Access to files and environment variables available to the installer. - Modification of the Python environment. - Network communication or data disclosure. - Build instability and non-reproducible audit results. The current repository contains no evid ...[truncated 158 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (12)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The README states that LLM post-processing can use DeepSeek/OpenAI/LM Studio but does not warn that transcript contents may be transmitted to third-party services. Because transcripts can contain sensitive, copyrighted, private, or regulated content, users may unknowingly exfiltrate data outside their environment when enabling this optional feature.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The supplied script's real function is narrow: it detects whether the input is a Bilibili or YouTube URL, queries Bilibili APIs or invokes yt-dlp in flat-playlist metadata mode, builds a list of videos with titles/durations/URLs, prints a summary, and writes the result to a JSON file. The declared description describes a larger end-to-end transcription workflow including downloading videos, transcribing with Whisper, semantic chunking, and Markdown output. None of those later stages appear in this code chunk. The only overlap is the initial '拉取列表' step. Because the declared purpose presents the skill as a batch transcription pipeline while the code here only implements playlist/collection fetching, this is a material description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The code substantially matches the core batch transcription workflow for Bilibili/YouTube collections: it downloads content, extracts audio, transcribes with Whisper, and saves Markdown outputs. However, the declared description explicitly says '拉取列表→下载→Whisper转录→语义分段→Markdown'. In this code chunk, list fetching is not present; instead it consumes an existing JSON file generated elsewhere. More importantly, there is no semantic segmentation stage: the script simply concatenates Whisper segment text and writes it directly to .txt/.md without topic segmentation or structured chunking. No obvious unrelated or risky undeclared capabilities are present beyond normal subprocess use for yt-dlp/ffmpeg/you-get.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file documents bulk download, audio extraction, transcription, and archive generation, which will create files and consume local storage, but it does not include any caution about disk usage, overwriting/creating output directories, or handling downloaded content. Under the markdown-specific warning rule, descriptions of behaviors affecting user data or system integrity should disclose these effects.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises and requires behaviors that imply shell execution, network access, and filesystem reads/writes, but it does not declare any explicit tool scope or allowed-tools boundary. This is dangerous because an agent may grant broader-than-necessary capabilities to fetch remote media and write many files without clear user-visible permission constraints, increasing the chance of unintended downloads, overwrites, or command execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill does not clearly warn that running it will download untrusted external media and create multiple output and progress files on disk. In an agent setting, insufficient disclosure is risky because users may authorize execution without realizing it can consume bandwidth/storage, leave persistent artifacts, or process content from remote sources.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/fetch_collection.py (reported line 27)May include surrounding context.

python
# ── Helpers ──

def run_cmd(args, timeout=30):
    result = subprocess.run(args, capture_output=True, timeout=timeout)
    try:
        return (result.returncode,
                result.stdout.decode('utf-8', errors='replace'),

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language behavior is specialized to Chinese via Chinese connector/reference vocabularies and emits fixed Chinese headings like '## 段落{i}'. This enforces a specific language/locale in user-visible output without opt-in or clear documentation that the tool is intentionally limited to Chinese transcripts.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code reads a user-supplied .md file and writes the transformed result back to the same path, replacing the original content. Although the script prints status messages after processing, there is no confirmation prompt or explicit user-facing warning in comments/docstrings that the operation modifies files in place and may remove existing segmentation markers when forced or during cleanup.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency faster-whisper is specified with a lower bound only, so installations may resolve to different versions over time. This creates a supply-chain risk because builds are not reproducible and a future compromised or breaking release could be pulled in without review.

Content

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

text
faster-whisper>=1.1.0
requests>=2.28.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
98% confidence
Finding

requests is also unpinned, which means the environment may install any later version satisfying the constraint. That weakens reproducibility and can expose the skill to vulnerable or malicious upstream releases, especially since this pipeline likely performs network access to fetch remote content.

Content

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

text
faster-whisper>=1.1.0
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
97% confidence
Finding

The manifest does not pin requests, and the package has multiple published advisories across versions, so there is no way to verify that deployments will avoid affected releases. In this skill's context, requests is especially relevant because the pipeline fetches remote resources; if an affected version is installed, issues such as credential leakage or TLS/verification flaws could be reachable.

Content

No source excerpt is available for this finding.