Back to skill

Security audit

Wjs Editing Multicam

Security checks for vulnerabilities and agentic risk

Overview

The skill is a local multicam video editor, but it needs Review because crafted edit-plan files can be fed into FFmpeg without enough validation.

Use this only with EDL files you generated yourself from trusted media, or after validating the JSON fields and bounds. Avoid rendering EDLs from other people in an unrestricted environment, and keep backups because FFmpeg runs with overwrite enabled for the chosen output path.

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
scripts/render_cuts.py:20
Finding
Unvalidated EDL Values Allow FFmpeg Filter-Graph Injection in the Hard-Cut Renderer<![CDATA[ ## Vulnerability Details **File Location**: `scripts/render_cuts.py`, lines 20-26 and 42-60 **Vulnerability Type**: FFmpeg filter-graph injection through untrusted EDL data **Risk Level**: Medium ### Vulnerable Code ```python plan = json.loads(args.edl.read_text()) inputs = plan["inputs"] deltas = plan.get("deltas", [0.0] * len(inputs)) edl = plan["edl"] audio_src = plan["audio_source"] W, H = args.width, args.height ``` ```python filters = [] for i, row in enumerate(edl): cam = row["cam"]; start = row["start"]; end = row["end"] filters.append( f"[{cam}:v]trim=start={start}:end={end},setpts=PTS-STARTPTS," f"scale={W}:{H}:force_original_aspect_ratio=decrease," f"pad={W}:{H}:(ow-iw)/2:(oh-ih)/2,setsar=1,fps=30[v{i}]" ) concat_inputs = "".join(f"[v{i}]" for i in range(len(edl))) filters.append(f"{concat_inputs}concat=n={len(edl)}:v=1:a=0[vout]") fc = ";".join(filters) # Audio: trim from the EDL's first-row start (so window EDLs work) audio_offset = edl[0]["start"] if edl else 0.0 duration = plan["duration_sec"] fc += (f";[{audio_src}:a:0]atrim=start={audio_offset}:" f"duration={duration},asetpts=PTS-STARTPTS[aout]") ``` ### Technical Analysis The renderer parses an EDL JSON document and directly interpolates the following fields into an FFmpeg `-filter_complex` expression: - `edl[].cam` - `edl[].start` - `edl[].end` - `audio_source` - `duration_sec` The code does not verify that camera identifiers are bounded integers or that time values are finite numbers. JSON therefore permits an attacker-controlled string to reach the FFmpeg filter parser. Characters such as brackets, commas, semicolons, colons, and option separators have structural meaning inside an FFmpeg filter graph. A crafted value can terminate the intended expression and append or modify filter chains. The use of `subprocess.run(cmd, check=True)` with an argument list prevents operating-system shell injection, but it does not prevent injection ...[truncated 1966 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Validate the complete EDL against a strict schema before constructing any FFmpeg command: - Require `inputs` to be a non-empty list of strings. - Require `audio_source` and every `cam` value to be integers, explicitly rejecting booleans. - Enforce `0 <= audio_source < len(inputs)` and `0 <= cam < len(inputs)`. - Require `start`, `end`, `duration_sec`, and every delta to be finite numeric values. - Enforce `0 <= start < end <= duration_sec`. - Reject empty EDLs, unknown fields where practical, and mismatched `inputs`, `deltas`, and `coverage` lengths. 2. Convert validated numbers to canonical representations before interpolation. Do not accept arbitrary strings for numeric graph parameters. 3. Set reasonable limits on: - Number of EDL segments. - Total duration. - Individual segment duration. - Output resolution, bitrate, and frame rate. 4. Reject non-finite floating-point values with `math.isfinite()`. 5. Consider generating a filter-complex script from validated primitives. A script file does not replace validation, but it makes graph construction and review clearer. 6. Run FFmpeg with least privilege in a restricted environment when processing EDLs from untrusted sources. Where feasible, limit filesystem access, networking, runtime, memory, CPU, and output size. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/render_pip.py:84
Finding
Unvalidated EDL Values Allow FFmpeg Filter-Graph Injection in the PiP Renderer<![CDATA[ ## Vulnerability Details **File Location**: `scripts/render_pip.py`, lines 84-91 and 151-178 **Vulnerability Type**: FFmpeg filter-graph injection through untrusted EDL data **Risk Level**: Medium ### Vulnerable Code ```python plan = json.loads(args.edl.read_text()) inputs = plan["inputs"] deltas = plan.get("deltas", [0.0] * len(inputs)) edl = plan["edl"] audio_src = plan["audio_source"] K = len(inputs) coverage = plan.get("coverage", [[0.0, plan["duration_sec"]]] * K) ``` ```python filters = [] for i, row in enumerate(edl): cam = row["cam"] s, e = row["start"], row["end"] # Main filters.append( f"[{cam}:v]trim=start={s}:end={e},setpts=PTS-STARTPTS," f"scale={W}:{H}:force_original_aspect_ratio=decrease," f"pad={W}:{H}:(ow-iw)/2:(oh-ih)/2,setsar=1,fps={args.fps}[m{i}]" ) pip_cam = pick_pip(row, K, coverage, mode=args.pip_pick) if pip_cam is None: # No PiP candidate (only one cam covered for this segment) — pass main through filters.append(f"[m{i}]copy[v{i}]") continue # PiP — same time range from a different input pip_chain = ( f"[{pip_cam}:v]trim=start={s}:end={e},setpts=PTS-STARTPTS," f"scale={pw}:{ph}:force_original_aspect_ratio=decrease," f"pad={pw}:{ph}:(ow-iw)/2:(oh-ih)/2," ) if bw > 0: pip_chain += f"pad={pip_total_w}:{pip_total_h}:{bw}:{bw}:white," pip_chain += f"setsar=1,fps={args.fps}[p{i}]" filters.append(pip_chain) filters.append(f"[m{i}][p{i}]overlay={x_expr}:{y_expr}:eof_action=pass[v{i}]") concat = "".join(f"[v{i}]" for i in range(len(edl))) filters.append(f"{concat}concat=n={len(edl)}:v=1:a=0[vout]") audio_offset = edl[0]["start"] if edl else 0.0 dur = plan["duration_sec"] fc = ";".join(filters) fc += (f";[{audio_src}:a:0]atrim=start={audio_offset}:" f"duration={dur},asetpts=PTS-STARTPTS[aout]") ``` The explicit PiP override is also accepted from the EDL without range validation: ```pytho ...[truncated 2921 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Introduce a shared EDL validation function used by both renderers. 2. Enforce strict types and bounds: - `cam`, `pip`, and `audio_source` must be integers and must fall within the input array. - Explicitly reject booleans, strings, negative indices, and indices greater than or equal to `len(inputs)`. - `start`, `end`, `duration_sec`, deltas, and coverage boundaries must be finite numbers. - Every segment must satisfy `0 <= start < end <= duration_sec`. - Coverage entries must satisfy `0 <= start <= end <= duration_sec`. 3. Validate cross-field consistency: - `deltas` and `coverage` must have exactly one entry per input. - Main and PiP cameras must be different. - Both selected cameras must cover the complete segment. - EDL segments should be ordered, non-overlapping, and constrained to the declared output window. 4. Canonicalize validated numeric values before inserting them into the filter graph. Never interpolate arbitrary EDL strings into FFmpeg expressions. 5. Limit the number of EDL rows and the maximum output duration to prevent graph-size and resource-exhaustion attacks. 6. Validate command-line dimensions, frame rate, border size, margins, bitrate, and PiP width against operational limits. 7. For untrusted projects, execute FFmpeg with least privilege and resource restrictions, and disable or constrain unnecessary network and filesystem capabilities where the deployment environment permits. ]]>
Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The core behavior broadly aligns with multicam auto-editing from synced recordings using audio energy and sidecar timing data. However, the declared description overstates the delivered functionality in material ways. This script performs analysis and edit decision generation only: it extracts audio, computes envelopes, aligns them by sidecar offsets, selects camera segments, and writes an EDL JSON file. There is no code here to render or mux a final combined MP4, and no picture-in-picture overlay implementation. Those are significant user-visible capability gaps rather than minor implementation details, so this should be flagged as a mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The declared description presents this skill as an end-to-end multicam auto-editing tool that ingests multiple synced recordings and combines them by automatically selecting cameras based on audio energy, optionally with PiP. The supplied code chunk only renders a previously generated edit decision list (EDL) into an MP4. It performs trimming, scaling, padding, concatenation, and audio trimming via ffmpeg. The docstring explicitly states 'Hard cuts only (no transitions / no PiP),' and there is no logic for analyzing audio energy or choosing camera switches. Therefore, the code's actual behavior is materially narrower and different from the declared primary purpose.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill describes capabilities that read and write files and invoke shell-based tooling like ffmpeg, but it does not declare any explicit tool scope or permissions boundary. In an agent environment, that omission can cause over-broad tool access, making it easier for the skill to operate on unintended files or execute commands beyond its stated purpose.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The documentation says each input must have a `.sync.json` sidecar, but the implementation silently falls back to `delta=0` and full coverage when sidecars are missing or malformed. In this editing context, that can cause misaligned timelines and incorrect camera selection without failing fast, producing deceptive or materially wrong output from untrusted or incomplete inputs.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
SCHEMA_VERSION = 1

def extract(video: Path, dst: Path):
    subprocess.run(["ffmpeg", "-nostdin", "-y", "-i", str(video),
                    "-map", "0:a:0", "-ac", "1", "-ar", str(SR),
                    "-f", "s16le", str(dst)], check=True, stderr=subprocess.DEVNULL)
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
str(args.out),
    ])
    print(" ".join(cmd))
    subprocess.run(cmd, check=True)

if __name__ == "__main__":
    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
str(args.out),
    ])
    print(" ".join(cmd))
    subprocess.run(cmd, check=True)

if __name__ == "__main__":
    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
str(args.out),
    ])
    print(" ".join(cmd))
    subprocess.run(cmd, check=True)

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

Static analysis

No suspicious patterns detected.