//nefariousplan

CVE-2026-44353: Streamlink Mounts a FileAdapter on Every Session. The m3u8 Parser Was Never Told.

vendor

pattern

cve

proof of concept

Streamlink 8.3.0 and earlier ship an m3u8 parser whose entire check on segment URIs is one conditional. if uri and urlparse(uri).scheme: return uri. The parser asks whether the URI has a scheme. It does not ask which one.

Every Streamlink HTTPSession mounts a FileAdapter at construction time, because the CLI has supported local file:// playlists for years and the feature is in use. The parser was never told that not every playlist is local. CVE-2026-44353 is the local-file read that lives in the gap: a remote HLS playlist hosted at http://attacker.example/playlist.m3u8 lists file:///etc/passwd as a segment, and the same session that fetched the playlist over HTTP services the file read through the adapter that was mounted for somebody else's use case.

The parser asks whether a scheme is present. It does not ask which one.

The complete pre-patch implementation of M3U8Parser.uri, in src/streamlink/stream/hls/m3u8.py, is four lines:

def uri(self, uri: str) -> str:
    if uri and urlparse(uri).scheme:
        return uri
    elif uri and self.m3u8.uri:
        return urljoin(self.m3u8.uri, uri)
    else:
        return uri

uri() is the resolver every URI in an HLS playlist passes through. It is called from parse_tag_ext_x_key for the URI attribute of #EXT-X-KEY, from parse_tag_ext_x_map for the URI of #EXT-X-MAP, from parse_tag_ext_x_media for the URI of #EXT-X-MEDIA alternative renditions, from parse_tag_ext_x_i_frame_stream_inf for the URI of an I-frame variant playlist, from the segment-line handler at self.get_segment(self.uri(line)), and from the sub-playlist handler at self.get_playlist(self.uri(line)). The contract is the same in every case. Relative URIs are joined against the playlist's own URL. Absolute URIs are returned verbatim. Whether the absolute URI's scheme is one the parser expected does not enter the conversation.

urlparse returns a non-empty scheme for http, https, file, ftp, gopher, dict, data, and any other RFC 3986-shaped string. The pre-patch parser passes them all to the rest of the pipeline.

The same shape lives in the DASH parser. MPDNode.base_url and the segment-template URL builder in src/streamlink/stream/dash/manifest.py both call urljoin against the parsed manifest's _base_url without consulting the scheme. A <BaseURL>file:///etc/</BaseURL> element in a .mpd is a valid URL that urljoin accepts and returns.

The minimal reproducer the advisory ships is a six-line playlist:

#EXTM3U
#EXT-X-VERSION:3
#EXTINF:5.0,
file:///etc/passwd
#EXT-X-ENDLIST

Served from any HTTP host the attacker controls. The victim runs streamlink http://attacker.example/playlist.m3u8 best -o output.ts, and output.ts ends with the contents of the local /etc/passwd. The work the parser does on that segment line is urlparse("file:///etc/passwd").scheme == "file", truthy, return the string unchanged. The rest of the chain runs as if it were any other absolute URL.

The FileAdapter is mounted because local playlists are a feature.

The reason file:///etc/passwd becomes an actual file read, rather than a requests exception, is in HTTPSession.__init__, at src/streamlink/session/http.py:

class HTTPSession(Session):
    def __init__(self):
        super().__init__()

        self.headers["User-Agent"] = useragents.DEFAULT
        self.timeout = 20.0

        self.mount("file://", FileAdapter())

FileAdapter is a vendored copy of the requests-file package, kept in-tree at src/streamlink/packages/requests_file.py. Its send() method parses the URL, opens the path with io.open(path, "rb"), and hands the file object back as Response.raw:

resp.raw = io.open(path, "rb")
resp.raw.release_conn = resp.raw.close

Streamlink's segmented-stream reader iterates Response.raw and writes the bytes to whatever output the user selected with -o, --stdout, or a configured player. There is no transform between the file's bytes and the output stream's bytes; the local file's contents become the "stream."

The requests library does not ship a file:// adapter by default. The Python ecosystem made that choice on purpose: a library positioned to fetch HTTP should not silently read the local filesystem when somebody passes it a URL string. Streamlink overrides the default because Streamlink has a use case requests does not. The CLI accepts streamlink file:///path/to/archive.m3u8 best for power users replaying archived streams, the test suite feeds local fixtures through the production fetch path, and several plugins exercise it for offline parsing.

Removing the adapter is not on the table. The feature is in use.

What the parser was never told is that the session it hands segment URIs to is the same session that mounts the adapter. The parser builds a string. The session looks the string up in its adapter table. The adapter the parser did not know was mounted services every URI whose scheme matches the adapter's prefix. The trust boundary that should have lived in the parser, "what is this playlist allowed to reference," lived nowhere.

The patch is a downgrade detector, not an allowlist.

The fix lands in three commits. The first adds a utility, is_insecure_scheme, to src/streamlink/utils/url.py:

def is_insecure_scheme(current_scheme: str, target_scheme: str) -> bool:
    return (
        target_scheme == "file" and current_scheme != "file"
        or target_scheme == "http" and current_scheme == "https"
    )

The second wires it into the m3u8 parser. M3U8Parser.__init__ records the base URI's scheme on the parser instance:

self._scheme = urlparse(base_uri).scheme if base_uri else None

uri() consults it on every absolute URI it sees:

