Back to skill

Security audit

subtitle-extractor

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to extract subtitles as advertised, but it needs review because it handles session cookies and leaves downloaded audio/transcripts in temporary files with under-disclosed risks.

Review before installing. Use only narrowly scoped cookie exports, avoid passing untrusted URLs with cookies enabled, and be aware that audio and transcript files may remain in the system temporary directory unless manually cleaned up. There was no evidence of telemetry, destructive behavior, system persistence, or credential exfiltration to an unrelated endpoint.

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

T09 · Insecure Skill Coding Practices

Warning
Location
subtitle-extractor.py:425
Finding

Predictable and Persistent Temporary Files

Content
View full analysis

Vulnerability Details

File Location: subtitle-extractor.py:425-450, subtitle-extractor.py:479-480, and subtitle-extractor.py:540-541
Vulnerability Type: Predictable temporary-file creation and sensitive-data retention
Risk Level: Medium

Vulnerable Code

python
pid            = os.getpid()
audio_template = str(Path(tempfile.gettempdir()) / f'video-summary-audio-{pid}.%(ext)s')

cmd = ['yt-dlp']
if cookie_file:
    cmd += ['--cookies', cookie_file]
cmd += ['-x', '--audio-format', 'mp3', '-o', audio_template, url]

result = subprocess.run(
    cmd,
    stdout=subprocess.PIPE,
    stderr=sys.stderr,
    encoding='utf-8', errors='replace'
)

audio_files = list(Path(tempfile.gettempdir()).glob(f'video-summary-audio-{pid}.*'))
python
sub_path = Path(tempfile.gettempdir()) / f'video-summary-{os.getpid()}.srt'
sub_path.write_text(srt, encoding='utf-8')
python
sub_path = Path(tempfile.gettempdir()) / f'video-summary-{os.getpid()}.{sub_ext}'
sub_path.write_text(transcript, encoding='utf-8')

Technical Analysis

The Skill places downloaded audio and generated subtitles directly in the system-wide temporary directory. Filenames depend only on the process ID, which is generally predictable and has limited entropy.

Subtitle files are opened through Path.write_text() without exclusive creation or a prior check that the destination is a regular file owned by the current process. If an attacker can create a matching symbolic link before the write occurs, the write may follow that link and overwrite another file writable by the victim.

The audio download path has the same predictable process-ID naming pattern and is passed to an external downloader. The precise overwrite behavior can depend on yt-dlp and the existing destination, but the Skill itself does not establish a private directory, create the target securely, or validate the resulting file against symbol ...[truncated 1589 chars]

Remediation
View remediation

Remediation Suggestions

  1. Create a private, randomly named per-run directory with tempfile.TemporaryDirectory() rather than writing directly into the global temporary directory.
  2. Keep downloaded audio and generated subtitle files inside that private directory.
  3. Where a persistent intermediate file is necessary, use tempfile.NamedTemporaryFile(delete=False) or tempfile.mkstemp() so the file is created atomically with a random name and restrictive permissions.
  4. Do not reopen a predictable pathname after secure creation. Pass the securely created path or file descriptor through the pipeline.
  5. Validate that generated files are regular files and not symbolic links before reading or moving them.
  6. Copy only the final requested output to the designated output directory.
  7. Remove intermediate audio and subtitle files in a finally block after successful or failed processing.
  8. Apply owner-only permissions to temporary artifacts where supported.

other

Note
Location
SKILL.md:8
Finding

Misleading Cookie Network-Transmission Declaration

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:8-11; relevant implementation at subtitle-extractor.py:113-115, 137-139, 194-196, 370-372, and 428-430
Vulnerability Type: Inaccurate security documentation concerning credential transmission
Risk Level: Low

Vulnerable Declaration

yaml
# Security Declaration
# Downloads subtitles/audio from video platforms via yt-dlp.
# Cookie files are read locally only, never transmitted externally.
# No config files written. No secrets stored. No telemetry.

Relevant Implementation

python
cmd = ['yt-dlp']
if cookie_file:
    cmd += ['--cookies', cookie_file]
cmd += ['--print', '%(title)s', '--print', '%(uploader)s', '--skip-download', url]
python
base_cmd = ['yt-dlp']
if cookie_file:
    base_cmd += ['--cookies', cookie_file]
python
cmd = ['yt-dlp']
if cookie_file:
    cmd += ['--cookies', cookie_file]
if lang != 'auto':
    cmd += ['--sub-lang', lang]
python
cmd = ['yt-dlp']
if cookie_file:
    cmd += ['--cookies', cookie_file]
cmd += ['-x', '--audio-format', 'mp3', '-o', audio_template, url]

Technical Analysis

The cookie file itself is not explicitly uploaded as a standalone file, and no unrelated telemetry or credential collector was identified. However, the Skill passes the cookie file to yt-dlp through its --cookies option.

yt-dlp reads applicable cookie values and uses them in HTTP requests to the target platform. Therefore, the declaration that cookie files are “never transmitted externally” is overly absolute and may cause users to misunderstand how their authentication material is used.

