Back to skill

Security audit

STH Video Template Generation

Security checks for vulnerabilities and agentic risk

Overview

This skill matches its video-generation purpose, but it needs review because it can automatically send data to outside services, upload media, and modify a PostgreSQL database with weak safeguards.

Install only in a controlled staging or production environment with least-privilege PostgreSQL and GCS credentials. Treat CSV input, database URLs, and MCP responses as untrusted; require a preview/dry run and explicit approval before database updates or uploads. Do not use production API keys or broad database accounts until SQL parameterization, URL allowlisting, and clearer rollback controls are added.

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

T09 · Insecure Skill Coding Practices

Error
Location
sth_video_generator.py:84
Finding

SQL Injection Through Unparameterized Database Queries

Content
View full analysis
Optional[Dict[str, str]]: """Fetch template data from song_templates table.""" query = f"SELECT image_url, generate_video_prompt, song_type_id FROM song_templates WHERE id = '{template_id}';" result = run_psql(query) ``` ```python def get_audio_mix_url(song_type_id: str) -> Optional[str]: """Fetch audio mix URL from song_types table.""" query = f"SELECT amix_url FROM song_types WHERE id = '{song_type_id}';" result = run_psql(query) return result if result else None ``` ```python def update_template_urls(template_id: str, video_url: str) -> bool: """Update the song_templates table with video URLs.""" query = f"""UPDATE song_templates SET video_url = '{video_url}', video_url_seedream_v4 = '{video_url}' WHERE id = '{template_id}';""" result = run_psql(query) return result is not None ``` Additional confirmed locations include: - `sth_video_generator_parallel.py:167` - `sth_video_generator_parallel.py:190` - `sth_video_generator_parallel.py:436-438` - `scripts/batch_processor.py:53,63` - `scripts/check_csv_over_12s.py:62,71,80` - `scripts/filter_over_12s.py:62,71` - `scripts/filter_templates.py:60,69` - `scripts/rerun_over_12s.py:62,87,96,105,114,137` - `scripts/resume_filtered_12s.py:54,59` ### Technical Analysis The code builds SQL statements by directly interpolating values into quoted SQL literals. The `template_id` value comes from a user-supplied CSV file. Other interpolated values come from database records or the external MCP service. The resulting query is pas ...[truncated 2127 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
sth_video_generator.py:295
Finding

Unrestricted Remote URL Fetching from Mutable Data Sources

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
sth_video_generator.py:134
Finding

MCP API Key Exposed in Subprocess Command-Line Arguments

Content
View full analysis
` as a command-line argument. 3. A local user, process-monitoring component, or diagnostic collector observes the curl process arguments. 4. The observer extracts the API key. 5. The key is reused to submit video-generation requests or query jobs at the configured MCP endpoint, sub ...[truncated 578 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
SKILL.md:49
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (68)

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · fetch_asset_examples.md (reported line 21)May include surrounding context.

Request

bash
curl -s -X POST \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \

Missing User Warnings

High
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script downloads generated video and uploads the derived output to a public cloud bucket URL without any explicit approval, disclosure, or policy guardrails. In a skill/agent context, undisclosed external transfer of media materially increases data exfiltration and privacy risk, especially because the uploaded object becomes publicly addressable via public_url.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README explicitly describes a workflow that fetches data from PostgreSQL, sends inputs to an external MCP endpoint, and updates persistent database fields, but it does not warn operators that running the tool will transmit template data over the network and modify production-like records. This can lead to unintended data disclosure or accidental database changes by users who reasonably assume a local generation script is non-destructive.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill instructs the agent to process user-supplied CSV input and then update a PostgreSQL-backed production data store, but it does not warn about the destructive or state-changing nature of those actions, require confirmation, or define validation/approval boundaries. In an agent setting, this increases the risk of accidental modification of records, incorrect status updates, or unintended bulk changes triggered by malformed or malicious CSV content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document provides authenticated example requests to an external endpoint and shows use of an API key plus job identifiers, but it does not warn users that running the examples transmits sensitive credentials and identifiers off-host. In a skill context, users may copy-paste commands directly, increasing the chance of inadvertent credential exposure or disclosure of internal job metadata to a third-party service.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
92% confidence
Finding

This example performs a POST request to an external domain with an authentication header and job-specific data. Even though it is documentation, the example facilitates outbound transmission of sensitive information if copied verbatim, which is risky when the skill offers no caution about external data disclosure.

Content

Scanner excerpt · fetch_asset_examples.md (reported line 21)May include surrounding context.

Request

bash
curl -s -X POST \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

This curl pipeline again sends authenticated data to the external MCP service, then processes the response locally to extract a URL. The added convenience of piping output may encourage blind execution, while the core risk remains exposure of API keys and job identifiers to an external service without adequate warning.

Content

Scanner excerpt · fetch_asset_examples.md (reported line 157)May include surrounding context.

Example 4: Extract URL Only (if present)

bash
curl -s -X POST \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill issues database queries by interpolating CSV-derived IDs directly into SQL strings and then executes them through psql. If an attacker can modify input.csv, this enables SQL injection against the local PostgreSQL database, potentially exposing or altering application data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The code reads the database password from configuration and injects it into the subprocess environment for psql. While this is part of database access, there is no docstring, comment, or user-facing disclosure explaining that credentials are being used and passed to an external command.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script fetches media URLs from the database and passes them directly to ffprobe, causing implicit access to external resources. In this context, that is dangerous because the skill has no controls on destination, allowing attacker-influenced URLs to trigger network requests or media parser exposure.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
84% confidence
Finding

ffprobe is invoked on audio_url values retrieved from the database without validation. This can trigger outbound network access to attacker-controlled URLs or processing of malicious media inputs, creating SSRF-style behavior and expanding attack surface through a complex external parser.

Content

Scanner excerpt · scripts/batch_processor.py (reported line 37)May include surrounding context.

python
def get_audio_duration(audio_url):
    try:
        cmd = ['ffprobe', '-v', 'error', '-show_entries', 'format=duration', '-of', 'default=noprint_wrappers=1:nokey=1', audio_url]
        result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
        return float(result.stdout.strip()) if result.returncode == 0 else 0
    except: return 0

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The batch processor does more than read records: it creates temporary files, executes another script, and rewrites the input CSV with statuses. In the absence of any manifest or declared purpose, this combination of orchestration and file mutation is an unjustified capability for an unknown-purpose skill.

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 · scripts/batch_processor.py (reported line 89)May include surrounding context.

python
f.write(f"Song Template ID,Status\n{template_id},Pending\n")
            
        try:
            subprocess.run(['python3', GENERATOR_SCRIPT, tmp_csv], check=True)
            # Read status back
            with open(tmp_csv, 'r') as f:
                tmp_row = list(csv.DictReader(f))[0]

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This block writes results back to INPUT_CSV, replacing the original file contents. Although the script logs progress, it does not clearly warn users beforehand that the input file itself will be overwritten, which is a safety-relevant file modification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code performs network/media probing on URLs fetched from the database without validation, user confirmation, or any trust boundary checks. In this skill context, the URL source is not inherently safe, so ffprobe may be induced to make outbound requests to attacker-chosen endpoints, enabling SSRF, internal network reconnaissance, or interaction with sensitive local services.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
90% confidence
Finding

The script passes a database-derived URL directly to ffprobe, which can trigger outbound network access or access to unexpected protocols/resources. Even without shell injection, this creates an SSRF-style primitive and can be abused to probe internal services or cause the host to fetch attacker-controlled content if the database value is influenced by an attacker.

Content

Scanner excerpt · scripts/check_csv_over_12s.py (reported line 39)May include surrounding context.

python
'-of', 'default=noprint_wrappers=1:nokey=1',
            audio_url
        ]
        result = subprocess.run(probe_cmd, capture_output=True, text=True, timeout=30)
        return float(result.stdout.strip()) if result.returncode == 0 else None
    except:
        return None

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The script sets the PGPASSWORD environment variable and invokes psql, which is a sensitive credential-handling operation. Although the code performs the action directly, there is no docstring, comment, or user-facing warning explaining that database credentials are being used and transmitted to a subprocess.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script performs media probing on URLs obtained indirectly from database content, with no user warning and no validation of destination. In context, the real security issue is not lack of warning but that untrusted URLs can trigger outbound requests to arbitrary systems, increasing SSRF and internal network exposure risk.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
83% confidence
Finding

