Back to skill

Security audit

Bilibili Fav Downloader

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly behaves like a Bilibili favorites downloader, but its documentation asks users to collect unrelated Douyin session cookies and the installer uses broad system-level dependency installation.

Review carefully before installing. Do not follow the Douyin cookie instructions for a Bilibili downloader, do not export complete browser cookies, and keep any Bilibili cookie file private with restrictive permissions. Prefer a user-local or virtual-environment install with pinned verified dependencies, and enable cron or Telegram only after deciding that scheduled downloads and third-party notifications fit your risk tolerance.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (4)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
references/cookie-guide.md:5
Finding

Collection of Unrelated Douyin Authentication Credentials

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/setup.sh:39
Finding

Unpinned and Unverified Installation of Executable Dependencies

Content
View full analysis
/dev/null; then echo "[*] Installing yt-dlp..." if command -v pip3 &>/dev/null; then pip3 install --break-system-packages yt-dlp elif command -v pip &>/dev/null; then pip install yt-dlp else sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlp fi fi ``` The displayed English status message is a translation; the executable commands are unchanged. ### Technical Analysis The installer obtains `yt-dlp` through one of two mutable dependency channels: - `pip install yt-dlp` installs the latest package version available at execution time. - The fallback downloads from a URL containing `/releases/latest/`, whose content can change after this Skill has been reviewed. Neither path pins a reviewed version or validates a cryptographic digest or signature. The fallback then writes the downloaded file to `/usr/local/bin/yt-dlp` with `sudo`, making it a system-wide executable. The PyPI project name and GitHub URL correspond to the expected upstream project; the audit found no typographical package substitution or known attacker-controlled source. The weakness is that future upstream content is trusted without reproducible versioning or integrity validation. Use of `--break-system-packages` also bypasses distribution safeguards and may modify the system Python environment rather than isolating the dependency for this Skill. ### Attack Path 1. A user executes `scripts/setup.sh`. 2. The installer requests the current PyPI release or follows the mutable GitHub `latest` redirect. 3. An upstream account compromise, package-index compromise, malicious future release, or compromised delivery ...[truncated 1135 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/bilibili_fav_dl.py:107
Finding

Telegram Bot Token Exposed Through Process Command-Line Arguments

Content
View full analysis
/sendMessage` in its argument list. 4. A local process observer or monitoring agent records the `curl` command line during execution. 5. The observer extracts the bot token. 6. The token is used with Telegram's Bot API to perform actions allowed to that bot until the token is revoked. The observation window may be short, but scheduled execution makes ...[truncated 516 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/bilibili_fav_dl.py:28
Finding

Hard-Coded Global State and Log Paths Bypass User Configuration

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (23)

Ssd 3

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The workflow directly instructs users to obtain and supply browser session cookies, which are reusable authentication secrets. Normalizing credential extraction in the skill increases the chance of accidental disclosure, unsafe storage, or misuse by downstream tooling.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The cookie acquisition section provides step-by-step instructions to extract authentication cookies from browser developer tools and export them to a file. This is a credential collection flow, and in this case the domain mismatch further raises the risk of collecting the wrong account secrets.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file is a Bilibili cookie guide, but it instructs users to visit douyin.com, collect Douyin cookies, and mix Douyin tokens such as sessionid, uid_tt, and ttwid with Bilibili tokens like SESSDATA and bili_jct. This cross-service credential harvesting is inconsistent with the stated skill purpose and could trick users into disclosing unrelated high-value session tokens, enabling account compromise or unauthorized access on another platform.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The guide tells users to copy the full Cookie header or export complete cookie data, which exposes active authentication material well beyond the minimum needed. In a downloader skill context, this is especially dangerous because users are being normalized into exfiltrating reusable session secrets that could be abused for account takeover, private data access, or long-lived unauthorized API use.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill clearly instructs use of shell commands, environment variables, cron persistence, and file paths, but it declares no explicit tool scope or permissions boundaries. That omission weakens reviewability and can cause an agent or user to execute broader capabilities than expected without a clear trust contract.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill asks users to provide authentication cookies but gives no warning that these are equivalent to session credentials and may grant account access if leaked. Users may store or transmit them insecurely because the workflow normalizes handling them like ordinary input files.

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 34)May include surrounding context.

或手动安装:

bash
# Ubuntu/Debian
sudo apt install ffmpeg
pip3 install yt-dlp

# macOS

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

设置每2小时自动运行(crontab):

bash
# 编辑 crontab
crontab -e

# 添加:
0 */2 * * * /usr/bin/python3 /path/to/bilibili_fav_dl.py --cookie /path/to/cookie.txt --fav-id 你的收藏夹ID --out-dir /path/to/downloads >> /var/log/bilibili_dl.log 2>&1

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The cookie instructions tell the user to log into douyin.com even though the skill is for Bilibili favorites. This mismatch is a strong indicator of copied or careless credential-handling guidance and could trick users into exporting unrelated session cookies, exposing accounts unnecessarily.

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/bilibili_fav_dl.py (reported line 42)May include surrounding context.

