GHSL-2021-1044: Cross-Site Scripting (XSS) in iziModal - CVE-2021-32860
iziModal builds its header markup by concatenating the modal title and subtitle options directly into an HTML string, so any HTML or JavaScript placed in those options is rendered in the page. An attacker who can influence the title field could therefore run script in a victim's browser.
Originally disclosed on GitHub Security Lab
An attacker who is able to influence the field title when creating a iziModal instance is able to supply arbitrary html or javascript code that will be rendered in the context of a user, potentially leading to XSS.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The library concatenated the title and subtitle options into an HTML string passed to the jQuery element constructor instead of inserting them as text, so markup in those options was parsed and executed.
Impact
This issue may lead to XSS, allowing script to run in the context of a user viewing the modal.
What the attacker needed
Attacker controls the modal title option; victim opens the affected modal
The fix
The issue was fixed by the maintainer, who changed how the header markup is constructed so the title is no longer inserted as raw HTML.
How it was found
- Create an iziModal instance on an element, passing a title that contains an image tag with an error handler.
- Bind a click handler to an element with the trigger class that opens the modal.
- Click the trigger so the modal opens and the header is built, causing the handler to run.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A web page can build new elements from a piece of text. If that text comes from someone else and is treated as HTML rather than plain text, any tags inside it become real elements, and some elements can run code. Here the library pasted the modal's title straight into its header markup, so a title containing an image tag with an error handler would execute script when the image failed to load.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.