VYPR
Moderate severityNVD Advisory· Published Oct 31, 2019· Updated Aug 5, 2024

CVE-2018-21030

CVE-2018-21030

Description

Jupyter Notebook before 5.5.0 does not use a CSP header to treat served files as belonging to a separate origin. Thus, for example, an XSS payload can be placed in an SVG document.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Jupyter Notebook before 5.5.0 lacked a Content Security Policy header, enabling XSS via malicious SVG files served from the same origin.

Vulnerability

Overview

Jupyter Notebook versions prior to 5.5.0 do not include a Content Security Policy (CSP) header that would treat served files as belonging to a separate origin [1][2]. This missing security control allows an attacker to craft an SVG document containing malicious JavaScript that, when served by the notebook server, executes in the context of the user's session, enabling cross-site scripting (XSS) attacks [1].

Attack

Vector and Exploitation

An attacker who can upload or place an SVG file onto a Jupyter Notebook server (for example, via a notebook attachment, a file upload feature, or if they have write access to the notebook's working directory) can embed a JavaScript payload within the SVG [2]. When any user views that SVG file through the notebook interface, the browser renders the SVG and executes the embedded script [1]. No additional user interaction beyond viewing the file is required, and the attack does not require authentication if the attacker can already place files on the server [2].

Impact

Successful exploitation allows the attacker to execute arbitrary JavaScript in the context of the victim's Jupyter Notebook session. This can lead to session hijacking, data theft (including notebook content and API tokens), and unauthorized actions performed on behalf of the victim [2]. Because the SVG is served from the same origin as the notebook application, the attacker gains full access to the user's authenticated session without being restricted by same-origin policies that a CSP would normally enforce [1].

Mitigation

The vulnerability was fixed in Jupyter Notebook version 5.5.0, which was released on October 5, 2018 [4]. Users of Jupyter Notebook should upgrade to version 5.5.0 or later. Users still on Notebook v5 (which is now end-of-life) are strongly advised to upgrade to v6 or v7, as no further security patches are provided for v5 [3].

AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
notebookPyPI
< 5.5.0rc15.5.0rc1

Affected products

2

Patches

1
e321c8077654

Merge pull request #3341 from takluyver/csp-sandbox-files

https://github.com/jupyter/notebookThomas KluyverMar 9, 2018via ghsa
2 files changed · +14 0
  • notebook/base/handlers.py+7 0 modified
    @@ -601,6 +601,13 @@ def prepare(self):
     class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler):
         """static files should only be accessible when logged in"""
     
    +    @property
    +    def content_security_policy(self):
    +        # In case we're serving HTML/SVG, confine any Javascript to a unique
    +        # origin so it can't interact with the notebook server.
    +        return super(AuthenticatedFileHandler, self).content_security_policy + \
    +                "; sandbox allow-scripts"
    +
         @web.authenticated
         def get(self, path):
             if os.path.splitext(path)[1] == '.ipynb' or self.get_argument("download", False):
    
  • notebook/files/handlers.py+7 0 modified
    @@ -26,6 +26,13 @@ class FilesHandler(IPythonHandler):
         a subclass of StaticFileHandler.
         """
     
    +    @property
    +    def content_security_policy(self):
    +        # In case we're serving HTML/SVG, confine any Javascript to a unique
    +        # origin so it can't interact with the notebook server.
    +        return super(FilesHandler, self).content_security_policy + \
    +               "; sandbox allow-scripts"
    +
         @web.authenticated
         def head(self, path):
             self.get(path, include_body=False)
    

Vulnerability mechanics

Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

7

News mentions

0

No linked articles in our index yet.