def uri(self, uri: str) -> str:
    if uri and (scheme := urlparse(uri).scheme):
        base_scheme = self._scheme
        if not base_scheme or is_insecure_scheme(base_scheme, scheme):
            raise ValueError(f"Prevented access to insecure resource in playlist: {base_scheme=!r} {scheme=!r}")
        return uri
    elif uri and self.m3u8.uri:
        return urljoin(self.m3u8.uri, uri)
    else:
        return uri

The third applies the same comparison to the DASH BaseURL resolver and to a new _MultipleSegmentBaseType.make_url static method that all segment-URL constructors route through.

is_insecure_scheme returns True in exactly two cases. First, target scheme file when the playlist's own scheme is anything other than file. That closes the CVE: an http:// or https:// playlist can no longer reference a file:// segment. Second, target scheme http when the playlist's own scheme is https. That closes the obvious downgrade an MitM might want, swapping the next segment URL to plaintext HTTP.

The shape is "no scheme below the floor the playlist's own scheme establishes." That shape is not an allowlist.

The test the patch ships with makes the design intent visible. From tests/utils/test_url.py:

@pytest.mark.parametrize(
    ("current_scheme", "target_scheme", "expected"),
    [
        ("http", "", False),
        ("https", "", False),
        ("file", "", False),
        ("http", "http", False),
        ("http", "https", False),
        ("https", "https", False),
        ("https", "http", True),
        ("file", "file", False),
        ("http", "file", True),
        ("https", "file", True),
    ],
)
def test_is_insecure_scheme(current_scheme, target_scheme, expected):
    ...

http to file, https to file, and https to http are the three rows that assert True. Every other transition the parametrization enumerates returns False. file to file is explicitly preserved, that is the local-playlist-with-local-segments use case the FileAdapter is mounted for. Everything else passes silently. Schemes outside {http, https, file, ""} are not exercised at all; the function's only test against them is the literal string comparison target_scheme == "file", which is false for anything that is not the literal "file".

Walk through what still passes when a remote attacker controls the playlist:

  • http://playlist references data:text/plain;base64,XXX segment. target_scheme == "data". Neither branch of is_insecure_scheme fires. Allowed by the parser.
  • http://playlist references gopher://host/_segment. Allowed.
  • http://playlist references ftp://host/segment.ts. Allowed.
  • http://playlist references dict://host/word. Allowed.

In practice these do nothing useful today because Streamlink's HTTPSession mounts no adapter for them, and requests raises requests.exceptions.InvalidSchema at fetch time. The CVE-2026-44353 chain worked because Streamlink mounted FileAdapter and forgot to gate the parser. The patch corrects the gate at the parser. The set of schemes the gate considers "safe" is whatever happens not to be mounted as an adapter on the session today.

grep -rn "self.mount(" src/streamlink/ returns one site, the file:// mount in HTTPSession.__init__. The current safe set, by the patch's definition, is "everything except file://." A plugin or a future feature that mounts a second adapter, the obvious candidates are data:// for inline test playlists, ssh:// for SFTP-backed archive fetching, an in-process cache:// scheme for warm restarts, would reopen the same class for the new scheme without touching the m3u8 parser. The patch did not install an allowlist. The patch installed a comparison against a single field the parser already had.

The realistic exposure is anything that runs Streamlink on a URL it does not own.

The CVE description and the GHSA advisory model the victim as a user who pipes a malicious URL into the streamlink binary on their own workstation. That is the cleanest reproducer. It is also the case where the user has the smallest practical incentive to point Streamlink at a URL they do not control.

Streamlink is library code as much as CLI. It runs inside Discord bots that record streams on submission and post the recording back to a channel, IPTV middleware that ingests user-submitted channel lists, archival services that fetch HLS by URL on schedule, transcoding pipelines that pre-process a stream before re-publishing it, home-server NAS frontends that pull from any URL the operator pastes, and headless CI jobs that smoke-test playlist availability. Every one of those is a long-running service that accepts a URL from a less-trusted caller, runs streamlink.streams(url) or HLSStream.parse_variant_playlist(session, url) against it, and writes the resulting bytes somewhere reachable: a Discord channel, a CDN bucket, a database row, a downstream consumer.

For those deployments, CVE-2026-44353 reads as "any client who can submit a URL to your Streamlink service can read any file the service has read access to." The Streamlink config and any plugin's persisted state, the host's /etc/passwd, AWS credentials at ~/.aws/credentials if the service runs as a user with one, a Kubernetes service-account token at /var/run/secrets/kubernetes.io/serviceaccount/token, the recording bot's own bot-token file. The threat model the operator was given by the upstream library did not include URIs the parser would happily forward to FileAdapter, because the library did not include that case in its own threat model either.

Convention is the allowlist.

The HLS RFC implies segment URIs are HTTP or HTTPS through every context in which the spec exercises them. It does not formally constrain them. Streamlink's m3u8 parser implemented exactly what the spec's grammar permits and trusted the implication to do the constraining work. The implication did not.

That is the shape this post is filed under: convention is the allowlist. Specs imply value sets through example and downstream-consumer assumption; implementations read at the syntactic type the grammar admits. The two readings of the same field disagree, and the disagreement is the bug class. Streamlink's m3u8 segment URI is one instance. JWT's alg field admitting none is another. HTTP Host header validation against a vhost table that does not enforce IDN normalisation is another. The patch in each case narrows the implementation against the local context the maintainer can see today; the convention remains the only thing keeping tomorrow's adjacent feature from re-opening the class.

The FileAdapter is mounted because local playlists are a feature. The parser was never told that not every playlist is local.

PoC and advisory: GHSA-hgqw-6m45-hw5f.

The patch closes file://. Streamlink's safe-scheme allowlist is still whatever requests adapters are not mounted today.