{"id":"CVE-2026-97711","aliases":["CLSA-2026-1790854792","DEBIAN-CVE-2026-97711","EUVD-2026-89027","GHSA-gfhx-hw2g-v5hg","UBUNTU-CVE-2026-97711"],"status":"published","title":"Serialize JavaScript: Cross-site scripting (XSS) via unescaped \u003c/script\u003e in serialized function bodies","description":"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.","severity":{"version":"4.0","score":2.3,"vector":"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","level":"low","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-13","score":0.00318,"percentile":0.25052,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-79","CWE-80"],"published":"2026-09-29T16:00:33Z","modified":"2026-10-28T02:30:53Z","fixes":[{"ecosystem":"npm","package":"serialize-javascript","fixed_in":["7.1.2"],"sources":["ghsa","osv"]},{"ecosystem":"TuxCare:npm","package":"serialize-javascript","fixed_in":["7.1.1-tuxcare.1"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"node-serialize-javascript","fixed_in":["7.1.2+~5.0.4-1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"serialize-javascript","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"7.1.1"},{"fixed":"7.1.2"}]}]},{"source":"osv","ecosystem":"TuxCare:npm","package":"serialize-javascript","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"7.1.1-tuxcare.0"},{"fixed":"7.1.1-tuxcare.1"}]}],"versions":["7.1.1"]},{"source":"osv","ecosystem":"Debian:12","package":"node-serialize-javascript","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.0.0-2","6.0.0-2+deb12u1","6.0.1-1","6.0.2-1","7.0.4+~5.0.4-1","7.0.5+~5.0.4-1","7.0.7+~5.0.4-1","7.1.2+~5.0.4-1"]},{"source":"osv","ecosystem":"Debian:13","package":"node-serialize-javascript","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.0.2-1","7.0.4+~5.0.4-1","7.0.5+~5.0.4-1","7.0.7+~5.0.4-1","7.1.2+~5.0.4-1"]},{"source":"osv","ecosystem":"Debian:14","package":"node-serialize-javascript","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"7.1.2+~5.0.4-1"}]}],"versions":["6.0.2-1","7.0.4+~5.0.4-1","7.0.5+~5.0.4-1","7.0.7+~5.0.4-1"]},{"source":"osv","ecosystem":"npm","package":"serialize-javascript","ranges":[{"type":"SEMVER","events":[{"introduced":"7.1.1"},{"fixed":"7.1.2"}]}]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"node-serialize-javascript","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["5.0.1-2","6.0.0-1"]},{"source":"osv","ecosystem":"Ubuntu:24.04:LTS","package":"node-serialize-javascript","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.0.1-1"]},{"source":"osv","ecosystem":"Ubuntu:26.10","package":"node-serialize-javascript","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["7.0.4+~5.0.4-1","7.0.5+~5.0.4-1","7.0.7+~5.0.4-1"]},{"source":"osv","ecosystem":"Ubuntu:26.04:LTS","package":"node-serialize-javascript","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.0.2-1","7.0.4+~5.0.4-1"]}],"products":[{"vendor":"yahoo","product":"serialize-javascript"}],"references":[{"url":"https://github.com/yahoo/serialize-javascript/security/advisories/GHSA-gfhx-hw2g-v5hg","tags":["x_refsource_CONFIRM","advisory","web","report"]},{"url":"https://github.com/yahoo/serialize-javascript/commit/2bdbaaff9cb8a4639135eb24cfcd383d3fefb534","tags":["x_refsource_MISC","fix","web","report"]},{"url":"https://github.com/yahoo/serialize-javascript/releases/tag/v7.1.2","tags":["x_refsource_MISC","web","report"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-97711","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-gfhx-hw2g-v5hg"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/97xxx/CVE-2026-97711.json","tags":["advisory"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2026-97711","tags":["advisory"]},{"url":"https://github.com/yahoo/serialize-javascript","tags":["package"]},{"url":"https://ubuntu.com/security/CVE-2026-97711","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-97711","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2026-97711","title":"Serialize JavaScript: Cross-site scripting (XSS) via unescaped \u003c/script\u003e in serialized function bodies","description":"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.","status":"published","published":"2026-09-29T16:00:33.534Z","modified":"2026-09-29T16:53:35.013Z","cvss":[{"version":"4.0","score":2.3,"vector":"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","level":"low","assessor":"cna"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T13:44:18.366073Z"}],"euvd":[{"id":"EUVD-2026-89027","description":"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.","status":"published","published":"2026-09-29T16:00:33Z","modified":"2026-09-29T16:53:35Z","cvss":[{"version":"4.0","score":2.3,"vector":"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","level":"low"}],"updated_at":"2026-11-02T17:27:51.995341Z"}],"ghsa":[{"id":"GHSA-gfhx-hw2g-v5hg","title":"Serialize JavaScript: Cross-site scripting (XSS) via unescaped \u003c/script\u003e in serialized function bodies","description":"### Impact\n\n`serialize-javascript` escapes its output so it is safe to embed inside a\n`\u003cscript\u003e` element. In 7.1.1 that guarantee does not hold for **function\nvalues**: a crafted function body can carry a literal, unescaped `\u003c/script\u003e`\ninto the output, terminating the script element early so the remainder is\nparsed as HTML.\n\n`SCRIPT_CLOSE_REGEXP` used `\u003c\\/script[^\u003e]*\u003e` as its first alternative. The\ncharacter class excludes only `\u003e`, so a single match could run from one\n`\u003c/script` all the way to the next `\u003e` anywhere in the source — swallowing a\nsecond, complete `\u003c/script\u003e` along the way. Only one replacement is emitted\nper match, and the plain-code branch neutralizes just the leading `\u003c`\n(`'\u003c ' + match.slice(1)`), so the swallowed tag was re-emitted verbatim.\n\nReaching that shape requires `\u003c/script` in code position, which is legal\nJavaScript: `x\u003c/script=+/` parses as `x \u003c /script=+/`, a comparison against a\nregex literal.\n\n```js\nconst serialize = require('serialize-javascript');\nconst src = \"function f(x){ return x\u003c/script=+/ + '\u003c/script\u003e\u003cimg src=x onerror=alert(1)\u003e' }\";\nconst out = serialize({ h: new Function('return ' + src)() });\n// {\"h\":function f(x){ return x\u003c /script=+/ + '\u003c/script\u003e\u003cimg src=x onerror=alert(1)\u003e' }}\n```\n\nEmbedded as the README documents (`\u003cscript\u003ewindow.S = \u003c%= serialize(state) %\u003e\u003c/script\u003e`)\nand parsed by Chromium, the script element ends at the injected tag and the\n`\u003cimg\u003e` becomes a live DOM node with its `onerror` handler executing in the\npage origin.\n\nOnly the function path is affected. The same payload passed as **data** is\nescaped correctly, and `options.isJSON` / non-function values are unaffected.\n\n### Patches\n\nFixed in **7.1.2**. The wildcard now excludes `\u003c` as well as `\u003e`\n(`[^\u003c\u003e]*`), so a match can never reach past a second `\u003c`. Every `\u003c/script`\nin the source therefore either begins its own match or is followed by a\ncharacter the HTML tokenizer does not accept as ending a tag name — it ends\nthe tag name only on TAB, LF, FF, CR, SPACE, `/` or `\u003e`, and emits anything\nelse as text.\n\n### Workarounds\n\nUpgrade to **7.1.2**. If you cannot upgrade, 7.1.0 and earlier are\nunaffected, or avoid serializing functions whose source text is\nattacker-influenced.\n\n### Regression note\n\nThis is a regression specific to 7.1.1, not a long-standing issue. 7.1.0 and\nearlier applied the same wildcard but escaped the **entire** match, so no tag\nsurvived. Downstream scanners defaulting to a `\u003e= 7.1.0` range would be\noverly broad.","status":"published","published":"2026-09-30T15:40:05Z","modified":"2026-09-30T15:40:06Z","cvss":[{"version":"4.0","score":2.3,"vector":"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","level":"low"}],"cwes":["CWE-79","CWE-80"],"updated_at":"2026-11-02T14:41:23.783773Z"}],"nvd":[{"id":"CVE-2026-97711","description":"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.","status":"published","published":"2026-09-29T16:17:19Z","modified":"2026-09-30T19:38:27.293Z","cvss":[{"version":"4.0","score":2.3,"vector":"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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"low","assessor":"secondary"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:12:52.413234Z"}],"osv":[{"id":"CVE-2026-97711","title":"Serialize JavaScript: Cross-site scripting (XSS) via unescaped \u003c/script\u003e in serialized function bodies","description":"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.","status":"published","published":"2026-09-29T16:00:33.534Z","modified":"2026-10-28T02:30:53.237371452Z","cvss":[{"version":"4.0","score":2.3,"vector":"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","level":"low"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:45:21.262447Z"},{"id":"DEBIAN-CVE-2026-97711","description":"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.","status":"published","published":"2026-09-29T16:17:19Z","modified":"2026-10-01T10:00:10.322958468Z","cvss":[{"version":"4.0","score":2.3,"vector":"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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"low"}],"updated_at":"2026-11-02T15:46:07.756422Z"},{"id":"GHSA-gfhx-hw2g-v5hg","title":"Serialize JavaScript: Cross-site scripting (XSS) via unescaped \u003c/script\u003e in serialized function bodies","description":"### Impact\n\n`serialize-javascript` escapes its output so it is safe to embed inside a\n`\u003cscript\u003e` element. In 7.1.1 that guarantee does not hold for **function\nvalues**: a crafted function body can carry a literal, unescaped `\u003c/script\u003e`\ninto the output, terminating the script element early so the remainder is\nparsed as HTML.\n\n`SCRIPT_CLOSE_REGEXP` used `\u003c\\/script[^\u003e]*\u003e` as its first alternative. The\ncharacter class excludes only `\u003e`, so a single match could run from one\n`\u003c/script` all the way to the next `\u003e` anywhere in the source — swallowing a\nsecond, complete `\u003c/script\u003e` along the way. Only one replacement is emitted\nper match, and the plain-code branch neutralizes just the leading `\u003c`\n(`'\u003c ' + match.slice(1)`), so the swallowed tag was re-emitted verbatim.\n\nReaching that shape requires `\u003c/script` in code position, which is legal\nJavaScript: `x\u003c/script=+/` parses as `x \u003c /script=+/`, a comparison against a\nregex literal.\n\n```js\nconst serialize = require('serialize-javascript');\nconst src = \"function f(x){ return x\u003c/script=+/ + '\u003c/script\u003e\u003cimg src=x onerror=alert(1)\u003e' }\";\nconst out = serialize({ h: new Function('return ' + src)() });\n// {\"h\":function f(x){ return x\u003c /script=+/ + '\u003c/script\u003e\u003cimg src=x onerror=alert(1)\u003e' }}\n```\n\nEmbedded as the README documents (`\u003cscript\u003ewindow.S = \u003c%= serialize(state) %\u003e\u003c/script\u003e`)\nand parsed by Chromium, the script element ends at the injected tag and the\n`\u003cimg\u003e` becomes a live DOM node with its `onerror` handler executing in the\npage origin.\n\nOnly the function path is affected. The same payload passed as **data** is\nescaped correctly, and `options.isJSON` / non-function values are unaffected.\n\n### Patches\n\nFixed in **7.1.2**. The wildcard now excludes `\u003c` as well as `\u003e`\n(`[^\u003c\u003e]*`), so a match can never reach past a second `\u003c`. Every `\u003c/script`\nin the source therefore either begins its own match or is followed by a\ncharacter the HTML tokenizer does not accept as ending a tag name — it ends\nthe tag name only on TAB, LF, FF, CR, SPACE, `/` or `\u003e`, and emits anything\nelse as text.\n\n### Workarounds\n\nUpgrade to **7.1.2**. If you cannot upgrade, 7.1.0 and earlier are\nunaffected, or avoid serializing functions whose source text is\nattacker-influenced.\n\n### Regression note\n\nThis is a regression specific to 7.1.1, not a long-standing issue. 7.1.0 and\nearlier applied the same wildcard but escaped the **entire** match, so no tag\nsurvived. Downstream scanners defaulting to a `\u003e= 7.1.0` range would be\noverly broad.","status":"published","published":"2026-09-30T15:40:05Z","modified":"2026-09-30T16:00:18.9408887Z","cvss":[{"version":"4.0","score":2.3,"vector":"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","level":"low"}],"cwes":["CWE-79","CWE-80"],"updated_at":"2026-11-02T15:46:47.822182Z"},{"id":"UBUNTU-CVE-2026-97711","description":"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.","status":"published","published":"2026-09-29T16:17:00Z","modified":"2026-10-17T13:01:20.148997901Z","cvss":[{"version":"4.0","score":2.3,"vector":"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","level":"low"}],"updated_at":"2026-11-02T16:57:48.647391Z"},{"id":"CLSA-2026-1790854792","title":"TuxCare security update for serialize-javascript (1 CVE)","description":"TuxCare rebuilt serialize-javascript to address 1 CVE. Fixed in 7.1.1-tuxcare.1.","status":"published","published":"2026-10-01T11:39:52Z","modified":"2026-10-15T09:47:57.747895131Z","updated_at":"2026-11-02T15:43:48.65893Z"}]}}
