{"id":"PYSEC-2026-1223","summary":"Bokeh server applications have Incomplete Origin Validation in WebSockets","details":"This vulnerability allows for **Cross-Site WebSocket Hijacking (CSWSH)** of a deployed Bokeh server instance. \n\n### Scope\n\nThis vulnerability is only relevant to deployed Bokeh server instances. There is no impact on static HTML output, standalone embedded plots, or Jupyter notebook usage. \n\nThis vulnerability does not prevent any requirements for up-front authentication on Bokeh servers that have authentication hooks in place, and cannot be used to make Bokeh servers deployed on private, internal networks accessible outside those networks. \n\n### Impact\n\nIf a Bokeh server is configured with an allowlist (e.g., `dashboard.corp`), an attacker can register a domain like `dashboard.corp.attacker.com` (or use a subdomain if applicable) and lure a victim to visit it. The malicious site can then initiate a WebSocket connection to the vulnerable Bokeh server. Since the Origin header (e.g., `http://dashboard.corp.attacker.com/`) matches the allowlist according to the flawed logic, the connection is accepted.\n\nOnce connected, the attacker can interact with the Bokeh server on behalf of the victim, potentially accessing sensitive data, or modifying visualizations.\n\n### Patches\nPatched in versions 3.8.2 and later.\n\n### Workarounds\n\nNone\n\n### Technical description\n\nThe `match_host` function in `src/bokeh/server/util.py` contains a flaw in how it compares hostnames against the allowlist patterns. The function uses Python's `zip()` function to iterate over the parts of the hostname and the pattern simultaneously. However, `zip()` stops iteration when the shortest iterable is exhausted.\n\nBecause the code only checks if the *pattern* is longer than the *host* (lines 232-233), but fails to check if the *host* is longer than the *pattern*, a host that **starts** with the pattern (but has additional segments) will successfully match.\n\nFor example, if the allowlist is configured to `['[example.com](http://example.com/)']`, the function will incorrectly validate `[example.com.bad.com](http://example.com.evil.com/)` as a match:\n1. `host` parts: `['example', 'com', 'bad', 'com']`\n2. `pattern` parts: `['example', 'com']`\n3. `zip` compares `example==example` (OK) and `com==com` (OK).\n4. Iteration stops, and the function returns `True`.","aliases":["CVE-2026-21883","GHSA-793v-589g-574v"],"modified":"2026-07-07T17:47:32.650537140Z","published":"2026-07-07T16:03:16.722803Z","references":[{"type":"WEB","url":"https://github.com/bokeh/bokeh/security/advisories/GHSA-793v-589g-574v"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-21883"},{"type":"WEB","url":"https://github.com/bokeh/bokeh/commit/cedd113b0e271b439dce768671685cf5f861812e"},{"type":"WEB","url":"https://aydinnyunus.github.io/2026/01/24/bokeh-websocket-hijacking-cve-2026-21883"},{"type":"PACKAGE","url":"https://github.com/bokeh/bokeh"},{"type":"PACKAGE","url":"https://pypi.org/project/bokeh"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-793v-589g-574v"}],"affected":[{"package":{"name":"bokeh","ecosystem":"PyPI","purl":"pkg:pypi/bokeh"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.8.2"}]}],"versions":["0.10.0","0.11.0","0.11.1","0.12.0","0.12.1","0.12.10","0.12.11","0.12.13","0.12.14","0.12.15","0.12.16","0.12.2","0.12.3","0.12.4","0.12.5","0.12.6","0.12.7","0.12.9","0.13.0","0.2","0.3","0.4","0.4.1","0.4.4","0.5.0","0.5.1","0.5.2","0.6.0","0.6.1","0.7.0","0.7.1","0.8.0","0.8.1","0.8.2","0.9.0","0.9.1","0.9.2","0.9.3","1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.1.0","1.2.0","1.3.0","1.3.1","1.3.2","1.3.4","1.4.0","2.0.0","2.0.0rc1","2.0.0rc2","2.0.1","2.0.2","2.1.0","2.1.0rc1","2.1.0rc2","2.1.0rc3","2.1.1","2.2.0","2.2.0.dev4","2.2.0.dev6","2.2.0.dev7","2.2.0.dev8","2.2.0rc1","2.2.0rc2","2.2.0rc3","2.2.1","2.2.2","2.2.3","2.3.0","2.3.0.dev1","2.3.0.dev10","2.3.0.dev11","2.3.0.dev12","2.3.0.dev13","2.3.0.dev14","2.3.0.dev2","2.3.0.dev3","2.3.0.dev5","2.3.0.dev7","2.3.0.dev8","2.3.0.dev9","2.3.0rc2","2.3.0rc3","2.3.0rc4","2.3.1","2.3.1.dev1","2.3.1rc1","2.3.1rc2","2.3.2","2.3.2rc1","2.3.3","2.3.3rc1","2.4.0","2.4.0.dev1","2.4.0.dev2","2.4.0.dev4","2.4.0.dev5","2.4.0.dev6","2.4.0.dev7","2.4.0.dev8","2.4.0rc1","2.4.0rc2","2.4.0rc3","2.4.1","2.4.1rc1","2.4.2","2.4.2.dev1","2.4.2rc1","2.4.3","2.4.3.dev1","2.4.3.dev3","2.4.3.dev4","2.4.3rc1","3.0.0","3.0.0.dev1","3.0.0.dev10","3.0.0.dev11","3.0.0.dev13","3.0.0.dev14","3.0.0.dev15","3.0.0.dev16","3.0.0.dev17","3.0.0.dev18","3.0.0.dev19","3.0.0.dev2","3.0.0.dev20","3.0.0.dev3","3.0.0.dev4","3.0.0.dev5","3.0.0.dev6","3.0.0.dev7","3.0.0.dev8","3.0.0.dev9","3.0.0rc1","3.0.0rc2","3.0.0rc3","3.0.0rc4","3.0.0rc5","3.0.0rc6","3.0.1","3.0.1rc1","3.0.2","3.0.2rc1","3.0.3","3.0.3rc1","3.1.0","3.1.0.dev1","3.1.0.dev2","3.1.0.dev3","3.1.0.dev4","3.1.0.dev5","3.1.0rc1","3.1.0rc2","3.1.0rc3","3.1.1","3.1.1rc1","3.2.0","3.2.0.dev1","3.2.0.dev2","3.2.0.dev3","3.2.0.dev4","3.2.0rc1","3.2.0rc2","3.2.0rc3","3.2.1","3.2.2","3.2.2rc1","3.3.0","3.3.0.dev1","3.3.0.dev2","3.3.0.dev3","3.3.0rc1","3.3.0rc2","3.3.0rc3","3.3.1","3.3.1.dev1","3.3.1rc1","3.3.2","3.3.3","3.3.4","3.3.4rc1","3.4.0","3.4.0.dev1","3.4.0.dev2","3.4.0.dev3","3.4.0.dev4","3.4.0.dev5","3.4.0.dev6","3.4.0.dev7","3.4.0.dev8","3.4.0rc1","3.4.0rc2","3.4.1","3.4.2","3.4.3","3.5.0","3.5.0.dev1","3.5.0.dev3","3.5.0.dev4","3.5.0.dev5","3.5.0.dev6","3.5.0.dev7","3.5.0.dev8","3.5.0rc1","3.5.0rc2","3.5.1","3.5.2","3.6.0","3.6.0.dev1","3.6.0rc1","3.6.0rc2","3.6.1","3.6.2","3.6.3","3.6.3rc1","3.6.3rc2","3.7.0","3.7.0.dev1","3.7.0.dev2","3.7.0.dev3","3.7.0.dev4","3.7.0.dev5","3.7.0.dev6","3.7.0.dev7","3.7.0.dev8","3.7.0.dev9","3.7.0rc1","3.7.0rc2","3.7.1","3.7.2","3.7.3","3.7.3rc1","3.7.3rc2","3.8.0","3.8.0.dev1","3.8.0.dev2","3.8.0.dev3","3.8.0.dev4","3.8.0rc1","3.8.0rc2","3.8.1"],"database_specific":{"source":"https://github.com/pypa/advisory-database/blob/main/vulns/bokeh/PYSEC-2026-1223.yaml"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N/E:U"}]}