The code invokes ffprobe on audio_url values pulled from the database, which may point to attacker-controlled remote resources. This can enable server-side request forgery behavior or unintended outbound network access from the host running the script, especially because no scheme, host, or locality validation is performed before probing.

Content

Scanner excerpt · scripts/filter_over_12s.py (reported line 39)May include surrounding context.

python
'-of', 'default=noprint_wrappers=1:nokey=1',
            audio_url
        ]
        result = subprocess.run(probe_cmd, capture_output=True, text=True, timeout=30)
        return float(result.stdout.strip()) if result.returncode == 0 else None
    except:
        return None

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

No manifest is available, so there is no stated purpose that would justify invoking psql against a local database or ffprobe on retrieved audio URLs. These are substantial capabilities—database access and external tool execution—that go beyond a minimal CSV-filtering operation implied by the file name alone.

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 · scripts/batch_processor.py (reported line 30)May include surrounding context.

python
]
    env = {'PGPASSWORD': DB_CONFIG['password']}
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True, timeout=30)
        return result.stdout.strip() if result.returncode == 0 else None
    except:
        return None

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 · scripts/check_csv_over_12s.py (reported line 26)May include surrounding context.

python
]
    env = {'PGPASSWORD': DB_CONFIG['password']}
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True, timeout=30)
        return result.stdout.strip() if result.returncode == 0 else None
    except:
        return None

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 · scripts/filter_over_12s.py (reported line 26)May include surrounding context.

python
]
    env = {'PGPASSWORD': DB_CONFIG['password']}
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True, timeout=30)
        return result.stdout.strip() if result.returncode == 0 else None
    except:
        return None

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 · scripts/filter_templates.py (reported line 26)May include surrounding context.

python
]
    env = {'PGPASSWORD': DB_CONFIG['password']}
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True, timeout=30)
        return result.stdout.strip() if result.returncode == 0 else None
    except:
        return None

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 · scripts/rerun_over_12s.py (reported line 28)May include surrounding context.

python
]
    env = {'PGPASSWORD': DB_CONFIG['password']}
    try:
        result = subprocess.run(cmd, env=env, capture_output=True, text=True, timeout=30)
        return result.stdout.strip() if result.returncode == 0 else None
    except:
        return None