seroval
Affected
- introduced
1.5.5, fixed1.6.10(semver)
Fixed versions
1.6.10
Fix
- Fixed version
1.6.10npm install [email protected]
Advisory
Also known as: CVE-2026-116582
Seroval: Script injection through RegExp sources in serialized output
Summary
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 <script> element that the serialized output is placed in, and run script in the page.
Details
seroval escapes < in strings, so string values cannot end a <script> element. RegExp sources did not get the same 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, serializeAsynccrossSerialize, crossSerializeAsync, crossSerializeStreamSerializer classcompileJSONtoJSON, fromJSON, toCrossJSON and fromCrossJSON are not affected, because they never produce JavaScript.
Impact
An application is affected when all of these are true:
RegExp from untrusted input that is used as regular expression syntax. Input passed through an escaping helper (such as an escapeRegExp function) is not enough to exploit this.RegExp with one of the functions above.<script> element, as server rendering usually does.In that case an attacker can run script in the page of any user who receives that output.
Patches
Fixed in 1.6.10. A RegExp whose source contains < is now written with the RegExp constructor and an escaped string source. Named groups and lookbehinds keep working.
Workarounds
If you cannot upgrade:
RegExp built from untrusted pattern syntax. Send its source and flags as strings, and build the RegExp on the client.< before they reach the serializer.Medium Basis: The source's own band: MODERATE
1.5.5, fixed 1.6.10 (semver)1.6.10
1.6.10npm install [email protected]0, fixed 1.0.0 (semver)1.0.0
1.0.0npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0