GHSA-9wx9-5pv9-3349: XSS

Published Oct 28, 2026
·
Updated

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:

- 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.

Impact

An application is affected when all of these are true:

1. It builds a 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. 2. It serializes that RegExp with one of the functions above. 3. It places the output inside an HTML <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:

- 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.

Affected Software

2 affected componentsFixes available
npm/seroval<1.0.0
1.0.0
npm/seroval>=1.5.5<1.6.10
1.6.10

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/seroval to a version that resolves this vulnerability.

    Fixed in 1.0.0
  2. Upgrade

    Upgrade npm/seroval to a version that resolves this vulnerability.

    Fixed in 1.6.10
  3. Upgrade

    Upgrade seroval to a version that resolves this vulnerability.

    Fixed in 1.6.10
  4. Compensating control

    Do not serialize a RegExp built from untrusted pattern syntax, or reject patterns containing < before they reach the serializer.

  5. Compensating control

    Send RegExp source and flags as strings, then build the RegExp on the client instead of serializing the RegExp server-side.

Event History

Oct 28, 2026
Advisory Published
via GitHub·09:17 PM
Data Sourced
via GitHub·09:17 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which uses of seroval are exposed?

The affected JavaScript-producing APIs are serialize, serializeAsync, crossSerialize, crossSerializeAsync, crossSerializeStream, the Serializer class, and compileJSON. The JSON conversion APIs toJSON, fromJSON, toCrossJSON, and fromCrossJSON are not affected because they do not produce JavaScript.

2

What application behavior is required for exploitation?

The application must build a RegExp from untrusted input and use that input as regular-expression syntax, then place the serialized output in an HTML script element. Escaping the input with an escapeRegExp-style helper is not sufficient to prevent exploitation.

3

Does exploitation require an authenticated attacker?

No privileges are required according to the supplied vector. Exploitation does require user interaction.

4

How can I identify potentially affected code paths?

Review calls to the affected serialization APIs for RegExp values whose source is influenced by untrusted input, particularly where the resulting JavaScript is embedded in a script element. Paths that only use the listed JSON conversion APIs are not affected by this issue.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203