Back to skill

Security audit

Jarvis-Video-STT

Security checks for vulnerabilities and agentic risk

Overview

This video transcription skill appears purpose-aligned, but it contains an exploitable shell-command construction bug that could run unintended commands from a crafted video filename.

Review before installing or running. Only process trusted filenames and directories, and prefer a fixed version that replaces os.system with subprocess.run using an argument list and shell=False. Be aware that transcripts and reports may contain sensitive spoken content and will be written to the chosen output directory.

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
batch_whisper.py:34
Finding

Shell Command Injection Through Attacker-Controlled Video Paths

Content
View full analysis

Vulnerability Details

File Location: batch_whisper.py, lines 34–37
Vulnerability Type: OS command injection
Risk Level: High

Vulnerable Code

python
def extract_audio(video_path, temp_dir):
    """提取音频到临时文件"""
    audio_path = os.path.join(temp_dir, f"{Path(video_path).stem}.wav")
    cmd = f'ffmpeg -y -i "{video_path}" -vn -acodec pcm_s16le -ar 16000 -ac 1 "{audio_path}" 2>/dev/null'
    os.system(cmd)
    return audio_path if os.path.exists(audio_path) else None

Technical Analysis

The application constructs an FFmpeg command by directly interpolating video_path and the derived audio_path into a command string passed to os.system(). The shell therefore parses both paths as command-line syntax rather than treating them exclusively as literal arguments.

Wrapping a path in double quotes is not sufficient shell escaping. Shell constructs such as command substitution, backticks, embedded quotes, and other metacharacters can still alter the command's behavior. Because video_path originates from the user-controlled --input argument or from filenames discovered in a user-selected directory, an attacker can influence the command string.

The output path is also derived from Path(video_path).stem, so hostile filename content may propagate into both interpolated paths.

Attack Path

  1. An attacker creates or supplies a video file whose filename contains shell syntax.
  2. The victim invokes the Skill with that file, a matching wildcard, or the directory containing it.
  3. The file-discovery logic includes the attacker-controlled path in the processing list.
  4. extract_audio() embeds the path in the FFmpeg command string.
  5. os.system() invokes a shell to parse the resulting command.
  6. The injected shell expression executes with the privileges of the account running the Skill.

Exploitation requires the attacker to control or influence a processed filename or input path. ...[truncated 692 chars]

Remediation
View remediation

Remediation Suggestions

Replace the shell command string and os.system() with subprocess.run() using an explicit argument list:

python
import subprocess

def extract_audio(video_path, temp_dir):
    audio_path = os.path.join(temp_dir, f"{Path(video_path).stem}.wav")

    try:
        subprocess.run(
            [
                "ffmpeg",
                "-y",
                "-i",
                video_path,
                "-vn",
                "-acodec",
                "pcm_s16le",
                "-ar",
                "16000",
                "-ac",
                "1",
                audio_path,
            ],
            stdout=subprocess.DEVNULL,
            stderr=subprocess.DEVNULL,
            check=True,
        )
    except subprocess.CalledProcessError:
        return None

    return audio_path if os.path.isfile(audio_path) else None

Additional hardening measures:

  • Never use shell=True for this operation.
  • Resolve FFmpeg through a trusted, documented executable path where appropriate.
  • Validate that each input is a regular file before processing it.
  • Consider rejecting unexpected file types after inspecting actual media content rather than relying only on extensions.
  • Generate temporary output names independently of untrusted filenames, such as with tempfile.
  • Check the FFmpeg exit status and report extraction failures without exposing sensitive command details.

T08 · Insecure Dependencies

Note
Location
SKILL.md:25
Finding

Unpinned Third-Party Runtime Dependencies

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 25–28; repeated at lines 87–89
Vulnerability Type: Unpinned dependency installation
Risk Level: Low

Vulnerable Instructions

markdown
### 1. 安装依赖

pip install faster-whisper tqdm
确保ffmpeg已安装 (brew install ffmpeg on macOS)

The troubleshooting section repeats the unpinned installation command:

markdown
Q: 报 faster-whisper 找不到?
pip install faster-whisper

Technical Analysis

