Back to skill

Security audit

Video Ai Process

Security checks for vulnerabilities and agentic risk

Overview

This video-processing skill is broadly purpose-aligned, but the bundled script and workflow have unsafe execution, secret-logging, and under-scoped automation concerns.

Install only if you are comfortable reviewing and fixing the Python implementation first. Do not run it on untrusted video paths, do not expose Feishu tokens in logs, and confirm what video content, summaries, and local paths will be written to Feishu before using it with customer or sensitive media.

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

T09 · Insecure Skill Coding Practices

Error
Location
video_pipeline.py:43
Finding

Shell Command Injection Through User-Controlled Video Path

Content
View full analysis

Vulnerability Details

File Location: video_pipeline.py, lines 43–50 and 79–81
Vulnerability Type: OS command injection caused by unsafe shell invocation
Risk Level: High

Vulnerable Code

python
def run_command(cmd, desc="", timeout=300):
    """Execute a command and record elapsed time."""
    print(f"\n{'='*50}")
    print(f"Executing: {desc}")
    print(f"Command: {cmd[:100]}...")
    print('='*50)
    start = time.time()
    result = subprocess.run(
        cmd,
        shell=True,
        capture_output=True,
        text=True,
        timeout=timeout
    )
python
audio_path = "/tmp/video_audio.wav"
cmd_extract = (
    f'ffmpeg -i "{video_path}" -vn -acodec pcm_s16le '
    f'-ar 16000 -ac 1 "{audio_path}" -y'
)
run_command(cmd_extract, "Extract audio")

Technical Analysis

VIDEO_PATH originates from a command-line argument or interactive user input and is passed to step1_transcribe() without validation. The value is directly interpolated into a command string that is executed with shell=True.

Wrapping the input in double quotes does not make it safe. An attacker can include a double quote followed by shell operators, command substitution, or another shell construct to terminate the intended argument and append an arbitrary command.

This is a direct command-injection boundary: untrusted data is converted into executable shell syntax rather than being passed to FFmpeg as an isolated argument.

Attack Path

  1. An attacker supplies a crafted value as the first command-line argument or interactive video path.
  2. The value contains syntax that closes the quoted FFmpeg input argument and introduces an additional shell command.
  3. cmd_extract incorporates that syntax without escaping or validation.
  4. run_command() invokes the command through /bin/sh because shell=True is enabled.
  5. The injected command executes with the same oper ...[truncated 624 chars]
Remediation
View remediation

Remediation Suggestions

Remove shell interpretation and pass every command argument as a separate list element:

python
def run_command(args, desc="", timeout=300):
    result = subprocess.run(
        args,
        shell=False,
        check=True,
        capture_output=True,
        text=True,
        timeout=timeout,
    )
    return result.stdout

run_command(
    [
        "ffmpeg",
        "-i", video_path,
        "-vn",
        "-acodec", "pcm_s16le",
        "-ar", "16000",
        "-ac", "1",
        audio_path,
        "-y",
    ],
    "Extract audio",
)

Additionally:

  • Validate that the input path points to an expected regular video file.
  • Reject unexpected file types where the workflow has a strict format requirement.
  • Do not attempt to solve shell injection only through manual quoting or escaping.
  • Avoid logging complete user-supplied command strings.
  • Run media-processing workers with minimal filesystem and network privileges.

T09 · Insecure Skill Coding Practices

Error
Location
video_pipeline.py:79
Finding

Predictable Shared Temporary Files Enable Symlink and Executable-File Race Attacks

Content
View full analysis

Vulnerability Details

File Location: video_pipeline.py, lines 79–85 and 106–109
Vulnerability Type: Insecure temporary-file creation and time-of-check/time-of-use race
Risk Level: High

Vulnerable Code

python
# Extract audio
audio_path = "/tmp/video_audio.wav"
cmd_extract = (
    f'ffmpeg -i "{video_path}" -vn -acodec pcm_s16le '
    f'-ar 16000 -ac 1 "{audio_path}" -y'
)
run_command(cmd_extract, "Extract audio")

