CVE-2026-141468: Bootstrap The Toggler Plugin Turns Sanitizer-approved Vulnerability

MODERATE
Advisory Identifier: GHSA-pj28-6c95-2682
CVSS 6.1
CWE-79 CWE-83
Published
Advisory Summary

CVE-2026-141468 is a MODERATE (CVSS 6.1) the toggler plugin turns sanitizer-approved vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Bootstrap libraries in the npm ecosystem. The issue involves the toggler plugin turns sanitizer-approved `data-*` attributes into an executable inline event handler. Remediation is available by upgrading affected packages to version 6.0.0-alpha.2.

CVE-2026-141468 at a Glance

CVE Identifier CVE-2026-141468
GHSA Identifier GHSA-pj28-6c95-2682
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Bootstrap
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-141468

To remediate this vulnerability, upgrade all affected Bootstrap dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

bootstrap fixed: 6.0.0-alpha.2
npm install bootstrap@6.0.0-alpha.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls bootstrap

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-141468, inspect your project dependencies using npm:

npm ls bootstrap

Analyze the terminal output to locate any version of Bootstrap in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.0.0-alpha.2), your application is affected.

Note: The npm ls bootstrap command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Bootstrap, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary [Bootstrap](https://github.com/twbs/bootstrap)'s new Toggler plugin (Bootstrap 6) rejects only the attribute name `id` and then calls `setAttribute(attribute, value)` for any other attribute named by `data-bs-attribute`, with the value taken from `data-bs-value`. An application that renders sanitized untrusted HTML keeps `data-bs-*` attributes, because DOMPurify preserves `data-*` in its default configuration, so a button carrying `data-bs-toggle="toggler" data-bs-attribute="onclick" data-bs-value="<js>"` passes the sanitizer with no executable attribute. When a victim clicks that button, the Toggler data API writes the attacker's string into an inline `onclick` handler, and the browser runs it on the application's own origin. - Affected: `bootstrap` on the Bootstrap 6 line, including the published prerelease `6.0.0-alpha.1` (npm `next` tag, released 2026-10-08) and the default `main` branch at [`e93ba5e`](https://github.com/twbs/bootstrap/blob/e93ba5e5267ac2f74d5d35f1c11bb476957de94b/js/src/toggler.ts#L79-L103). `js/src/toggler.ts` and the shipped `dist/js/bootstrap.bundle.min.js` are byte-for-byte identical between the `v6.0.0-alpha.1` tag and current `main`. - Not the current stable default: `npm install bootstrap` installs `5.3.8` (npm `latest`), which has no Toggler plugin or selector and is unaffected. This was reported before the first stable 6.0 release so the behavior does not ship in it. ## Threat Model Preconditions: - An application renders rich HTML from an untrusted user, sanitizes it with DOMPurify in its default configuration (which keeps `data-*` attributes), and inserts the result into the DOM, for example with `innerHTML`. This is a common user-generated-content pattern, but it is the integration-specific condition that makes the bug reachable, so it was treated it as non-universal. - The page loads the Bootstrap 6 bundle that contains the Toggler plugin (`6.0.0-alpha.1` or a build of the current `main` line). - The response has no Content Security Policy that forbids inline event handlers. Bootstrap does not require or set such a CSP by default. - A victim clicks the attacker-supplied control. The interaction is one ordinary click on a normal-looking button. Attack steps: - The attacker submits HTML through the application's normal content path: `<button data-bs-toggle="toggler" data-bs-attribute="onclick" data-bs-value="<payload>">...</button>`. - DOMPurify's default sanitize keeps the three `data-bs-*` attributes and removes nothing else; the stored/rendered element has no `onclick` and looks inert. - A victim views the content and clicks the button; the Toggler data API reads `data-bs-attribute`/`data-bs-value` as its configuration and calls `setAttribute("onclick", "<payload>")`. - The inline handler now exists and the browser executes the attacker's JavaScript on the application's origin. Practical impact in an app that renders DOMPurify-sanitized user HTML and loads Bootstrap 6: - Arbitrary JavaScript on the application origin as the victim: reading `localStorage`, `sessionStorage` and script-accessible cookies, exfiltrating a session token, making authenticated same-origin requests, and modifying the page. Our PoC demonstrates attacker-chosen JavaScript execution (`window.pwned = true`). ## Root Cause The Toggler data API maps `data-bs-attribute` and `data-bs-value` straight into the plugin configuration and calls `toggle()` on click. `toggle()` calls `_execute()`, which rejects only `id` and then writes any other attribute name with `setAttribute()`, with no allowlist and no rejection of event-handler or URL-bearing names. ```ts // https://github.com/twbs/bootstrap/blob/e93ba5e5267ac2f74d5d35f1c11bb476957de94b/js/src/toggler.ts#L79-L103 protected _execute(): void { const { attribute, value } = this._config if (attribute === 'id') { return // You have to be kidding } // Nothing to toggle without a value (e.g. missing `data-bs-value`) if (value === null || value === undefined) { return } if (attribute === 'class') { this._element.classList.toggle(value as string) return } // Compare as strings since getAttribute() always returns a string if (this._element.getAttribute(attribute) === String(value)) { this._element.removeAttribute(attribute) return } this._element.setAttribute(attribute, value as string) } ``` `DefaultType` checks only that `attribute` is a string and that `value` is a string, number, boolean or null; it places no restriction on which attribute names are allowed. The data API is installed with `eventActionOnPlugin(Toggler, EVENT_CLICK, SELECTOR_DATA_TOGGLE, 'toggle')`, so a single click on a `[data-bs-toggle="toggler"]` element both reads the attacker's `data-bs-*` options and runs `setAttribute`. Because `onclick` is not `id`, `class`, `null` or `undefined`, the attacker-controlled name and value reach `setAttribute("onclick", "<payload>")` directly. The documentation reinforces the behavior: the Toggler page states it "Works with any attribute except `id`" ([`toggler.mdx`](https://github.com/twbs/bootstrap/blob/e93ba5e5267ac2f74d5d35f1c11bb476957de94b/site/src/content/docs/components/toggler.mdx)) and defines `data-bs-attribute` as the "Name of the HTML attribute to toggle", with no warning that the name or value must be developer-controlled. Bootstrap has treated attacker-controlled `data-*` options as a security boundary before: CVE-2019-8331 / GHSA-9v3m-8fp8-mj99 (tooltip/popover `data-template`), CVE-2018-14040 / GHSA-3wqf-4x89-9g79 (collapse `data-parent`), CVE-2018-14041 / GHSA-pj7m-g53m-7638 (scrollspy `data-target`), CVE-2018-14042 / GHSA-7mvr-5x2g-wfc8 (tooltip `data-container`) and CVE-2024-6485 / GHSA-vxmc-5x29-h64v (button `data-loading-text`). This is the same class of data-attribute script gadget in a new Bootstrap 6 plugin. Bootstrap's JavaScript security model excludes "Vulnerabilities caused solely by disabling or modifying content sanitization". That exclusion does not apply here: DOMPurify is enabled and unmodified, and its documented default deliberately preserves `data-*` attributes. Bootstrap then converts an otherwise inert data attribute into an executable event handler. ## Proof of Concept Testers set up a minimal page that follows the documented user-generated-content pattern, where an application sanitizes untrusted HTML with DOMPurify's defaults, inserts it with `innerHTML`, and loads the Bootstrap 6 Toggler plugin ([Toggler docs](https://github.com/twbs/bootstrap/blob/e93ba5e5267ac2f74d5d35f1c11bb476957de94b/site/src/content/docs/components/toggler.mdx)), and act as a remote attacker who submits HTML and gets a victim to click. PoC files are in [this gist](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-report-md). - Deployment: run [`run.sh`](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-run-sh), which `npm install`s `bootstrap@6.0.0-alpha.1` and `dompurify@3.4.17` and serves the pages on `http://127.0.0.1:38765` with no CSP. [`index-alpha.html`](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-index-alpha-html) loads the npm prerelease bundle; [`index-main.html`](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-index-main-html) loads [`bootstrap-main-e93ba5e.bundle.min.js`](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-bootstrap-main-e93ba5e-bundle-min-js), the production bundle built from `main@e93ba5e` (SHA-256 `47ea447f46e288dd9d3e83147b7ba539c6df5192c047b8f91739cd56a5721148`, identical to the bundle at the `v6.0.0-alpha.1` tag). - Attacker: the submitted HTML is the single element `<button data-bs-toggle="toggler" data-bs-attribute="onclick" data-bs-value="window.pwned=true">Toggle me</button>`. The page sanitizes it with `DOMPurify.sanitize(dirty)` and inserts the result; the attacker position is a remote user of the content feature, with no account or privilege. - Exploit: open the page in Chrome and click the rendered "Toggle me" button. Before the click, the button has no `onclick` and `window.pwned` is `false`; after one click: ```text { "domPurifyVersion": "3.4.17", "clean": "<button type=\"button\" data-bs-toggle=\"toggler\" data-bs-attribute=\"onclick\" data-bs-value=\"window.pwned=true\">Toggle me</button>", "beforeHasOnclick": false, "after": { "outerHTML": "<button type=\"button\" data-bs-toggle=\"toggler\" data-bs-attribute=\"onclick\" data-bs-value=\"window.pwned=true\" onclick=\"window.pwned=true\">Toggle me</button>", "hasOnclick": true, "onclickAttribute": "window.pwned=true", "pwned": true } } ``` DOMPurify kept only the inert `data-*` attributes, and Bootstrap added the executable `onclick="window.pwned=true"` on click, which ran. Because `data-bs-value` is attacker-controlled and is copied verbatim into `onclick`, the executed JavaScript is attacker-chosen, not a fixed side effect. PoC run on the published prerelease `bootstrap@6.0.0-alpha.1` (npm), headless Chrome for Testing 156: the sanitized button executed the payload on click and the result panel reads `window.pwned: true`. ![Bootstrap 6.0.0-alpha.1 with DOMPurify 3.4.17 defaults: after one click the button carries onclick="window.pwned=true" and the result panel reads window.pwned: true.](https://gist.githubusercontent.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b/raw/99af4f826b6ac1f7d8bc6152d8794e545dce2109/bootstrap-alpha-toggler-xss.png) The same result on a production bundle built from current `main@e93ba5e`, confirming the default development branch is affected: ![Bootstrap main e93ba5e with DOMPurify 3.4.17 defaults: after one click the button carries onclick="window.pwned=true" and the result panel reads window.pwned: true.](https://gist.githubusercontent.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b/raw/e1ad80ddb83c0c495f8c5fd4da74d17110c8e9e8/bootstrap-main-toggler-xss.png) ## Impact A remote attacker who can place HTML into an application that sanitizes with DOMPurify's defaults and loads the Bootstrap 6 Toggler plugin can run arbitrary JavaScript on that application's origin after one victim click, despite the sanitizer. On such a deployment this gives the attacker the victim's session: reading tokens from storage and script-accessible cookies, making authenticated same-origin requests as the victim, and modifying the page. The attacker needs no account and no privileged access, no disabled or customized sanitizer, no browser extension and no non-default Bootstrap build; only an application in the user-generated-rich-HTML class, a page with no blocking CSP, and one click. A strict CSP that forbids inline event handlers would block the resulting handler, but Bootstrap neither requires nor documents such a CSP as its default. ## Mitigation Advice Give `Toggler._execute()` a conservative rejection for attribute names that are script sinks, instead of rejecting only `id`. Our patch refuses any `on*` event-handler name and an explicit set of URL- or markup-bearing names (`href`, `xlink:href`, `src`, `srcdoc`, `srcset`, `style`, `action`, `formaction`, `background`, `data`; `id` kept), so toggling can no longer turn `data-bs-value` into script execution, while safe attributes such as `class`, `hidden`, `disabled` and `aria-*` keep working. ```ts const DISALLOWED_ATTRIBUTE_PATTERN = /^on/i const DISALLOWED_ATTRIBUTES = new Set([ 'id', 'href', 'xlink:href', 'src', 'srcdoc', 'srcset', 'style', 'action', 'formaction', 'background', 'data' ]) // in _execute(), before setAttribute(): if (DISALLOWED_ATTRIBUTE_PATTERN.test(attribute) || DISALLOWED_ATTRIBUTES.has(attribute.toLowerCase())) { return } ``` The reporter tested this against `main@e93ba5e` (identical to `v6.0.0-alpha.1` for the Toggler source): a bundle built from the patched source leaves the PoC button with no `onclick` and does not execute on click, while `class` and `hidden` still toggle, and the three added unit tests pass under the project's test suite (`vitest run js/tests/unit/toggler.spec.js`: 23 passed). A maintainer may prefer a strict allowlist of safe attribute names over this denylist; either closes the event-handler path. The full patch, against `main@e93ba5e` (`js/src/toggler.ts` and `js/tests/unit/toggler.spec.js`), is [`mitigation.diff`](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-mitigation-diff).

CVE-2026-141468 Affected Bootstrap Versions

1 component(s)
Fixed Versions:
6.0.0-alpha.2
Product / Package Ecosystem Affected Versions Fixed Version
bootstrap
npm
≥ 6.0.0-alpha.1
< 6.0.0-alpha.2
6.0.0-alpha.2

References

Frequently Asked Questions

What is CVE-2026-141468?
CVE-2026-141468 is a security vulnerability in Bootstrap involving The Toggler plugin turns sanitizer-approved `data-*` attributes into an executable inline event handler under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Bootstrap versions are affected?
Affected versions include releases prior to 6.0.0-alpha.2 across affected packages: bootstrap.
What version fixes CVE-2026-141468?
Upgrading to 6.0.0-alpha.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is bootstrap affected?
Yes, bootstrap is affected in releases prior to 6.0.0-alpha.2. Upgrade your dependency to 6.0.0-alpha.2 or later.
What is the CVSS score of CVE-2026-141468?
CVE-2026-141468 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-141468?
CVE-2026-141468 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2026-141468?
Run the dependency tree command: 'npm ls bootstrap'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-pj28-6c95-2682",
  "modified" : "2026-12-02T00:48:17Z",
  "published" : "2026-12-02T00:48:17Z",
  "aliases" : [ "CVE-2026-141468" ],
  "summary" : "Bootstrap: The Toggler plugin turns sanitizer-approved `data-*` attributes into an executable inline event handler",
  "details" : "## Summary\n\n[Bootstrap](https://github.com/twbs/bootstrap)'s new Toggler plugin (Bootstrap 6) rejects only the attribute name `id` and then calls `setAttribute(attribute, value)` for any other attribute named by `data-bs-attribute`, with the value taken from `data-bs-value`.\nAn application that renders sanitized untrusted HTML keeps `data-bs-*` attributes, because DOMPurify preserves `data-*` in its default configuration, so a button carrying `data-bs-toggle=\"toggler\" data-bs-attribute=\"onclick\" data-bs-value=\"<js>\"` passes the sanitizer with no executable attribute.\nWhen a victim clicks that button, the Toggler data API writes the attacker's string into an inline `onclick` handler, and the browser runs it on the application's own origin.\n\n- Affected: `bootstrap` on the Bootstrap 6 line, including the published prerelease `6.0.0-alpha.1` (npm `next` tag, released 2026-10-08) and the default `main` branch at [`e93ba5e`](https://github.com/twbs/bootstrap/blob/e93ba5e5267ac2f74d5d35f1c11bb476957de94b/js/src/toggler.ts#L79-L103). `js/src/toggler.ts` and the shipped `dist/js/bootstrap.bundle.min.js` are byte-for-byte identical between the `v6.0.0-alpha.1` tag and current `main`.\n- Not the current stable default: `npm install bootstrap` installs `5.3.8` (npm `latest`), which has no Toggler plugin or selector and is unaffected. This was reported before the first stable 6.0 release so the behavior does not ship in it.\n\n## Threat Model\n\nPreconditions:\n- An application renders rich HTML from an untrusted user, sanitizes it with DOMPurify in its default configuration (which keeps `data-*` attributes), and inserts the result into the DOM, for example with `innerHTML`. This is a common user-generated-content pattern, but it is the integration-specific condition that makes the bug reachable, so it was treated it as non-universal.\n- The page loads the Bootstrap 6 bundle that contains the Toggler plugin (`6.0.0-alpha.1` or a build of the current `main` line).\n- The response has no Content Security Policy that forbids inline event handlers. Bootstrap does not require or set such a CSP by default.\n- A victim clicks the attacker-supplied control. The interaction is one ordinary click on a normal-looking button.\n\nAttack steps:\n- The attacker submits HTML through the application's normal content path: `<button data-bs-toggle=\"toggler\" data-bs-attribute=\"onclick\" data-bs-value=\"<payload>\">...</button>`.\n- DOMPurify's default sanitize keeps the three `data-bs-*` attributes and removes nothing else; the stored/rendered element has no `onclick` and looks inert.\n- A victim views the content and clicks the button; the Toggler data API reads `data-bs-attribute`/`data-bs-value` as its configuration and calls `setAttribute(\"onclick\", \"<payload>\")`.\n- The inline handler now exists and the browser executes the attacker's JavaScript on the application's origin.\n\nPractical impact in an app that renders DOMPurify-sanitized user HTML and loads Bootstrap 6:\n- Arbitrary JavaScript on the application origin as the victim: reading `localStorage`, `sessionStorage` and script-accessible cookies, exfiltrating a session token, making authenticated same-origin requests, and modifying the page. Our PoC demonstrates attacker-chosen JavaScript execution (`window.pwned = true`).\n\n## Root Cause\n\nThe Toggler data API maps `data-bs-attribute` and `data-bs-value` straight into the plugin configuration and calls `toggle()` on click.\n`toggle()` calls `_execute()`, which rejects only `id` and then writes any other attribute name with `setAttribute()`, with no allowlist and no rejection of event-handler or URL-bearing names.\n\n```ts\n// https://github.com/twbs/bootstrap/blob/e93ba5e5267ac2f74d5d35f1c11bb476957de94b/js/src/toggler.ts#L79-L103\nprotected _execute(): void {\n  const { attribute, value } = this._config\n\n  if (attribute === 'id') {\n    return // You have to be kidding\n  }\n\n  // Nothing to toggle without a value (e.g. missing `data-bs-value`)\n  if (value === null || value === undefined) {\n    return\n  }\n\n  if (attribute === 'class') {\n    this._element.classList.toggle(value as string)\n    return\n  }\n\n  // Compare as strings since getAttribute() always returns a string\n  if (this._element.getAttribute(attribute) === String(value)) {\n    this._element.removeAttribute(attribute)\n    return\n  }\n\n  this._element.setAttribute(attribute, value as string)\n}\n```\n\n`DefaultType` checks only that `attribute` is a string and that `value` is a string, number, boolean or null; it places no restriction on which attribute names are allowed.\nThe data API is installed with `eventActionOnPlugin(Toggler, EVENT_CLICK, SELECTOR_DATA_TOGGLE, 'toggle')`, so a single click on a `[data-bs-toggle=\"toggler\"]` element both reads the attacker's `data-bs-*` options and runs `setAttribute`.\nBecause `onclick` is not `id`, `class`, `null` or `undefined`, the attacker-controlled name and value reach `setAttribute(\"onclick\", \"<payload>\")` directly.\n\nThe documentation reinforces the behavior: the Toggler page states it \"Works with any attribute except `id`\" ([`toggler.mdx`](https://github.com/twbs/bootstrap/blob/e93ba5e5267ac2f74d5d35f1c11bb476957de94b/site/src/content/docs/components/toggler.mdx)) and defines `data-bs-attribute` as the \"Name of the HTML attribute to toggle\", with no warning that the name or value must be developer-controlled.\n\nBootstrap has treated attacker-controlled `data-*` options as a security boundary before: CVE-2019-8331 / GHSA-9v3m-8fp8-mj99 (tooltip/popover `data-template`), CVE-2018-14040 / GHSA-3wqf-4x89-9g79 (collapse `data-parent`), CVE-2018-14041 / GHSA-pj7m-g53m-7638 (scrollspy `data-target`), CVE-2018-14042 / GHSA-7mvr-5x2g-wfc8 (tooltip `data-container`) and CVE-2024-6485 / GHSA-vxmc-5x29-h64v (button `data-loading-text`).\nThis is the same class of data-attribute script gadget in a new Bootstrap 6 plugin.\n\nBootstrap's JavaScript security model excludes \"Vulnerabilities caused solely by disabling or modifying content sanitization\".\nThat exclusion does not apply here: DOMPurify is enabled and unmodified, and its documented default deliberately preserves `data-*` attributes. Bootstrap then converts an otherwise inert data attribute into an executable event handler.\n\n## Proof of Concept\n\nTesters set up a minimal page that follows the documented user-generated-content pattern, where an application sanitizes untrusted HTML with DOMPurify's defaults, inserts it with `innerHTML`, and loads the Bootstrap 6 Toggler plugin ([Toggler docs](https://github.com/twbs/bootstrap/blob/e93ba5e5267ac2f74d5d35f1c11bb476957de94b/site/src/content/docs/components/toggler.mdx)), and act as a remote attacker who submits HTML and gets a victim to click.\nPoC files are in [this gist](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-report-md).\n\n- Deployment: run [`run.sh`](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-run-sh), which `npm install`s `bootstrap@6.0.0-alpha.1` and `dompurify@3.4.17` and serves the pages on `http://127.0.0.1:38765` with no CSP. [`index-alpha.html`](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-index-alpha-html) loads the npm prerelease bundle; [`index-main.html`](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-index-main-html) loads [`bootstrap-main-e93ba5e.bundle.min.js`](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-bootstrap-main-e93ba5e-bundle-min-js), the production bundle built from `main@e93ba5e` (SHA-256 `47ea447f46e288dd9d3e83147b7ba539c6df5192c047b8f91739cd56a5721148`, identical to the bundle at the `v6.0.0-alpha.1` tag).\n- Attacker: the submitted HTML is the single element `<button data-bs-toggle=\"toggler\" data-bs-attribute=\"onclick\" data-bs-value=\"window.pwned=true\">Toggle me</button>`. The page sanitizes it with `DOMPurify.sanitize(dirty)` and inserts the result; the attacker position is a remote user of the content feature, with no account or privilege.\n- Exploit: open the page in Chrome and click the rendered \"Toggle me\" button. Before the click, the button has no `onclick` and `window.pwned` is `false`; after one click:\n\n```text\n{\n  \"domPurifyVersion\": \"3.4.17\",\n  \"clean\": \"<button type=\\\"button\\\" data-bs-toggle=\\\"toggler\\\" data-bs-attribute=\\\"onclick\\\" data-bs-value=\\\"window.pwned=true\\\">Toggle me</button>\",\n  \"beforeHasOnclick\": false,\n  \"after\": {\n    \"outerHTML\": \"<button type=\\\"button\\\" data-bs-toggle=\\\"toggler\\\" data-bs-attribute=\\\"onclick\\\" data-bs-value=\\\"window.pwned=true\\\" onclick=\\\"window.pwned=true\\\">Toggle me</button>\",\n    \"hasOnclick\": true,\n    \"onclickAttribute\": \"window.pwned=true\",\n    \"pwned\": true\n  }\n}\n```\n\nDOMPurify kept only the inert `data-*` attributes, and Bootstrap added the executable `onclick=\"window.pwned=true\"` on click, which ran.\nBecause `data-bs-value` is attacker-controlled and is copied verbatim into `onclick`, the executed JavaScript is attacker-chosen, not a fixed side effect.\n\nPoC run on the published prerelease `bootstrap@6.0.0-alpha.1` (npm), headless Chrome for Testing 156: the sanitized button executed the payload on click and the result panel reads `window.pwned: true`.\n\n![Bootstrap 6.0.0-alpha.1 with DOMPurify 3.4.17 defaults: after one click the button carries onclick=\"window.pwned=true\" and the result panel reads window.pwned: true.](https://gist.githubusercontent.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b/raw/99af4f826b6ac1f7d8bc6152d8794e545dce2109/bootstrap-alpha-toggler-xss.png)\n\nThe same result on a production bundle built from current `main@e93ba5e`, confirming the default development branch is affected:\n\n![Bootstrap main e93ba5e with DOMPurify 3.4.17 defaults: after one click the button carries onclick=\"window.pwned=true\" and the result panel reads window.pwned: true.](https://gist.githubusercontent.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b/raw/e1ad80ddb83c0c495f8c5fd4da74d17110c8e9e8/bootstrap-main-toggler-xss.png)\n\n## Impact\n\nA remote attacker who can place HTML into an application that sanitizes with DOMPurify's defaults and loads the Bootstrap 6 Toggler plugin can run arbitrary JavaScript on that application's origin after one victim click, despite the sanitizer.\nOn such a deployment this gives the attacker the victim's session: reading tokens from storage and script-accessible cookies, making authenticated same-origin requests as the victim, and modifying the page.\nThe attacker needs no account and no privileged access, no disabled or customized sanitizer, no browser extension and no non-default Bootstrap build; only an application in the user-generated-rich-HTML class, a page with no blocking CSP, and one click.\nA strict CSP that forbids inline event handlers would block the resulting handler, but Bootstrap neither requires nor documents such a CSP as its default.\n\n## Mitigation Advice\n\nGive `Toggler._execute()` a conservative rejection for attribute names that are script sinks, instead of rejecting only `id`.\nOur patch refuses any `on*` event-handler name and an explicit set of URL- or markup-bearing names (`href`, `xlink:href`, `src`, `srcdoc`, `srcset`, `style`, `action`, `formaction`, `background`, `data`; `id` kept), so toggling can no longer turn `data-bs-value` into script execution, while safe attributes such as `class`, `hidden`, `disabled` and `aria-*` keep working.\n\n```ts\nconst DISALLOWED_ATTRIBUTE_PATTERN = /^on/i\nconst DISALLOWED_ATTRIBUTES = new Set([\n  'id', 'href', 'xlink:href', 'src', 'srcdoc', 'srcset',\n  'style', 'action', 'formaction', 'background', 'data'\n])\n// in _execute(), before setAttribute():\nif (DISALLOWED_ATTRIBUTE_PATTERN.test(attribute) || DISALLOWED_ATTRIBUTES.has(attribute.toLowerCase())) {\n  return\n}\n```\n\nThe reporter tested this against `main@e93ba5e` (identical to `v6.0.0-alpha.1` for the Toggler source): a bundle built from the patched source leaves the PoC button with no `onclick` and does not execute on click, while `class` and `hidden` still toggle, and the three added unit tests pass under the project's test suite (`vitest run js/tests/unit/toggler.spec.js`: 23 passed).\nA maintainer may prefer a strict allowlist of safe attribute names over this denylist; either closes the event-handler path.\nThe full patch, against `main@e93ba5e` (`js/src/toggler.ts` and `js/tests/unit/toggler.spec.js`), is [`mitigation.diff`](https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b#file-mitigation-diff).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "bootstrap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0-alpha.1"
      }, {
        "fixed" : "6.0.0-alpha.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/twbs/bootstrap/security/advisories/GHSA-pj28-6c95-2682"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-141468"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/twbs/bootstrap/commit/9598cdc049926a161de7401d4ac05e091e6ed80d"
  }, {
    "type" : "WEB",
    "url" : "https://gist.github.com/superboy-zjc/a5fee7d574d970728defaa7aa21aa19b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/twbs/bootstrap"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/twbs/bootstrap/releases/tag/v6.0.0-alpha.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79", "CWE-83" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-02T00:48:17Z",
    "nvd_published_at" : "2026-12-01T21:17:10Z"
  }
}