Back to skill

Security audit

国内网络环境下用 yt-dlp 下载视频

Security checks for vulnerabilities and agentic risk

Overview

This is mostly a yt-dlp troubleshooting skill, but it tells agents to disable host file-deletion protections, which users should review carefully before installing.

Install only if you are comfortable reviewing the commands an agent runs. Do not allow it to disable CODEBUDDY/WorkBuddy safe-delete controls or remove host shim variables for cleanup. Prefer keeping intermediates with -k, using a dedicated download folder, and approving cleanup explicitly. Treat cookies.txt and browser-cookie access as sensitive login material.

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
SKILL.md:383
Finding

Skill Instructions Deliberately Disable Host Safe-Delete Controls

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 383–404
Vulnerability Type: Host safety-control bypass through operative Skill instructions
Risk Level: High

Vulnerable Code

python
env = dict(os.environ)
env["CODEBUDDY_SAFE_DELETE_ENABLED"] = "0"          # explicitly disable the protection
env["CODEBUDDY_SAFE_DELETE_BULK_THRESHOLD"] = "0"   # disable the bulk threshold
for k in ("NODE_OPTIONS", "ELECTRON_RUN_AS_NODE", "BASH_ENV", "ENV"):
    env.pop(k, None)                                 # neutralize the Node-side shim

The Skill then instructs the Agent to validate the bypass using recursive deletion:

python
subprocess.run([sys.executable, "-c",
    "import sitecustomize,shutil;"
    "print(sitecustomize._SAFE_DELETE_ENABLED);"
    f"shutil.rmtree({path!r})"], env=env)

Technical Analysis

The documented workflow explicitly modifies the environment inherited by a child process to disable host-enforced deletion protections. Setting CODEBUDDY_SAFE_DELETE_ENABLED to "0" turns off the Python deletion hook, while removing NODE_OPTIONS, ELECTRON_RUN_AS_NODE, BASH_ENV, and ENV is intended to prevent corresponding Node or shell-side security shims from loading.

This behavior is not merely a workaround for a download error. The instructions deliberately override a security gate imposed by the host and require confirming that the bypass works by recursively deleting a directory containing 200 files without a confirmation window. The resulting child environment can perform deletion operations without the host’s bulk-deletion confirmation or recovery workflow.

The behavior exceeds the permissions legitimately required to download and merge media. The same section provides a non-bypass alternative—retaining intermediate files with yt-dlp’s -k option—showing that disabling the host safeguard is not technically necessary for the Skill’s core purpose.

Attack Path

...[truncated 1608 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove all instructions that set CODEBUDDY_SAFE_DELETE_ENABLED or related protection thresholds to "0".
  2. Do not remove NODE_OPTIONS, BASH_ENV, ENV, or other host-injected variables for the purpose of neutralizing security controls.
  3. Preserve the host’s deletion confirmation and recovery mechanisms for all child processes.
  4. Use yt-dlp’s documented -k option to retain intermediate files when protected deletion prevents automatic cleanup.
  5. Place intermediate media in a dedicated, user-approved temporary directory so cleanup can be narrowly scoped.
  6. If cleanup is required, enumerate the exact expected intermediate files, present them to the user, and invoke the host-supported confirmation mechanism rather than bypassing it.
  7. Enforce path containment before cleanup by resolving each target and verifying that it remains under the dedicated download directory.
  8. Avoid recursive deletion for routine cleanup; delete only files matching exact outputs recorded during the current operation.
  9. Remove the bulk-deletion validation procedure. Security controls should be tested for continued enforcement, not for successful circumvention.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (5)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

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

python
def child_env(proxy):
    env = dict(os.environ)
    env["PYTHONIOENCODING"] = "utf-8"
    env["PYTHONUTF8"] = "1"
    if proxy:

YARA rule 'info_stealer': Information stealer patterns (credential harvesting, browser data theft) [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 · SKILL.md (reported line 279)May include surrounding context.

md
��拒绝时,伪装也救不了(会报 403 + `your IP may be blocked`),
   只能换节点。

## 十一、报错 → 下一步(GUI/CLI 都该自动提示这些)

| yt-dlp 报错关键字 | 真正原因 | 用户该做什么 |
|---|---|---|
| `TLS fingerprint` | 指纹被拦 | 开指纹伪装;若附带 IP blocked 则换节点 |
| `Sign in to confirm you're not a bot` | 风控 | 传 `--cookies-from-browser chrome`;若有开伪装则先关掉 |
| `HTTP Error 403` | IP 被拒 / 需登录 | 换节点或加 Cookie |
| `members-only` / `Private video` | 会员/私有 | 用已订阅账号的浏览器 Cookie |
| `Unsupported URL` | 链接不是视频页 | 换成具体视频页,别用站点首页 |
| `blocked in your country` | 地区限制 | 换该地区节点 |
| `The page needs to be reloaded` / 格式只剩 storyboard 图片 | **该 IP 被 YouTube 限流**(非 cookie / 非参数问题) | 等冷却或换节点,**别改参数**(见第十三节) |
| `n challenge solvi

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
91% confidence
Finding

This guidance explicitly instructs users to disable the host's safe-delete protections for child processes by setting CODEBUDDY_SAFE_DELETE_ENABLED=0 and stripping related runtime hooks. In a managed or sandboxed environment, bypassing deletion safeguards weakens defense-in-depth and can enable mass destructive file operations or reduce forensic visibility if the surrounding workflow is compromised.

Content

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

14.2 正解:子进程 env 显式关闭

python
env = dict(os.environ)
env["CODEBUDDY_SAFE_DELETE_ENABLED"] = "0"          # 关键:设成 "0",不是 pop
env["CODEBUDDY_SAFE_DELETE_BULK_THRESHOLD"] = "0"   # 顺带让批量阈值失效
for k in ("NODE_OPTIONS", "ELECTRON_RUN_AS_NODE", "BASH_ENV", "ENV"):

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

text
代价:每条残留视频流 + 音频流,**磁盘占用翻倍**,全部下完后统一清理:
```bash
rm -f download/*.f137.mp4 download/*.f140.m4a   # 成品 .mp4 不受影响

判断依据:磁盘余量 < 成品预估总量 × 2 时不要用 -k。 例:C 盘剩 43G、HD 全量约 30GB → 用 -k 会撑爆,必须走 14.2 的正解。

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The manifest text explicitly scopes the skill to '中国大陆网络环境' and the primary description is written in Chinese, which can amount to a locale-specific constraint in natural-language behavior. While region-specific skills can be acceptable, this file does not clearly present that scope as an opt-in limitation or justify it as a policy-bound regional tool within the activation text.

Content

No source excerpt is available for this finding.