Serialize JavaScript: Cross-site scripting (XSS) via unescaped in serialized function bodies
Serialize JavaScript serializes JavaScript values to a superset of JSON that includes regular expressions and functions. From 7.1.1 until 7.1.2, function values serialized by serialize-javascript are not fully protected against script-closing tags in attacker-influenced function source because SCRIPT_CLOSE_REGEXP can consume a second closing tag inside one match. When the serialized function is embedded in a script element, the surviving closing tag terminates the element early and causes the remaining output to be parsed as HTML, enabling cross-site scripting in the page origin. Only function values are affected; ordinary data values and options.isJSON output are unaffected. This issue is fixed in version 7.1.2.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2026-97711
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 8 Nov 2026, 03:32 UTC · Revision 1
Source evidence
Serialize JavaScript: Cross-site scripting (XSS) via unescaped in serialized function bodies
core-osv · Original sourcePublished 29 Sept 2026, 16:00 UTC
Serialize JavaScript serializes JavaScript values to a superset of JSON that includes regular expressions and functions. From 7.1.1 until 7.1.2, function values serialized by serialize-javascript are not fully protected against script-closing tags in attacker-influenced function source because SCRIPT_CLOSE_REGEXP can consume a second closing tag inside one match. When the serialized function is embedded in a script element, the surviving closing tag terminates the element early and causes the remaining output to be parsed as HTML, enabling cross-site scripting in the page origin. Only function values are affected; ordinary data values and options.isJSON output are unaffected. This issue is fixed in version 7.1.2.
osv:CVE-2026-97711
Complete source record
{
"id": "0f807d13b494b4c5eed10d93d03986c894cf08b6a1ae0b960ebdf563c12dad28",
"url": "https://osv.dev/vulnerability/CVE-2026-97711",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Serialize JavaScript: Cross-site scripting (XSS) via unescaped in serialized function bodies",
"summary": "Serialize JavaScript serializes JavaScript values to a superset of JSON that includes regular expressions and functions. From 7.1.1 until 7.1.2, function values serialized by serialize-javascript are not fully protected against script-closing tags in attacker-influenced function source because SCRIPT_CLOSE_REGEXP can consume a second closing tag inside one match. When the serialized function is embedded in a script element, the surviving closing tag terminates the element early and causes the remaining output to be parsed as HTML, enabling cross-site scripting in the page origin. Only function values are affected; ordinary data values and options.isJSON output are unaffected. This issue is fixed in version 7.1.2.",
"evidence": "osv:CVE-2026-97711",
"products": [],
"severity": "low",
"structured": {
"id": "CVE-2026-97711",
"aliases": [
"CVE-2026-97711",
"GHSA-gfhx-hw2g-v5hg"
],
"metrics": [
{
"type": "CVSS_V4",
"score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/yahoo/serialize-javascript",
"type": "GIT",
"events": [
{
"introduced": "8c8caa7066a52106fa719c6abb5dc69858c9f799"
},
{
"fixed": "6a73fa1ddcbe4bbee8bfb12fc1ad8c086cb1334b"
},
{
"fixed": "2bdbaaff9cb8a4639135eb24cfcd383d3fefb534"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "7.1.1"
},
{
"fixed": "7.1.2"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"fixed": "2bdbaaff9cb8a4639135eb24cfcd383d3fefb534"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "6a73fa1ddcbe4bbee8bfb12fc1ad8c086cb1334b"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v7.1.2"
}
]
}
}
],
"versions": [
"v7.1.1"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-97711.json"
}
}
],
"modified": "2026-10-28T02:30:53.237371452Z",
"provider": "osv",
"references": [
"https://github.com/yahoo/serialize-javascript/releases/tag/v7.1.2",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/97xxx/CVE-2026-97711.json",
"https://github.com/yahoo/serialize-javascript/security/advisories/GHSA-gfhx-hw2g-v5hg",
"https://nvd.nist.gov/vuln/detail/CVE-2026-97711",
"https://github.com/yahoo/serialize-javascript/commit/2bdbaaff9cb8a4639135eb24cfcd383d3fefb534"
],
"provider_metadata": {
"cwe_ids": [
"CWE-79"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/97xxx/CVE-2026-97711.json"
}
},
"related_cves": [
{
"value": "CVE-2026-97711",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 522236,
"published_at": "2026-09-29T16:00:33.534+00:00"
}