Bootstrap: The Toggler plugin turns sanitizer-approved `data-*` attributes into an executable inline event handler
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| twbsbootstrap | — | Not listed |
| npmbootstrap |
≥ 6.0.0-alpha.1, < 6.0.0-alpha.2→ 6.0.0-alpha.2 |
6.0.0-alpha.2 |
Original description The description as published by the source.
Summary
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="" 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:
bootstrapon the Bootstrap 6 line, including the published prerelease6.0.0-alpha.1(npmnexttag, released 2026-10-08) and the defaultmainbranch ate93ba5e.js/src/toggler.tsand the shippeddist/js/bootstrap.bundle.min.jsare byte-for-byte identical between thev6.0.0-alpha.1tag and currentmain. - Not the current stable default:
npm install bootstrapinstalls5.3.8(npmlatest), 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 fr…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- web github.com
- web github.com
- web gist.github.com
- web github.com
- web github.com