CVE-2023-40170: Jupyter server Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-64x5-55rw-9974
CVSS 4.6
CWE-284 CWE-79 CWE-306
Published
Advisory Summary

CVE-2023-40170 is a MODERATE (CVSS 4.6) cross-site scripting vulnerability (CWE-284: Improper Access Control) affecting Jupyter server libraries in the PyPI ecosystem. The issue involves cross-site inclusion (xssi) of files in jupyter-server. Remediation is available by upgrading affected packages to version 2.7.2.

CVE-2023-40170 at a Glance

CVE Identifier CVE-2023-40170
GHSA Identifier GHSA-64x5-55rw-9974
Severity MODERATE
CVSS v3.1 Base Score 4.6
CWE Classification CWE-284: Improper Access Control
Affected Product Jupyter server
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 4.6

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-40170

To remediate this vulnerability, upgrade all affected Jupyter server dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

jupyter-server fixed: 2.7.2
pip install jupyter-server>=2.7.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show jupyter-server

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2023-40170, inspect your installed packages using pip:

pip show jupyter-server

Analyze the terminal output to locate any version of Jupyter server in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.7.2), your application is affected.

Note: The pip show jupyter-server command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. In Jupyter server, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Improper cross-site credential checks on `/files/` URLs could allow exposure of certain file contents, or accessing files when opening untrusted files via "Open image in new tab". ### Patches Jupyter Server 2.7.2 ### Workarounds Use lower performance `--ContentsManager.files_handler_class=jupyter_server.files.handlers.FilesHandler`, which implements the correct checks. ### References Upstream patch for CVE-2019-9644 was not applied completely, leaving part of the vulnerability open. Vulnerability reported by Tim Coen via the [bug bounty program](https://app.intigriti.com/programs/jupyter/jupyter/detail) [sponsored by the European Commission](https://commission.europa.eu/news/european-commissions-open-source-programme-office-starts-bug-bounties-2022-01-19_en) and hosted on the [Intigriti platform](https://www.intigriti.com/).

CVE-2023-40170 Affected Jupyter server Versions

1 component(s)
Fixed Versions:
2.7.2
Product / Package Ecosystem Affected Versions Fixed Version
jupyter-server
PyPI
< 2.7.2
2.7.2

References

Frequently Asked Questions

What is CVE-2023-40170?
CVE-2023-40170 is a security vulnerability in Jupyter server involving cross-site inclusion (XSSI) of files in jupyter-server under CWE-284: Improper Access Control.
Which Jupyter server versions are affected?
Affected versions include releases prior to 2.7.2 across affected packages: jupyter-server.
What version fixes CVE-2023-40170?
Upgrading to 2.7.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jupyter-server affected?
Yes, jupyter-server is affected in releases prior to 2.7.2. Upgrade your dependency to 2.7.2 or later.
What is the CVSS score of CVE-2023-40170?
CVE-2023-40170 has a CVSS v3.1 base score of 4.6 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2023-40170?
CVE-2023-40170 is classified under CWE-284: Improper Access Control (The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.).
How can I check PyPI dependencies for CVE-2023-40170?
Run the dependency tree command: 'pip show jupyter-server'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-64x5-55rw-9974",
  "modified" : "2023-08-29T23:34:09Z",
  "published" : "2023-08-29T23:34:09Z",
  "aliases" : [ "CVE-2023-40170" ],
  "summary" : "cross-site inclusion (XSSI) of files in jupyter-server",
  "details" : "### Impact\n\nImproper cross-site credential checks on `/files/` URLs could allow exposure of certain file contents, or accessing files when opening untrusted files via  \"Open image in new tab\".\n\n### Patches\n\nJupyter Server 2.7.2\n\n### Workarounds\n\nUse lower performance `--ContentsManager.files_handler_class=jupyter_server.files.handlers.FilesHandler`, which implements the correct checks.\n\n### References\n\nUpstream patch for CVE-2019-9644 was not applied completely, leaving part of the vulnerability open.\n\nVulnerability reported by Tim Coen via the [bug bounty program](https://app.intigriti.com/programs/jupyter/jupyter/detail) [sponsored by the European Commission](https://commission.europa.eu/news/european-commissions-open-source-programme-office-starts-bug-bounties-2022-01-19_en) and hosted on the [Intigriti platform](https://www.intigriti.com/).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "jupyter-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.7.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jupyter-server/jupyter_server/security/advisories/GHSA-64x5-55rw-9974"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-40170"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jupyter-server/jupyter_server/commit/87a4927272819f0b1cae1afa4c8c86ee2da002fd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jupyter-server/jupyter_server"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/jupyter-server/PYSEC-2023-157.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NRP7DNZYVOIA4ZB3U3ZWKTFZEPYWNGCQ"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XDKQAWQN6SQTOVACZNXYKEHWQXGG4DOF"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-284", "CWE-306", "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-29T23:34:09Z",
    "nvd_published_at" : "2023-08-28T21:15:07Z"
  }
}