The installation instructions request faster-whisper and tqdm without exact versions or package hashes. Consequently, the code installed by users depends on the latest versions available through their currently configured Python package index at installation time.

The package names are consistent throughout the project, and the audit found no evidence of typosquatting, dependency confusion, or an intentionally malicious dependency. Nevertheless, mutable dependency resolution reduces reproducibility and leaves the installation process exposed to compromised releases, compromised indexes, or unsafe pip index configuration.

Attack Path

  1. A user follows the documented pip install faster-whisper tqdm command.
  2. pip contacts the package index configured in the user's environment.
  3. pip resolves whatever compatible package versions and transitive dependencies are available at that time.
  4. If a selected package release, transitive dependency, package index, or index configuration has been compromised, pip downloads and installs attacker-controlled code.
  5. That code may execute during installation or later when batch_whisper.py imports the dependency.

This path is conditional on a supply-chain or package-source compromise; no such compromise was demonstrated in the audited repository.

Impact Assessment

A compromised dependency could execute code with the privileges of the user performing the installation or running the Skill. The p ...[truncated 355 chars]

Remediation
View remediation

Remediation Suggestions

  • Create a reviewed dependency lock file containing exact versions.
  • Include cryptographic hashes for every direct and transitive package.
  • Install dependencies with hash verification:
text
pip install --require-hashes -r requirements.txt
  • Generate and review the lock file with a suitable dependency-management tool.
  • Document the expected package index and avoid untrusted or unintended extra indexes.
  • Periodically scan locked dependencies for known vulnerabilities and update them through a controlled review process.
  • Keep the installation instructions synchronized with the lock file rather than recommending direct installation of mutable package versions.
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

os.system() or os exec-family call

High
Category
Dangerous Code Execution
Confidence
96% confidence
Finding

The code constructs a shell command with attacker-controlled file paths and executes it via os.system. Quoting with double quotes is not sufficient to prevent shell metacharacter expansion such as command substitution, so a crafted video filename can trigger arbitrary command execution under the user's privileges.

Content

Scanner excerpt · batch_whisper.py (reported line 38)May include surrounding context.

python
"""提取音频到临时文件"""
    audio_path = os.path.join(temp_dir, f"{Path(video_path).stem}.wav")
    cmd = f'ffmpeg -y -i "{video_path}" -vn -acodec pcm_s16le -ar 16000 -ac 1 "{audio_path}" 2>/dev/null'
    os.system(cmd)
    return audio_path if os.path.exists(audio_path) else None

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill documentation instructs users to run Python scripts that read input videos, write transcripts/reports, and depend on shell execution, but the manifest declares no explicit tool scope or permissions. This creates a trust and containment gap: an agent or user may invoke file and shell-capable behavior without clear least-privilege boundaries, increasing the risk of unintended file access or command execution beyond the expected workflow.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This skill is described as a batch video speech-to-text tool that generates subtitles, text, and reports. While using ffmpeg for audio extraction is an implementation detail consistent with transcription, invoking it through a shell command introduces command-execution capability that is broader than the stated user-facing purpose and not explicitly framed as subprocess execution in the skill description.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module docstring and command-line help text are written in Chinese, which effectively forces a specific language for user-facing interaction. Under the stated policy, locale-specific language is acceptable when justified or optional, but here no opt-in or explanation is provided.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

This code creates SRT and TXT files for each input video and also creates then deletes temporary WAV audio files, but the only user-facing messaging is generic progress/status output. There is no explicit warning in code comments, prompts, or help text that processing will write transcripts and temporary extracted audio to the output directory, which is relevant because transcripts may contain sensitive spoken content.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The comment says 'Mac用cuda(metal实际上会fallback)', but the code literally returns 'cuda' on Darwin even though CUDA is not the native Mac acceleration backend. This is not merely incomplete documentation; it actively misdescribes the intended execution mode and could mislead reviewers about what hardware/backend the code is using.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The argparse description, epilog examples, and argument help strings are all written in Chinese, which imposes a single locale on all users. The policy allows this only when the tool offers a language choice or clearly documents a justified regional scope, neither of which is present here.

Content

No source excerpt is available for this finding.