All vulnerabilities

npm

CVE-2026-116582

Seroval: Script injection through RegExp sources in serialized output

Severity
Medium 4.7
Published
28 Oct 2026
Last changed
28 Oct 2026
Added to UpHeron
23 Nov 2026
Fixed in
1.0.0, 1.6.10
Exploit chance
0.2% in the next 30 daysHigher than 8% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Improper output encoding (CWE-116)Cross-site scripting (CWE-79)
Attack
Over the network · Only under certain conditions · No login needed · Needs someone to click or open something
Attacker can
Read some data · Change some data
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
Also known as
GHSA-9wx9-5pv9-3349
Sources
OSV.dev and GitHub

Description

seroval writes a RegExp as a regular expression literal. In affected versions, the < character in a RegExp source is written without escaping. A source built from untrusted input can then end the HTML element that the serialized output is placed in, and run script in the page.

seroval escapes < in strings, so string values cannot end a element. RegExp` sources did not get the same escaping:

  • Versions before 1.0.0 wrote the source as is.
  • Version 1.5.5 stopped escaping < in RegExp sources, so that named groups and lookbehinds keep working. This removed the escaping for every < in a source.

These functions are affected:

  • serialize, serializeAsync
  • crossSerialize, crossSerializeAsync, crossSerializeStream
  • the Serializer class
  • compileJSON

toJSON, fromJSON, toCrossJSON and fromCrossJSON are not affected, because they never produce JavaScript.

An application is affected when all of these are true:

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Workarounds

If you cannot upgrade:

  • Do not serialize a RegExp built from untrusted pattern syntax. Send its source and flags as strings, and build the RegExp on the client.
  • Or reject patterns that contain < before they reach the serializer.
Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
serovalnpm · osv:npm:seroval
  • Every version before 1.0.0
  • From 1.5.5 before 1.6.10

About seroval

Weekly downloads (npm)
42,273,924npm, 23 Nov 2026

References