Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsLearn about Cross-site Scripting (XSS) vulnerabilities in an interactive lesson.
Start learningUpgrade bootstrap to version 6.0.0-alpha.2 or higher.
bootstrap is a popular front-end framework for faster and easier web development.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the _execute() method in the Toggler plugin, which reads the attribute name to set from the attacker-controlled data-bs-attribute option and calls setAttribute(attribute, value) with no allowlist and no rejection of event-handler names. Because DOMPurify's default configuration preserves data-* attributes, an attacker can submit HTML containing data-bs-toggle="toggler" data-bs-attribute="onclick" data-bs-value="<payload>" that passes sanitization with no executable attribute. When a victim clicks the rendered element, the Toggler data API writes the attacker's string into an inline onclick handler and the browser executes it on the application's own origin, giving the attacker arbitrary JavaScript execution as the victim.
Note: This is only exploitable when an application renders DOMPurify-sanitized untrusted HTML into the DOM (e.g. via innerHTML) on a page that loads the Bootstrap 6 Toggler plugin and has no Content Security Policy blocking inline event handlers.
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), and act as a remote attacker who submits HTML and gets a victim to click.
PoC files are in this gist.
run.sh, which npm installs 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 loads the npm prerelease bundle; index-main.html loads 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).<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.onclick and window.pwned is false; after one click:{
"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.

The same result on a production bundle built from current main@e93ba5e, confirming the default development branch is affected:

Note: The PoC is run against bootstrap@6.0.0-alpha.1 (npm) and dompurify@3.4.17, served locally with no CSP, using headless Chrome for Testing 156.
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.