GHSA-9WX9-5PV9-3349

Vulnerability from github – Published: 2026-10-28 21:17 – Updated: 2026-10-28 21:17
VLAI
Summary
Seroval: Script injection through RegExp sources in serialized output
Details

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.
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "seroval"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "1.5.5"
            },
            {
              "fixed": "1.6.10"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "npm",
        "name": "seroval"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.0.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-116582"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-116",
      "CWE-79"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-10-28T21:17:31Z",
    "nvd_published_at": "2026-10-26T21:18:16Z",
    "severity": "MODERATE"
  },
  "details": "### Summary\n\nseroval writes a `RegExp` as a regular expression literal. In affected versions, the `\u003c` character in a `RegExp` source is written without escaping. A source built from untrusted input can then end the HTML `\u003cscript\u003e` element that the serialized output is placed in, and run script in the page.\n\n### Details\n\nseroval escapes `\u003c` in strings, so string values cannot end a `\u003cscript\u003e` element. `RegExp` sources did not get the same escaping:\n\n- Versions before 1.0.0 wrote the source as is.\n- Version 1.5.5 stopped escaping `\u003c` in `RegExp` sources, so that named groups and lookbehinds keep working. This removed the escaping for every `\u003c` in a source.\n\nThese functions are affected:\n\n- `serialize`, `serializeAsync`\n- `crossSerialize`, `crossSerializeAsync`, `crossSerializeStream`\n- the `Serializer` class\n- `compileJSON`\n\n`toJSON`, `fromJSON`, `toCrossJSON` and `fromCrossJSON` are not affected, because they never produce JavaScript.\n\n### Impact\n\nAn application is affected when all of these are true:\n\n1. 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.\n2. It serializes that `RegExp` with one of the functions above.\n3. It places the output inside an HTML `\u003cscript\u003e` element, as server rendering usually does.\n\nIn that case an attacker can run script in the page of any user who receives that output.\n\n### Patches\n\nFixed in 1.6.10. A `RegExp` whose source contains `\u003c` is now written with the `RegExp` constructor and an escaped string source. Named groups and lookbehinds keep working.\n\n### Workarounds\n\nIf you cannot upgrade:\n\n- Do not serialize a `RegExp` built from untrusted pattern syntax. Send its source and flags as strings, and build the `RegExp` on the client.\n- Or reject patterns that contain `\u003c` before they reach the serializer.",
  "id": "GHSA-9wx9-5pv9-3349",
  "modified": "2026-10-28T21:17:31Z",
  "published": "2026-10-28T21:17:31Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/lxsmnsyc/seroval/security/advisories/GHSA-9wx9-5pv9-3349"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-116582"
    },
    {
      "type": "WEB",
      "url": "https://github.com/lxsmnsyc/seroval/commit/f94ee0b63936dae954ff50d5b5e8ea7cb9b284e6"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/lxsmnsyc/seroval"
    },
    {
      "type": "WEB",
      "url": "https://github.com/lxsmnsyc/seroval/releases/tag/seroval@1.6.10"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Seroval: Script injection through RegExp sources in serialized output"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.