CVE-2020-7642 Cross-site scripting in lazysizes
Attackers can inject malicious JavaScript via unsanitized video embed attributes in the lazysizes library, leading to code execution in the victim's browser.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2020-7642?
CVE-2020-7642 is a medium-severity cross-site scripting vulnerability in lazysizes, published on 22 Apr 2020. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Official description
lazysizes through 5.2.0 allows execution of malicious JavaScript. The following attributes are not sanitized by the video-embed plugin: data-vimeo, data-vimeoparams, data-youtube and data-ytparams which can be abused to inject malicious JavaScript.
Weakness: CWE-79
Which versions are affected by CVE-2020-7642?
2 open source packages ship an affected version, including lazysizes. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
lazysizes npm | All versions | 5.2.1 |
lazysizes npm | All versions | 5.2.1 |
Products include Lazysizes Project Lazysizes.
How do I fix CVE-2020-7642?
Upgrade lazysizes to 5.2.1 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2020-7642 being exploited?
There is no known exploitation of CVE-2020-7642 in the wild and no public exploit code.
Sources
Also known as GHSA-hg2p-2cvq-4ppv, SNYK-JS-LAZYSIZES-567144.