kibana - CVE-2026-42338
Back to Overview
Detailed information about this CVE

Severity

MEDIUM

Description

### Summary `Address6.group()` and `Address6.link()` do not HTML-escape attacker-controlled content before embedding it in the HTML strings they return, and `AddressError.parseMessage` (emitted by the `Address6` constructor for invalid input) can contain unescaped attacker-controlled content in one branch. An application that (1) passes untrusted input to `Address6` and (2) renders the output of these methods, or the thrown error's `parseMessage`, as HTML (e.g. via `innerHTML`) is vulnerable to cross-site scripting. A related issue in `v6.helpers.spanAll()` produced malformed markup but was not exploitable; it is hardened in the same release for consistency. ### Details Four related issues were identified and fixed together: 1. **`Address6.group()`: zone ID injection.** The `Address6` constructor stores the raw input (including any IPv6 zone ID) in `this.address` before zone stripping. `group()` then passed `this.address` to `helpers.simpleGroup()`, which wrapped each `:`-separated segment in a `<span>` element without HTML-escaping the content. A zone ID containing HTML markup was embedded verbatim. 2. **`Address6.link({ prefix, className })`: attribute-value injection.** `link()` concatenated user-supplied `prefix` and `className` into the `href="…"` and `class="…"` attributes without escaping. A caller passing untrusted content through these options could inject event handlers (e.g. `onmouseover`) and achieve XSS. 3. **`Address6` constructor: leading-zero IPv4 error path.** The leading-zero branch in `parse4in6()` built `AddressError.parseMessage` by concatenating the raw address through `String.replace()`. Because `parse4in6()` runs before the bad-character check, any characters in the groups preceding the IPv4 suffix flowed into the error's HTML unescaped. Consumers who render `parseMessage` as HTML (its documented purpose — it already contains `<span class="parse-error">` markup) could be XSS'd by a crafted input such as `<img src=x onerror=alert(1)>:10.0.01.1`. 4. **`v6.helpers.spanAll()`: attribute-value injection (defense in depth).** `spanAll()` embedded each character of its input into a `class="digit value-${n} …"` attribute without escaping. Because `split('')` limits `n` to a single character this was not exploitable in practice, but it produced malformed markup and is fixed for consistency. ### Affected Versions All versions up to and including `10.1.0`. ### Patched Version `10.1.1`. ### Impact Real-world exposure is believed to be extremely limited. Analysis of all 425 dependent npm packages as well as GitHub code search found zero consumers of `group()`, `link()`, or `spanAll()`: these HTML-emitting surfaces appear to be unused across published npm packages and public repositories. Applications using only the address-parsing and comparison APIs (`isValid`, `correctForm`, `isInSubnet`, `bigInt`, etc.) are not affected. Consumers who **do** render the output of `group()`, `link()`, `spanAll()`, or `AddressError.parseMessage` as HTML against untrusted input should upgrade. ### PoC ```javascript const { Address6 } = require('ip-address'); const addr = new Address6('fe80::1%<img src=x onerror=alert(1)>'); document.body.innerHTML = addr.group(); // fires the onerror handler in 10.1.0 ``` ### Workarounds If users cannot upgrade immediately: - Do not pass untrusted input to the `Address6` constructor, or - Never render the output of `group()`, `link()`, or `spanAll()`, nor the `parseMessage` field of any thrown `AddressError`, as HTML; treat these values as text only, or run them through [DOMPurify](https://github.com/cure53/DOMPurify) before inserting into the DOM (DOMPurify's default configuration preserves the library's intended `<span>` wrapping while stripping any injected event handlers), or - Validate input with `Address6.isValid()` and reject anything that contains a zone identifier (a `%` character) or characters outside `[0-9a-fA-F:/]` before passing it to the constructor. ### Lack of separate CVEs Given the evidence that these methods are not used, and given that they are all of the same construction, maintainers do not think it's relevant or useful to create a separate CVE for each library method. ### Credit ip-address thanks @scovetta for reporting this issue.

CVSS Scores

Affected Versions

  • 9.4.0
  • 9.3.4
  • 9.3.3
  • 9.3.2
  • 9.3.1
  • 9.3.0
  • 9.2.8
  • 9.2.7
  • 9.2.6
  • 9.2.5
  • 9.2.4
  • 9.2.3
  • 9.2.2
  • 9.2.1
  • 9.2.0
  • 9.1.10
  • 9.1.9
  • 9.1.8
  • 9.1.7
  • 9.1.6
  • 9.1.5
  • 9.1.4
  • 9.1.3
  • 9.1.2
  • 9.1.1
  • 9.1.0
  • 9.0.8
  • 9.0.7
  • 9.0.6
  • 9.0.5
  • 9.0.4
  • 9.0.3
  • 9.0.2
  • 9.0.1
  • 9.0.0
  • 8.19.15
  • 8.19.14
  • 8.19.13
  • 8.19.12
  • 8.19.11
  • 8.19.10
  • 8.19.9
  • 8.19.8
  • 8.19.7
  • 8.19.6
  • 8.19.5
  • 8.19.4
  • 8.19.3
  • 8.19.2
  • 8.19.1
  • 8.19.0
  • 8.18.8
  • 8.18.7
  • 8.18.6
  • 8.18.5
  • 8.18.4
  • 8.18.3
  • 8.18.2
  • 8.18.1
  • 8.18.0
  • 8.17.10
  • 8.17.9
  • 8.17.8
  • 8.17.7
  • 8.17.6
  • 8.17.5
  • 8.17.4
  • 8.17.3
  • 8.17.2
  • 8.17.1
  • 8.17.0
  • 8.16.6
  • 8.16.5
  • 8.16.4
  • 8.16.3
  • 8.16.2
  • 8.16.1
  • 8.16.0
  • 8.15.5
  • 8.15.4
  • 8.15.3
  • 8.15.2
  • 8.15.1
  • 8.15.0
  • 8.14.3
  • 8.14.2
  • 8.14.1
  • 8.14.0
  • 8.13.4
  • 8.13.3
  • 8.13.2
  • 8.13.1
  • 8.13.0
  • 8.12.2

Not Affected Versions

  • 8.12.1
  • 8.12.0
  • 8.11.4
  • 8.11.3
  • 8.11.2
  • 8.11.1
  • 8.11.0
  • 8.10.4
  • 8.10.3
  • 8.10.2
  • 8.10.1
  • 8.9.2
  • 8.9.1
  • 8.9.0
  • 8.8.2
  • 8.8.1
  • 8.8.0
  • 8.7.1
  • 8.7.0
  • 8.6.2
  • 8.6.1
  • 8.6.0
  • 8.5.3
  • 8.5.2
  • 8.5.1
  • 8.5.0
  • 8.4.3
  • 8.4.2
  • 8.4.1
  • 8.4.0
  • 8.3.3
  • 8.3.2
  • 8.3.1
  • 8.3.0
  • 8.2.3
  • 8.2.2
  • 8.2.1
  • 8.2.0
  • 8.1.3
  • 8.1.2
  • 8.1.1
  • 8.1.0
  • 8.0.1
  • 8.0.0