python
f.write(line + "\n")

def curl_api(url, cookie_file):
    r = subprocess.run([
        "curl", "-s", url,
        "-b", cookie_file,
        "-H", "User-Agent: Mozilla/5.0",

Tainted flow: 'url' from os.environ.get (line 106, credential/environment) → subprocess.run (code execution)

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 · scripts/bilibili_fav_dl.py (reported line 42)May include surrounding context.

python
f.write(line + "\n")

def curl_api(url, cookie_file):
    r = subprocess.run([
        "curl", "-s", url,
        "-b", cookie_file,
        "-H", "User-Agent: Mozilla/5.0",

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 · scripts/bilibili_fav_dl.py (reported line 57)May include surrounding context.

python
all_items = []
    pn = 1
    while True:
        url = f"https://api.bilibili.com/x/v3/fav/resource/list?media_id={fav_id}&pn={pn}&ps=20&jsonp=jsonp&type=0"
        data = curl_api(url, cookie_file)
        if data.get("code") != 0:
            log(f"API page{pn} error: {data.get('message')}")

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/bilibili_fav_dl.py (reported line 80)May include surrounding context.

python
return True, "skipped"

    # yt-dlp 最高画质:bestvideo+bestaudio 合并
    result = subprocess.run([
        "yt-dlp",
        "--cookies", cookie_file,
        "-f", "bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio/best",

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 · scripts/bilibili_fav_dl.py (reported line 106)May include surrounding context.

python
chat_id = os.environ.get("BILIBILI_TG_CHAT_ID")
    if not token or not chat_id:
        return
    url = f"https://api.telegram.org/bot{token}/sendMessage"
    subprocess.run([
        "curl", "-s", url,
        "-d", f"chat_id={chat_id}",

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/bilibili_fav_dl.py (reported line 107)May include surrounding context.

python
if not token or not chat_id:
        return
    url = f"https://api.telegram.org/bot{token}/sendMessage"
    subprocess.run([
        "curl", "-s", url,
        "-d", f"chat_id={chat_id}",
        "-d", f"text={msg}",

Tainted flow: 'url' from os.environ.get (line 106, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
83% confidence
Finding

The Telegram bot token from the environment is interpolated directly into the request URL and then passed as a command-line argument to curl. On many systems, process command lines are observable to other local users or monitoring tools, which can expose the bot token and enable unauthorized use of the Telegram bot.

Content

Scanner excerpt · scripts/bilibili_fav_dl.py (reported line 107)May include surrounding context.

python
if not token or not chat_id:
        return
    url = f"https://api.telegram.org/bot{token}/sendMessage"
    subprocess.run([
        "curl", "-s", url,
        "-d", f"chat_id={chat_id}",
        "-d", f"text={msg}",

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 · scripts/setup.sh (reported line 27)May include surrounding context.

sh
if ! command -v ffmpeg &>/dev/null; then
    echo "[*] 安装 ffmpeg..."
    if [ "$PKG_MANAGER" = "apt-get" ]; then
        sudo apt-get install -y ffmpeg
    else
        sudo $PKG_MANAGER install -y ffmpeg
    fi

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 · scripts/setup.sh (reported line 29)May include surrounding context.

sh
if ! command -v ffmpeg &>/dev/null; then
    echo "[*] 安装 ffmpeg..."
    if [ "$PKG_MANAGER" = "apt-get" ]; then
        sudo apt-get install -y ffmpeg
    else
        sudo $PKG_MANAGER install -y ffmpeg
    fi

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 · scripts/setup.sh (reported line 45)May include surrounding context.

sh
if ! command -v ffmpeg &>/dev/null; then
    echo "[*] 安装 ffmpeg..."
    if [ "$PKG_MANAGER" = "apt-get" ]; then
        sudo apt-get install -y ffmpeg
    else
        sudo $PKG_MANAGER install -y ffmpeg
    fi

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This shell script uses sudo to install packages and writes an executable into /usr/local/bin, which modifies the host system in a privileged and potentially hard-to-reverse way. Although it prints status messages, it does not warn the user before making these changes or ask for confirmation.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
87% confidence
Finding

The script downloads an executable from the network with curl and writes it directly to /usr/local/bin using sudo, without checksum or signature verification. If the download source, release channel, TLS trust chain, or network path is compromised, this could install a trojanized binary with broad system impact.

Content

Scanner excerpt · scripts/setup.sh (reported line 44)May include surrounding context.

sh
pip install yt-dlp
    else
        # 下载二进制
        sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
        sudo chmod a+rx /usr/local/bin/yt-dlp
    fi
else

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The Telegram notification feature sends download-related metadata to a third-party messaging service, but the skill does not disclose that data leaves the local machine. This can expose titles, identifiers, timing, and usage patterns, especially when monitoring private favorites.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

All user-visible comments and echo messages are in Chinese, with no indication that the skill is region-specific or that users may select another language. This can violate language/locale policy when a skill imposes a specific language without user opt-in.

Content

No source excerpt is available for this finding.