# Transcription
transcript_path = "/tmp/video_transcript.txt"
srt_path = "/tmp/video.srt"
python
with open("/tmp/transcribe_step.py", "w") as f:
    f.write(transcribe_code)

result = subprocess.run(
    ["python3", "/tmp/transcribe_step.py"],
    capture_output=True,
    text=True
)

Technical Analysis

The pipeline uses fixed, globally predictable names under the shared /tmp directory. Multiple pipeline runs and other local processes can therefore address the same files.

The most dangerous file is /tmp/transcribe_step.py. The pipeline writes Python source to this path and later launches a separate interpreter to execute the file. There is a race window between writing and execution in which another local process may replace the file or redirect it through a filesystem link.

The audio, transcript, and subtitle paths are also predictable. Depending on host filesystem protections and process ownership, pre-created links or competing pipeline runs may cause content to be overwritten, redirected, disclosed, or corrupted.

Attack Path

  1. A local attacker observes or predicts the fixed /tmp/transcribe_step.py path.
  2. The attacker monitors the path and races the interval between the pipeline writing the generated script and starting python3.
  3. The attacker replaces the generated file with attacker-controlled Python code, where filesystem permissions permit replacement.
  4. The pipeline executes the predictable path without verifying fi ...[truncated 1076 chars]
Remediation
View remediation

Remediation Suggestions

Create a unique private temporary directory for each pipeline execution and place all intermediate files inside it:

python
import tempfile
from pathlib import Path

with tempfile.TemporaryDirectory(prefix="video-pipeline-") as temp_dir:
    temp_path = Path(temp_dir)
    audio_path = temp_path / "audio.wav"
    transcript_path = temp_path / "transcript.txt"
    srt_path = temp_path / "subtitles.srt"
    # Process files entirely within this private directory.

The generated Python script should be eliminated entirely. Import and invoke WhisperModel directly in the current process:

python
from faster_whisper import WhisperModel

model = WhisperModel("small", device="cpu")
segments, info = model.transcribe(str(audio_path), language="zh")

Further hardening should include:

  • Use restrictive permissions for temporary directories and files.
  • Never execute code from a shared predictable temporary path.
  • Avoid reopening a path after validation when the already-open file descriptor can be used.
  • Ensure cleanup occurs through context managers even when processing fails.
  • Isolate concurrent pipeline runs so they cannot overwrite each other's intermediate data.

T09 · Insecure Skill Coding Practices

Warning
Location
video_pipeline.py:223
Finding

Feishu Configuration Token Is Disclosed in Process Logs

Content
View full analysis

Vulnerability Details

File Location: video_pipeline.py, lines 38–39 and 223–229
Vulnerability Type: Sensitive configuration disclosure through logging
Risk Level: Medium

Vulnerable Code

python
# Feishu configuration
FEISHU_APP_TOKEN = os.environ.get("FEISHU_VIDEO_APP_TOKEN", "")
FEISHU_TABLE_ID = os.environ.get("FEISHU_VIDEO_TABLE_ID", "")
python
def step5_write_feishu(cu_segments, jing_segments):
    """Write records to Feishu."""
    print("\n" + "🔄"*25)
    print("Step 5: Write to Feishu")
    print("🔄"*25)

    start = time.time()

    print("Feishu configuration:")
    print(f"  app_token: {FEISHU_APP_TOKEN}")
    print(f"  table_id: {FEISHU_TABLE_ID}")

Technical Analysis

Values loaded from FEISHU_VIDEO_APP_TOKEN and FEISHU_VIDEO_TABLE_ID are written verbatim to standard output. Pipeline output may be captured by CI systems, agent transcripts, centralized log collectors, shell history tools, or operational monitoring platforms.

