Back to skill

Security audit

youtube-comment-miner

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed YouTube comment-mining tool, but its fetch script has an argument-handling flaw that could expose local file contents through outbound requests.

Review this skill before installing. Use it only in an isolated environment, avoid passing untrusted values as the count argument, pin and audit dependencies, and be aware that it stores YouTube comment data locally including author-related fields.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/fetch_comments.sh:5
Finding

Unvalidated count argument enables local file disclosure through outbound YouTube requests

Content
View full analysis

Vulnerability Details

File Location: scripts/fetch_comments.sh, lines 5-15
Vulnerability Type: Shell argument injection and unintended local file disclosure
Risk Level: High

Vulnerable Code

bash
MAX_RESULTS=${2:-10}
OUTPUT_DIR="youtube_comments"

mkdir -p "$OUTPUT_DIR"

echo "🔍 搜索: $SEARCH_TERM (最多 $MAX_RESULTS 个视频)"

# 搜索视频并获取评论
yt-dlp "https://www.youtube.com/results?search_query=$(echo $SEARCH_TERM | tr ' ' '+')" \
    --dump-json --flat-playlist 2>/dev/null | \
    jq -r '.id' | head -$MAX_RESULTS | while read video_id; do

Technical Analysis

The second positional argument is accepted as MAX_RESULTS without validating that it is a positive integer. It is then expanded without quotation in:

bash
head -$MAX_RESULTS

Shell word splitting allows an attacker-controlled value containing whitespace to introduce additional arguments to head. For example, a value such as 10 /etc/hostname results in an effective invocation resembling:

bash
head -10 /etc/hostname

Instead of processing only the piped YouTube search results, head reads the attacker-selected local file. Its lines are passed to the while read video_id loop. A line that is suitable for use as a filename is subsequently embedded in a YouTube URL by the code later in the loop:

bash
output_file="$OUTPUT_DIR/${video_id}.json"

yt-dlp --write-comments --dump-json \
    "https://www.youtube.com/watch?v=$video_id" \
    > "$output_file" 2>/dev/null

This does not provide arbitrary shell command execution because the resulting video_id and output path are quoted. However, it can cause content from arbitrary files readable by the current process to be transmitted as part of an outbound request to YouTube. Files containing slashes or otherwise invalid path components may cause output redirection to fail, but files with simple line content remain exploitable.

Attack Path

  1. A ...[truncated 1525 chars]
Remediation
View remediation

Remediation Suggestions

Validate the argument before it reaches any command and use the explicit, quoted head option:

bash
MAX_RESULTS=${2:-10}

if ! [[ "$MAX_RESULTS" =~ ^[1-9][0-9]*$ ]]; then
    echo "Error: count must be a positive integer" >&2
    exit 1
fi

if (( MAX_RESULTS > 100 )); then
    echo "Error: count must not exceed 100" >&2
    exit 1
fi

jq -r '.id' | head -n "$MAX_RESULTS" | while IFS= read -r video_id; do
    # ...
done

Additionally, validate each returned video identifier before using it in a URL or filesystem path:

bash
if ! [[ "$video_id" =~ ^[A-Za-z0-9_-]{11}$ ]]; then
    echo "Skipping invalid video ID" >&2
    continue
fi

Use printf '%s' "$SEARCH_TERM" rather than unquoted echo, and consider enabling defensive shell options such as set -euo pipefail after confirming that expected pipeline behavior is handled correctly.

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unpinned and unnecessary third-party dependencies expand the supply-chain attack surface

Content
View full analysis

Vulnerability Details

File Location: requirements.txt, lines 1-3
Vulnerability Type: Mutable and unnecessary third-party dependencies
Risk Level: Medium

Vulnerable Code

text
yt-dlp>=2024.1.0
youtube-search>=2.1.0
python-dotenv>=1.0.0

The installation documentation also instructs users to install these packages directly:

bash
pip install yt-dlp youtube-search python-dotenv

Technical Analysis

All dependencies use open-ended minimum-version constraints. A future installation can therefore resolve to versions that were not reviewed with this Skill. This weakens reproducibility and exposes users to compromised, malicious, or unexpectedly incompatible future releases.

The included implementation invokes yt-dlp, but neither youtube-search nor python-dotenv is imported or used by scripts/analyze.py or scripts/fetch_comments.sh. These unused packages expand the supply-chain attack surface without being necessary for the implemented workflow.

Depending on the selected distribution format and package build configuration, package installation may invoke a build backend or other package-controlled installation logic. The installed yt-dlp executable is also directly invoked at runtime. The repository does not contain a lock file, hash verification, or a trusted-index restriction to ensure that the installed artifacts match reviewed versions.

