Back to skill

Security audit

Emergence Video Producer

Security checks for vulnerabilities and agentic risk

Overview

This video-production skill is mostly coherent, but it needs review because its audio helper unnecessarily loads local .env secrets and passes them to a network-capable text-to-speech subprocess.

Install only in a project workspace where generated files can be overwritten safely. Avoid running the audio helper in directories with sensitive .env files, or remove dotenv loading and run TTS with a minimal environment. Treat narration text, slide content, target URLs, and template background image fetches as data that may be sent to external services.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_audio.py:4
Finding
Unnecessary Exposure of Environment Secrets to a Network-Capable TTS Subprocess<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate_audio.py`, lines 4–17 **Vulnerability Type**: Unrestricted environment inheritance by an external subprocess **Risk Level**: Medium ### Vulnerable Code ```python from dotenv import load_dotenv load_dotenv() def generate_edge_tts(text, output_file, voice="zh-CN-XiaoxiaoNeural"): """Uses Edge-TTS (free, high quality).""" print(f"Generating Edge-TTS for: {text[:20]}...") cmd = [ "edge-tts", "--text", text, "--write-media", output_file, "--voice", voice ] subprocess.run(cmd, check=True) ``` ### Technical Analysis The script calls `load_dotenv()` without selecting individual required variables. This loads all values discovered in the `.env` file into the Python process environment, including potentially unrelated API keys, access tokens, passwords, or service credentials. The subsequent `subprocess.run()` call does not provide an explicit `env` argument. Child processes inherit the parent environment by default, so every loaded secret becomes accessible to the externally resolved `edge-tts` executable. The script does not use any of the loaded environment variables itself, making this exposure unnecessary. The executable is resolved through the process `PATH`. If an attacker can place a malicious executable named `edge-tts` earlier in `PATH`, replace the installed executable, or compromise the dependency, that executable can read and disclose all inherited `.env` values. Because Edge TTS is network-capable by design, inherited sensitive values could also be transmitted externally by a compromised implementation. The list-based subprocess invocation prevents shell metacharacter injection through `text`, `output_file`, or `voice`; the issue is environment exposure and executable trust rather than shell command injection. ### Attack Path 1. The user or deployment environment stores sensitive credentials in a project or discoverable `.env ...[truncated 1370 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove `load_dotenv()` and the `python-dotenv` import because this script does not use any loaded environment variable. 2. Pass a minimal, allowlisted environment to the subprocess rather than inheriting the complete parent environment. Include only values required for executable operation, such as a trusted `PATH` and locale settings. 3. Resolve `edge-tts` from a trusted installation location and invoke it through a validated absolute path. Verify that the resolved file is not located in a user-controlled or project-local directory. 4. Pin and verify the `edge-tts` dependency through an approved dependency-management process. 5. Keep sensitive credentials outside broadly loaded project `.env` files where possible, and grant each credential only the permissions required for its intended service. 6. If credentials become necessary for a future TTS provider, retrieve only the specifically required variables and avoid forwarding unrelated secrets to child processes. Example hardened approach: ```python import os import subprocess EDGE_TTS_PATH = "/usr/local/bin/edge-tts" safe_env = { "PATH": "/usr/local/bin:/usr/bin:/bin", "LANG": os.environ.get("LANG", "C.UTF-8"), } subprocess.run( [ EDGE_TTS_PATH, "--text", text, "--write-media", output_file, "--voice", voice, ], check=True, env=safe_env, ) ``` ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill describes shell and environment-dependent execution (`webreel`, `ffmpeg`, TTS tooling, cloud VM/headless operation) but does not declare any tool scope or allowed-tools boundary. This increases the chance an agent will invoke broad shell capabilities without explicit restriction, which can lead to unintended command execution, file modification, or access beyond what the user expected.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The skill advertises narration via DashScope/Edge-TTS but does not warn that script content, slide text, or other user-provided material may be sent to third-party services for synthesis. In a video-production context, this can expose confidential product details, unreleased features, or proprietary academic content to external providers without informed consent.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
"ffprobe", "-v", "error", "-show_entries", "format=duration",
        "-of", "default=noprint_wrappers=1:nokey=1", audio_path
    ]
    result = subprocess.run(cmd, capture_output=True, text=True, check=True)
    return float(result.stdout.strip())

def assemble_mp4(frame_dir, audio_path, output_path, fps):
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The code defaults to the `zh-CN-XiaoxiaoNeural` voice in both the function signature and CLI argument, which imposes a specific language/locale choice on users unless they override it. This is a natural-language policy concern because the skill does not document a user choice prompt or a justification for restricting output to Chinese.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
"--write-media", output_file,
        "--voice", voice
    ]
    subprocess.run(cmd, check=True)
    print(f"✓ Audio saved to {output_file}")

def main():
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
"--write-media", output_file,
        "--voice", voice
    ]
    subprocess.run(cmd, check=True)
    print(f"✓ Audio saved to {output_file}")

def main():
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Missing User Warnings

Low
Confidence
84% confidence
Finding
The workflow automatically generates artifacts such as `storyboard.md`, `webreel.config.json`, `slides.md`, narration outputs, and final media, but does not explicitly warn that existing files may be created or overwritten. In practice this can cause accidental loss of local work products or confusion about which generated artifacts are safe to keep, publish, or replace.

Static analysis

No suspicious patterns detected.