CVE-2021-32862
nbconvert vulnerable to cross-site scripting (XSS) via multiple exploit paths
The GitHub Security Lab discovered sixteen ways to exploit a cross-site scripting vulnerability in nbconvert. When using nbconvert to generate an HTML version of a user-controllable notebook, it is possible to inject arbitrary HTML which may lead to cross-site scripting (XSS) vulnerabilities if these HTML notebooks are served by a web server (eg: nbviewer).
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- Low
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
7.5
nbconvert vulnerable to cross-site scripting (XSS) via multiple exploit paths
The GitHub Security Lab discovered sixteen ways to exploit a cross-site scripting vulnerability in nbconvert. When using nbconvert to generate an HTML version of a user-controllable notebook, it is possible to inject arbitrary HTML which may lead to cross-site scripting (XSS) vulnerabilities if these HTML notebooks are served by a web server (eg: nbviewer).
- Record
CVE-2021-32862- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-79
- Updated
- 2026-11-02
EUVDEUVD-2022-0161
7.5
The GitHub Security Lab discovered sixteen ways to exploit a cross-site scripting vulnerability in nbconvert. When using nbconvert to generate an HTML version of a user-controllable notebook, it is possible to inject arbitrary HTML which may lead to cross-site scripting (XSS) vulnerabilities if these HTML notebooks are served by a web server (eg: nbviewer).
- Record
EUVD-2022-0161- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-9jmq-rx5f-8jwq
5.4
nbconvert vulnerable to cross-site scripting (XSS) via multiple exploit paths
Most of the fixes will be in this repo, though, so having it here gives us the private fork to work on patches
Below is currently a duplicate of the original report:
Received on [email protected] unedited, I'm not sure if we want to make it separate advisories.
Pasted raw for now, feel free to edit or make separate advisories if you have the rights to.
I think the most important is to switch back from nbviewer.jupyter.org -> nbviewer.org at the cloudflare level I guess ? There might be fastly involved as well.
Impact
What kind of vulnerability is it? Who is impacted?
Patches
Has the problem been patched? What versions should users upgrade to?
Workarounds
Is there a way for users to fix or remediate the vulnerability without upgrading?
References
Are there any links users can visit to find out more?
For more information
If you have any questions or comments about this advisory:
- Open an issue in example link to repo
- Email us at example email address
GitHub Security Lab (GHSL) Vulnerability Report
The GitHub Security Lab team has identified potential security vulnerabilities in nbconvert.
We are committed to working with you to help resolve these issues. In this report you will find everything you need to effectively coordinate a resolution of these issues with the GHSL team.
If at any point you have concerns or questions about this process, please do not hesitate to reach out to us at [email protected] (please include GHSL-2021-1013, GHSL-2021-1014, GHSL-2021-1015, GHSL-2021-1016, GHSL-2021-1017, GHSL-2021-1018, GHSL-2021-1019, GHSL-2021-1020, GHSL-2021-1021, GHSL-2021-1022, GHSL-2021-1023, GHSL-2021-1024, GHSL-2021-1025, GHSL-2021-1026, GHSL-2021-1027 or GHSL-2021-1028 as a reference).
If you are NOT the correct point of contact for this report, please let us know!
Summary
When using nbconvert to generate an HTML version of a user-controllable notebook, it is possible to inject arbitrary HTML which may lead to Cross-Site Scripting (XSS) vulnerabilities if these HTML notebooks are served by a web server (eg: nbviewer)
Product
nbconvert
Tested Version
Details
Issue 1: XSS in notebook.metadata.language_info.pygments_lexer (GHSL-2021-1013)
Attacker in control of a notebook can inject arbitrary unescaped HTML in the notebook.metadata.language_info.pygments_lexer field such as the following:
"metadata": {
"language_info": {
"pygments_lexer": "ipython3-foo\"><script>alert(1)</script>"
}
}
This node is read in the from_notebook_node method:
def from_notebook_node(self, nb, resources=None, **kw):
langinfo = nb.metadata.get('language_info', {})
lexer = langinfo.get('pygments_lexer', langinfo.get('name', None))
highlight_code = self.filters.get('highlight_code', Highlight2HTML(pygments_lexer=lexer, parent=self))
self.register_filter('highlight_code', highlight_code)
return super().from_notebook_node(nb, resources, **kw)
It is then assigned to language var and passed down to _pygments_highlight
from pygments.formatters import LatexFormatter
if not language:
language=self.pygments_lexer
latex = _pygments_highlight(source, LatexFormatter(), language, metadata)
In this method, the language variable is concatenated to highlight hl- string to conform the cssclass passed to the…
- Record
GHSA-9jmq-rx5f-8jwq- CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
NVD
7.5
The GitHub Security Lab discovered sixteen ways to exploit a cross-site scripting vulnerability in nbconvert. When using nbconvert to generate an HTML version of a user-controllable notebook, it is possible to inject arbitrary HTML which may lead to cross-site scripting (XSS) vulnerabilities if these HTML notebooks are served by a web server (eg: nbviewer).
- Record
CVE-2021-32862- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H - CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSV
5.4
The GitHub Security Lab discovered sixteen ways to exploit a cross-site scripting vulnerability in nbconvert. When using nbconvert to generate an HTML version of a user-controllable notebook, it is possible to inject arbitrary HTML which may lead to cross-site scripting (XSS) vulnerabilities if these HTML notebooks are served by a web server (eg: nbviewer).
- Record
CVE-2021-32862- CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVDEBIAN-CVE-2021-32862
5.4
The GitHub Security Lab discovered sixteen ways to exploit a cross-site scripting vulnerability in nbconvert. When using nbconvert to generate an HTML version of a user-controllable notebook, it is possible to inject arbitrary HTML which may lead to cross-site scripting (XSS) vulnerabilities if these HTML notebooks are served by a web server (eg: nbviewer).
- Record
DEBIAN-CVE-2021-32862- CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVGHSA-9jmq-rx5f-8jwq
5.4
nbconvert vulnerable to cross-site scripting (XSS) via multiple exploit paths
Most of the fixes will be in this repo, though, so having it here gives us the private fork to work on patches
Below is currently a duplicate of the original report:
Received on [email protected] unedited, I'm not sure if we want to make it separate advisories.
Pasted raw for now, feel free to edit or make separate advisories if you have the rights to.
I think the most important is to switch back from nbviewer.jupyter.org -> nbviewer.org at the cloudflare level I guess ? There might be fastly involved as well.
Impact
What kind of vulnerability is it? Who is impacted?
Patches
Has the problem been patched? What versions should users upgrade to?
Workarounds
Is there a way for users to fix or remediate the vulnerability without upgrading?
References
Are there any links users can visit to find out more?
For more information
If you have any questions or comments about this advisory:
- Open an issue in example link to repo
- Email us at example email address
GitHub Security Lab (GHSL) Vulnerability Report
The GitHub Security Lab team has identified potential security vulnerabilities in nbconvert.
We are committed to working with you to help resolve these issues. In this report you will find everything you need to effectively coordinate a resolution of these issues with the GHSL team.
If at any point you have concerns or questions about this process, please do not hesitate to reach out to us at [email protected] (please include GHSL-2021-1013, GHSL-2021-1014, GHSL-2021-1015, GHSL-2021-1016, GHSL-2021-1017, GHSL-2021-1018, GHSL-2021-1019, GHSL-2021-1020, GHSL-2021-1021, GHSL-2021-1022, GHSL-2021-1023, GHSL-2021-1024, GHSL-2021-1025, GHSL-2021-1026, GHSL-2021-1027 or GHSL-2021-1028 as a reference).
If you are NOT the correct point of contact for this report, please let us know!
Summary
When using nbconvert to generate an HTML version of a user-controllable notebook, it is possible to inject arbitrary HTML which may lead to Cross-Site Scripting (XSS) vulnerabilities if these HTML notebooks are served by a web server (eg: nbviewer)
Product
nbconvert
Tested Version
Details
Issue 1: XSS in notebook.metadata.language_info.pygments_lexer (GHSL-2021-1013)
Attacker in control of a notebook can inject arbitrary unescaped HTML in the notebook.metadata.language_info.pygments_lexer field such as the following:
"metadata": {
"language_info": {
"pygments_lexer": "ipython3-foo\"><script>alert(1)</script>"
}
}
This node is read in the from_notebook_node method:
def from_notebook_node(self, nb, resources=None, **kw):
langinfo = nb.metadata.get('language_info', {})
lexer = langinfo.get('pygments_lexer', langinfo.get('name', None))
highlight_code = self.filters.get('highlight_code', Highlight2HTML(pygments_lexer=lexer, parent=self))
self.register_filter('highlight_code', highlight_code)
return super().from_notebook_node(nb, resources, **kw)
It is then assigned to language var and passed down to _pygments_highlight
from pygments.formatters import LatexFormatter
if not language:
language=self.pygments_lexer
latex = _pygments_highlight(source, LatexFormatter(), language, metadata)
In this method, the language variable is concatenated to highlight hl- string to conform the cssclass passed to the…
- Record
GHSA-9jmq-rx5f-8jwq- CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2021-32862
7.5
The GitHub Security Lab discovered sixteen ways to exploit a cross-site scripting vulnerability in nbconvert. When using nbconvert to generate an HTML version of a user-controllable notebook, it is possible to inject arbitrary HTML which may lead to cross-site scripting (XSS) vulnerabilities if these HTML notebooks are served by a web server (eg: nbviewer).
- Record
UBUNTU-CVE-2021-32862- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H - CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVPYSEC-2022-249 No score
The GitHub Security Lab discovered sixteen ways to exploit a cross-site scripting vulnerability in nbconvert. When using nbconvert to generate an HTML version of a user-controllable notebook, it is possible to inject arbitrary HTML which may lead to cross-site scripting (XSS) vulnerabilities if these HTML notebooks are served by a web server (eg: nbviewer).
- Record
PYSEC-2022-249- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
nbconvertPyPI |
before 6.5.1 | 6.5.1 |
nbconvertDebian:12 |
before 6.5.1-1 | 6.5.1-1 |
nbconvertDebian:13 |
before 6.5.1-1 | 6.5.1-1 |
nbconvertDebian:14 |
before 6.5.1-1 | 6.5.1-1 |
nbconvertDebian:10 |
before 5.4-2+deb10u1, plus listed versions 5.4-2 |
5.4-2+deb10u1 |
nbconvertDebian:11 |
before 5.6.1-3+deb11u1, plus listed versions 5.6.1-3 |
5.6.1-3+deb11u1 |
nbconvertPyPI |
before 6.5.1, plus listed versions 0.0.04.0.04.1.04.2.04.3.0 Show 45 moreShow less5.0.05.0.0b15.1.05.1.15.2.15.3.05.3.15.4.05.4.15.4.1.dev05.5.05.6.05.6.16.0.06.0.0a06.0.0a16.0.0a26.0.0a36.0.0a46.0.0a56.0.0a66.0.0b76.0.0rc06.0.16.0.26.0.36.0.46.0.56.0.66.0.76.1.06.1.0rc06.1.1b06.2.06.2.0rc06.2.0rc16.2.0rc26.3.06.3.0b06.4.06.4.16.4.26.4.36.4.46.4.5 |
6.5.1 |
nbconvertPyPI |
before 6.3.0a0, plus listed versions 0.0.04.0.04.1.04.2.04.3.0 Show 37 moreShow less5.0.05.0.0b15.1.05.1.15.2.15.3.05.3.15.4.05.4.15.4.1.dev05.5.05.6.05.6.16.0.06.0.0a06.0.0a16.0.0a26.0.0a36.0.0a46.0.0a56.0.0a66.0.0b76.0.0rc06.0.16.0.26.0.36.0.46.0.56.0.66.0.76.1.06.1.0rc06.1.1b06.2.06.2.0rc06.2.0rc16.2.0rc2 |
6.3.0a0 |
nbconvertUbuntu:18.04:LTS |
All versions, plus listed versions 4.2.0-45.3.1-1 |
None known |
nbconvertUbuntu:20.04:LTS |
All versions, plus listed versions 5.4-2ubuntu25.6.0-15.6.0-25.6.1-1 |
None known |
nbconvertUbuntu:22.04:LTS |
All versions, plus listed versions 5.6.1-36.1.0-16.3.0-16.4.0-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-32862 is a high vulnerability (CVSS 7.5) in Jupyter Nbconvert, published August 10, 2022. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.52%, the 74th percentile. Fixed in nbconvert 6.5.1.
References
github.com/jupyter/nbconvert/security/advisories/GHSA-9jmq-rx5f-8jwq
github.com/jupyter/nbviewer/security/advisories/GHSA-h274-fcvj-h2wm
lists.debian.org/debian-lts-announce/2023/06/msg00003.html
lists.debian.org/debian-lts-announce/2024/09/msg00004.html
nvd.nist.gov/vuln/detail/CVE-2021-32862
github.com/pypa/advisory-database/tree/main/vulns/nbconvert/PYSEC-2022-249.yaml
Left out here: 1 version and the rest of 2 source descriptions. The JSON record has them.