The code makes no distinction between harmless diagnostics and sensitive configuration. Even if the application token requires additional authorization in a particular deployment, exposing resource identifiers and token material unnecessarily increases the attack surface and can assist unauthorized API access or resource discovery.

Attack Path

  1. An operator configures the Feishu application token and table identifier through environment variables.
  2. The pipeline reaches Step 5 and prints both values in plaintext.
  3. Standard output is retained in an agent transcript, CI job log, terminal recording, or centralized logging system.
  4. A person or service with access to those logs retrieves the exposed values.
  5. The values are used for unauthorized resource discovery or access to the extent permitted by the associated Feishu authorization model and credentials.

Impact Assessment

The immediate scope is disclosure ...[truncated 514 chars]

Remediation
View remediation

Remediation Suggestions

Never print authentication tokens or complete sensitive identifiers. Report only whether the required configuration exists:

python
print("Feishu configuration:")
print(f"  app_token configured: {bool(FEISHU_APP_TOKEN)}")
print(f"  table_id configured: {bool(FEISHU_TABLE_ID)}")

Additional controls should include:

  • Treat environment-derived credentials as secrets throughout the process.
  • Apply centralized log redaction for known secret names and formats.
  • Avoid including secrets in exceptions, command strings, debug dumps, or telemetry.
  • Restrict access to pipeline and agent logs.
  • Rotate any token that has already appeared in retained output.
  • Validate required configuration without echoing its value.
  • Grant the Feishu integration only the minimum permissions needed for the target table.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

run_command uses subprocess.run(..., shell=True) with command strings that incorporate user-controlled input such as video_path. Although the ffmpeg invocation wraps the path in double quotes, shell parsing still occurs and crafted input containing shell metacharacters like command substitution can lead to arbitrary command execution under the privileges of the script.

Content

Scanner excerpt · video_pipeline.py (reported line 50)May include surrounding context.

python
print(f"命令: {cmd[:100]}...")
    print('='*50)
    start = time.time()
    result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout)
    elapsed = time.time() - start
    if result.returncode != 0:
        print(f"❌ 失败! 耗时: {elapsed:.1f}秒")

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The example transcription call hard-codes language="zh", which constrains processing to Chinese. The document does not offer users a language choice or explain that the skill is intentionally limited to Chinese-only input, creating a locale/language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill explicitly describes automatically uploading video-derived content, metadata, summaries, and local file paths to Feishu/Bitable, but provides no privacy notice, consent step, or data-classification boundary. This creates a real risk of unintended disclosure of sensitive transcript content or internal filesystem information to a third-party SaaS platform, especially when processing customer videos.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The workflow states that final videos are automatically generated, written to disk, and recorded in Feishu immediately after prior steps complete, without an explicit confirmation gate or side-effect warning. Automatic persistence and external record creation can surprise operators and may expose sensitive media artifacts or consume storage/network resources without the user's informed approval.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The top-level documentation states the script performs analysis, segmentation, Feishu writing, and automatic composition end-to-end. In reality, Steps 2, 3, 4, 5, and 6 explicitly print that integration or logic is still pending and return empty or no-op results, which directly conflicts with the claimed completed workflow.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The Step 1 documentation and flow imply a complete transcription stage, and the function prepares an srt_path at L085 and returns it at L116. However, the generated helper script only writes timestamped plain text to transcript_path and never creates the SRT file, so the documented behavior of this step is contradicted by the implementation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The Whisper transcription call hard-codes language="zh", which enforces a specific language/locale regardless of the input video or user preference. This is a natural-language policy issue because the file does not offer opt-in, selection, or a documented region-specific justification for restricting processing to Chinese.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script prints Feishu credential values taken from environment variables directly to stdout. In agent, CI/CD, or shared terminal contexts, stdout is commonly logged or visible to other operators, which can leak reusable API credentials and enable unauthorized access to Feishu data or APIs.

Content

No source excerpt is available for this finding.