Back to skill

Security audit

B站推送附件

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to fetch Bilibili trending videos as advertised, but its local script launcher has a real command-execution safety risk if the install path is attacker-controlled.

Install only from a trusted package source and avoid placing this skill under a path controlled by someone else or containing unusual shell characters. The feature itself is narrow and purpose-aligned, but the publisher should replace shell-form execSync with shell-free process execution before this is treated as low-risk.

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

Warning
Location
index.js:15
Finding

Shell Command Injection Through the Skill Installation Path

Content
View full analysis

Vulnerability Details

File Location: index.js, lines 1 and 15–17
Vulnerability Type: Shell command injection
Risk Level: Medium

Vulnerable Code

javascript
const { execSync } = require('child_process');

// ...

const scriptPath = path.join(__dirname, 'bili_fetcher.py');
const result = execSync(`python "${scriptPath}"`, {
  encoding: 'utf-8'
});

Technical Analysis

The skill uses execSync() with a dynamically constructed command string. String-form process execution is interpreted by a system shell. Although tool arguments are not included in the command, scriptPath is derived from __dirname and interpolated directly into it.

Wrapping the path in double quotes does not provide safe shell escaping. If the installation directory contains a double quote followed by shell metacharacters, its name can terminate the quoted argument and append an additional command. This converts control over the installation path into arbitrary shell command execution.

Attack Path

  1. An attacker creates, supplies, or persuades the user to use a skill installation directory whose path contains a quote and shell command metacharacters.
  2. OpenClaw loads the skill from that attacker-influenced path.
  3. The user or agent invokes bili_fetch_tool.
  4. index.js inserts the path into the command string passed to execSync().
  5. The system shell parses the embedded metacharacters as command syntax.
  6. The attacker-supplied command executes with the privileges of the OpenClaw process.

Exploitation requires the attacker to influence the skill's installation path; no direct injection through the tool's args parameter was identified.

Impact Assessment

Successful exploitation permits arbitrary local command execution under the operating-system account running OpenClaw. Depending on that account's permissions, an attacker could read or modify accessible files, execute programs, access user- ...[truncated 198 chars]

Remediation
View remediation

Remediation Suggestions

Avoid invoking a shell. Use execFileSync() or spawnSync() and pass the script path as a distinct argument:

javascript
const { execFileSync } = require('child_process');
const path = require('path');

const scriptPath = path.join(__dirname, 'bili_fetcher.py');
const result = execFileSync('python', [scriptPath], {
  encoding: 'utf-8',
  windowsHide: true
});

Additional hardening measures:

  1. Use an explicitly configured and trusted Python executable rather than relying on ambiguous command resolution.
  2. Validate configuration-derived executable paths before use.
  3. Set an execution timeout and output-size limit to reduce denial-of-service risk.
  4. Return a generic error to untrusted callers while recording detailed process errors only in protected logs.
  5. Do not attempt to repair the current implementation solely through manual quoting; argument-based, shell-free process invocation is the reliable mitigation.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill declares direct tool dispatch to a native tool with raw argument mode and appears to perform network-capable fetching, but it does not declare any explicit tool scope, permissions, or allowed-tools boundary. This weakens policy enforcement and reviewability, increasing the chance that the skill can access network functionality without clear least-privilege controls or user-visible authorization constraints.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill metadata and description are entirely framed as producing Bilibili trending results in Chinese, with no indication that users can choose another language or locale. Under the policy, language constraints should either be optional or clearly justified as region-specific; this file does not document such a justification.

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

python
def fetch_data():
    url = "https://api.bilibili.com/x/web-interface/ranking/v2?rid=0&type=all"
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
    }

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest describes a skill that retrieves B站 Top20 items and extracts titles, summaries, and links. While network access to Bilibili would be expected, invoking a local interpreter via child_process introduces code-execution capability that is broader than necessary for the stated purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill invokes a local Python script via execSync, which is a safety-relevant operation for code files. There is no confirmation prompt, user-facing log/print, or inline disclosure explaining that a subprocess will be launched, and the brief description does not clearly warn about execution behavior itself.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This code makes an outbound HTTP request to a third-party API and sends a User-Agent header, which constitutes network transmission of system/client metadata. While the code prints results and errors, it does not provide any prior comment, docstring, or user-facing notice that it contacts an external service.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The natural-language metadata and comments are written only in Chinese, including the user-visible description string. This imposes a specific language choice without offering the user a language/locale option or documenting a justified locale restriction.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
index.js:16