No evidence shows that the currently named packages are malicious. This finding concerns avoidable exposure to mutable and unnecessary third-party package code.

Attack Path

  1. A user follows SKILL.md and installs dependencies from the package index.
  2. The resolver selects versions newer than those available when the Skill was audited because only lower bounds are specified.
  3. A selected package or transitive dependency has been compromised, maliciously updated, or taken over.
  4. Package-controlled code may execute during sou ...[truncated 904 chars]
Remediation
View remediation

Remediation Suggestions

Remove dependencies not required by the shipped scripts. Based on the reviewed implementation, reassess and remove youtube-search and python-dotenv unless documented functionality genuinely requires them.

Pin every retained direct and transitive dependency to an exact reviewed version. Generate a lock file containing cryptographic hashes, for example:

text
yt-dlp==REVIEWED_VERSION \
    --hash=sha256:REVIEWED_ARTIFACT_HASH

Install with hash enforcement and a trusted package index:

bash
python -m pip install --require-hashes -r requirements-lock.txt

Prefer reviewed binary wheels where appropriate, periodically scan dependencies for known vulnerabilities, and perform installation inside an isolated virtual environment under a non-privileged account. Avoid system-wide or root-level package installation.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (10)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill explicitly instructs users to collect and store YouTube comments in local JSON files but provides no warning about privacy, data retention, or downstream handling of user-generated content. Even though YouTube comments are public, bulk collection, storage, and later analysis can create compliance and privacy risks, especially if usernames, profile data, timestamps, or sensitive content are retained unnecessarily.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring and later user-facing print messages are written in Chinese, which makes the skill effectively require a specific language/locale for operation. The file does not offer an opt-in language choice or explain that the tool is intentionally limited to a Chinese-speaking context, which matches the policy-violation category for language/locale constraints.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script's descriptive comments and all user-visible status messages are written in Chinese, with no indication that the language is configurable or intentionally limited to a Chinese-speaking audience. This creates a natural-language locale restriction without user opt-in, which matches the policy-violation category for forced language or locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The natural-language instructions and examples are predominantly presented in Chinese, but the document does not indicate that Chinese is required, optional, or limited to a specific audience. Under the language/locale policy, forcing a specific language without user opt-in or justification is a policy concern.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The dependency is specified with a lower-bound version only, which allows future unresolved versions to be installed. This weakens build reproducibility and can pull in vulnerable or malicious upstream releases, especially significant here because yt-dlp already has multiple known advisories and interacts with untrusted remote content.

Content

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

text
yt-dlp>=2024.1.0
youtube-search>=2.1.0
python-dotenv>=1.0.0

Unverifiable Dependency: yt-dlp has 16 known advisory(ies) (CVE-2023-46121 (yt-dlp Generic Extractor MITM Vulnerability via Arbitrary Proxy Injection); GHSA-3v33-3wmw-3785 (yt-dlp has dependency on potentially malicious third-party code in Douyu extract); CVE-2023-40581 ( yt-dlp on Windows vulnerable to `--exec` command injection when using `%q`) +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
91% confidence
Finding

yt-dlp has multiple known security advisories, and because the manifest does not pin a specific version, there is no way to verify whether the installed version is patched. In a skill that likely fetches and processes untrusted online media resources, this uncertainty raises practical exploitability and supply-chain risk.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
93% confidence
Finding

The package youtube-search is not pinned to an exact version, so installations may resolve to different releases over time. This creates supply-chain and reproducibility risk because an unsafe future release could be silently introduced into the environment.

Content

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

text
yt-dlp>=2024.1.0
youtube-search>=2.1.0
python-dotenv>=1.0.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

Using python-dotenv with only a minimum version allows dependency drift and makes it unclear which code will actually run in deployment. Since the package has known advisories in some versions, the absence of pinning increases the chance of deploying an affected release.

Content

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

text
yt-dlp>=2024.1.0
youtube-search>=2.1.0
python-dotenv>=1.0.0

Unverifiable Dependency: python-dotenv has 2 known advisory(ies) (CVE-2026-28684 (python-dotenv: Symlink following in set_key allows arbitrary file overwrite via ); CVE-2026-28684 (python-dotenv reads key-value pairs from a .env file and can set them as environ)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
88% confidence
Finding

python-dotenv has published advisories, and the unpinned requirement prevents verification that a safe version will be installed. If the skill reads or writes .env files, affected versions could expose configuration handling weaknesses such as unsafe file operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

This shell script invokes external commands to make network requests to YouTube and writes fetched comment data into local JSON files, but it does not include any warning comment or user-facing disclosure about network activity or local data collection/storage beyond basic progress messages. For a code file, these safety-relevant behaviors should be explicitly disclosed so users understand that running the script will contact external services and save potentially large amounts of data locally.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.