Back to skill

Security audit

Bilibili Automation

Security checks for vulnerabilities and agentic risk

Overview

This Bilibili automation skill is mostly coherent, but it asks for broad command execution and raw account cookies while showing unsafe shell-based API examples.

Install only if you trust the BrowserWing endpoint and understand that search terms, video URLs, subtitles, and possibly account-linked content may be sent there. Avoid configuring Bilibili cookies unless needed, and do not use the documented curl snippets with raw user input; a safer implementation should serialize JSON and invoke commands without shell interpolation.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:60
Finding
Command Injection Through Unsafe Shell Template Substitution## Vulnerability Details **File Location**: `SKILL.md`, lines 60-94 **Vulnerability Type**: Shell command injection through user-controlled template values **Risk Level**: High ### Vulnerable Code ```bash curl -X POST http://localhost:8080/api/v1/tasks/execute \ -H "Content-Type: application/json" \ -d '{ "scriptId": "bilibili-search", "params": { "keyword": "{{keyword}}", "sort": "click" // click, pubdate, dm } }' ``` ```bash curl -X POST http://localhost:8080/api/v1/tasks/execute \ -H "Content-Type: application/json" \ -d '{ "scriptId": "bilibili-subtitle", "params": { "videoUrl": "{{videoUrl}}" } }' ``` ```bash curl -X POST http://localhost:8080/api/v1/tasks/execute \ -H "Content-Type: application/json" \ -d '{ "scriptId": "bilibili-info", "params": { "videoUrl": "{{videoUrl}}" } }' ``` ### Technical Analysis The documented commands place the JSON request body inside a single-quoted shell argument while embedding the user-controlled template values `{{keyword}}` and `{{videoUrl}}`. No input validation, shell escaping, JSON serialization, or URL allowlisting is specified. If an agent implements these examples through direct textual substitution and invokes them with the declared `exec` capability, an input containing a single quote can terminate the quoted `-d` argument. Shell operators and additional commands following that quote would then be interpreted by the shell rather than treated as JSON data. This violates the separation between data and executable command syntax. JSON escaping alone would not address the problem if the resulting value is still interpolated into a shell command string; the command must instead be constructed without shell parsing. The search example also contains a `//` comment, which is not valid JSON. Although this is not independently a security vulnerability, it ca ...[truncated 1488 chars]
Remediation
## Remediation Suggestions 1. Do not substitute user input into a shell command string. Invoke `curl` through an argument-array API that bypasses shell parsing. 2. Construct the request body with a proper JSON serializer. Pass the resulting JSON as one argument to `curl`, rather than embedding it in quoted shell source. 3. If shell execution is unavoidable, pass values through environment variables and use a JSON-aware utility such as `jq`: ```bash payload="$(jq -n --arg keyword "$KEYWORD" \ '{scriptId: "bilibili-search", params: {keyword: $keyword, sort: "click"}}')" curl --fail-with-body \ -X POST "${BROWSERWING_URL}/api/v1/tasks/execute" \ -H "Content-Type: application/json" \ --data-binary "$payload" ``` The environment variable assignment itself must also be performed through a structured process API rather than generated shell text. 4. Validate video URLs with a URL parser and allow only HTTPS URLs whose normalized hostname is an approved Bilibili domain. Reject embedded credentials, unexpected schemes, malformed hosts, and control characters. 5. Apply reasonable length and character constraints to search keywords while treating validation as defense in depth, not as a replacement for safe process invocation. 6. Prefer a constrained HTTP client tool scoped to the configured local BrowserWing endpoint instead of granting general-purpose `exec` access. 7. Use `BROWSERWING_URL` consistently and validate its scheme and destination before requests are made. 8. Remove the `// click, pubdate, dm` comment from the JSON example because JSON does not support comments. 9. Add tests using values containing single quotes, quotation marks, newlines, shell operators, command substitutions, and malformed URLs to verify that all inputs remain inert data.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (5)

Missing User Warnings

High
Confidence
98% confidence
Finding
The skill instructs users to export live Bilibili session cookies as environment variables, which grants the skill and any subprocesses with env access the ability to act as the user. If those credentials are logged, exposed to BrowserWing, reused by other tools, or sent to an untrusted endpoint, an attacker could hijack the account, access private data, or perform authenticated actions.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill documents sending search terms, video URLs, subtitle/danmaku content, and metadata to a BrowserWing service, but it does not clearly state that this data leaves the agent and is transmitted to another service endpoint. Even if the example points to localhost, the declared BROWSERWING_URL is configurable, so sensitive browsing targets, account-scoped content, and extracted media text could be forwarded to a non-local or less-trusted service without the user understanding that boundary.

External Transmission

Medium
Category
Data Exfiltration
Content
### 搜索视频

```bash
curl -X POST http://localhost:8080/api/v1/tasks/execute \
  -H "Content-Type: application/json" \
  -d '{
    "scriptId": "bilibili-search",
Confidence
87% confidence
Finding
The documented curl call sends user-supplied search or video-related data to an external service interface (BrowserWing task executor). In the context of a browser automation skill that may also use authentication cookies and extract subtitles/danmaku, this transmission can expose user intent, viewed content, and potentially account-linked data if the BrowserWing service is remote, compromised, or insufficiently trusted.

Natural-Language Policy Violations

Low
Confidence
78% confidence
Finding
The title, description, and usage examples are entirely in Chinese and present the skill as Chinese-only by default. For a general-purpose skill, this can amount to a language/locale policy issue unless the skill explicitly offers multilingual support or states that the constraint is intentionally region-specific.

Natural-Language Policy Violations

Low
Confidence
92% confidence
Finding
The description is written as 'B站自动化 - 观看视频、提取字幕、总结内容', which indicates a Chinese-language/locale-specific skill description without offering any user language choice or documenting why the locale restriction is required. Under the policy, forcing a specific language or locale without opt-in is a natural-language policy concern.

Static analysis

No suspicious patterns detected.