Sending applicable cookie values to the requested service is functionally necessary for authenticated or restricted-content extraction and does not exceed the core privilege requirements by itself. The security concern is the inaccurate disclosure rather than evidence of mal ...[truncated 1218 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace the absolute declaration with precise wording, such as: “Cookie files remain stored locally, but yt-dlp reads them and transmits applicable cookie values to the requested platform for authentication.”
  2. Explain which supported platforms require or may use cookies.
  3. Validate input URLs against an explicit HTTPS allowlist for supported platform hostnames before invoking yt-dlp.
  4. Reject malformed URLs, unsupported schemes, embedded credentials, and deceptive hostname suffixes.
  5. Recommend narrowly scoped, short-lived cookies rather than a complete browser cookie export where the platform supports it.
  6. Ensure cookie paths and cookie contents are never printed to normal output or retained in logs.
  7. Document that third-party downloader behavior and redirects may affect the final network destinations involved.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (12)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
es **in the skill directory only** (same folder as `subtitle-extractor.py` and `SKILL.md`):

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill instructs the agent to use shell commands, read local files (including cookies and subtitle files), write output files, and rely on environment variables, but it does not declare an explicit tool/permission scope. This creates a least-privilege gap: an agent/runtime may grant broader capabilities than users expect, increasing the risk of unintended command execution, access to local sensitive files, or unsafe file writes when handling attacker-controlled URLs, paths, or filenames.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This Python file contains many hard-coded Chinese user-facing status and error messages, starting at L067 and continuing throughout the script, but it does not provide any user opt-in, locale selection, or documented region-specific justification. Under the policy rule, forcing a specific language without user choice is a natural-language policy violation.

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 · subtitle-extractor.py (reported line 116)May include surrounding context.

python
cmd += ['--cookies', cookie_file]
    cmd += ['--print', '%(title)s', '--print', '%(uploader)s', '--skip-download', url]

    result = subprocess.run(cmd, capture_output=True, encoding='utf-8', errors='replace')
    lines = result.stdout.strip().splitlines()

    title  = lines[0].strip() if len(lines) > 0 else ''

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 · subtitle-extractor.py (reported line 156)May include surrounding context.

python
eprint(f'{BLUE}尝试字幕语言: {try_lang}{NC}')

        with tempfile.TemporaryDirectory() as tmp_dir:
            result = subprocess.run(
                base_cmd + [
                    '--write-sub', '--write-auto-sub',
                    '--sub-lang', try_lang,

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 · subtitle-extractor.py (reported line 180)May include surrounding context.

python
# List available subtitles for user reference
    eprint(f'{YELLOW}未找到中文字幕,可用字幕列表:{NC}')
    result = subprocess.run(
        base_cmd + ['--list-subs', '--skip-download', url],
        capture_output=True, encoding='utf-8', errors='replace'
    )

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 · subtitle-extractor.py (reported line 202)May include surrounding context.

python
eprint(f'{BLUE}正在提取字幕...{NC}')

    with tempfile.TemporaryDirectory() as tmp_dir:
        subprocess.run(
            cmd + ['--write-sub', '--write-auto-sub', '--skip-download', '-P', tmp_dir, url],
            capture_output=True, encoding='utf-8', errors='replace'
        )

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 · subtitle-extractor.py (reported line 353)May include surrounding context.

python
with tempfile.TemporaryDirectory() as tmp_dir:
        audio_template = str(Path(tmp_dir) / 'audio.%(ext)s')
        # Stream yt-dlp stderr so download progress is visible to the agent
        result = subprocess.run(
            cmd + ['-x', '--audio-format', 'mp3', '-o', audio_template, url],
            stdout=subprocess.PIPE,
            stderr=sys.stderr,

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill is described primarily as a subtitle extractor, but it also exposes a distinct download-audio step that persists media to a temp file. That expands the capability from transcription into standalone content acquisition, which can enable unintended collection, retention, or downstream exfiltration of user-requested media beyond the declared scope.

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 · subtitle-extractor.py (reported line 416)May include surrounding context.

python
cmd += ['-x', '--audio-format', 'mp3', '-o', audio_template, url]

    eprint(f'{BLUE}正在下载音频(yt-dlp),下载进度如下:{NC}')
    result = subprocess.run(
        cmd,
        stdout=subprocess.PIPE,
        stderr=sys.stderr,

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The eprint docstring says stderr is 'not captured by agent', suggesting status/error output is hidden from the agent. Later code explicitly passes stderr=sys.stderr to subprocesses with comments stating progress should be visible to the agent, so the documentation contradicts actual behavior about agent visibility of stderr output.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The skill reads VIDEO_SUMMARY_WHISPER_MODEL to alter model source/path selection and VIDEO_SUMMARY_COOKIES to supply authentication material. For a subtitle-extraction skill, environment-variable access—especially for credential-like cookie configuration—is not clearly justified by the manifest text, which does not mention environment-based configuration or secret handling.

Content

No source excerpt is available for this finding.