Skip to content
XSS Advisory Beginner CVE-2021-32850

GHSL-2021-1045: Cross-Site Scripting (XSS) in jQuery MiniColors Plugin - CVE-2021-32850

The jQuery MiniColors plugin builds a swatch element by concatenating an untrusted colour name into an HTML string, so a crafted name can inject markup. An attacker who can influence a colour name could run script in the context of a user viewing the colour picker.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

An attacker that is able to influence the name of a color can supply arbitrary html or javascript code that will be rendered in the context of a user, potentially leading to XSS.

ghsecuritylab, on GitHub Security Lab

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 plugin concatenates the untrusted colour name into an HTML string passed to jQuery's element constructor instead of setting it as text or escaping it.

Impact

This could lead to XSS, letting an attacker run script in a user's browser when the colour picker renders the crafted swatch name.

What the attacker needed

Attacker can influence a colour name; victim views the colour picker

The fix

The issue was fixed by the maintainer, presumably by escaping or safely setting the colour name rather than concatenating it into HTML.

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 colour picker plugin lets you define named colour swatches. The plugin puts the name straight into a piece of web page code without cleaning it, so if an attacker controls the name they can add their own HTML, including a script that runs in the victim's browser. This is called cross-site scripting (XSS): running an attacker's code as if it were part of the trusted site.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by ghsecuritylab

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.