CVE-2021-28957: lxml vulnerable to Cross-Site Scripting

CVE-2021-28957 · Severity: low · CVSS 3.1 · Published 2021-03-21

An XSS vulnerability was discovered in python-lxml's clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.

Technologies: lxml (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2021-28957 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2021-28957 being exploited in the wild.
How severe is CVE-2021-28957?
Low severity, with a CVSS score of 3.1, published 21 March 2021.
Which products and versions are affected?
lxml (PyPI) ECOSYSTEM:introduced=0,fixed=4.6.3, GIT:introduced=0,fixed=a5f9cb52079dc57477c460dbe6ba0f775e14a999|ECOSYSTEM:introduced=0,fixed=4.6.3.
Is there a fix for CVE-2021-28957?
Yes. lxml (PyPI): upgrade to 4.6.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
Am I affected by CVE-2021-28957?
Check whether you run lxml (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • lxml (PyPI): upgrade to 4.6.3 or later
    pip install "lxml>=4.6.3"

Affected products

  • lxml (PyPI) ECOSYSTEM:introduced=0,fixed=4.6.3, GIT:introduced=0,fixed=a5f9cb52079dc57477c460dbe6ba0f775e14a999|ECOSYSTEM:introduced=0,fixed=4.6.3

Identifiers

  • CVE-2021-28957
  • GHSA-jq4v-f5q6-mjqq
  • PYSEC-2021-19

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.