Every CVE Search/ Get API key

CVE-2021-23980

Cross-site scripting in Bleach

6.1 MediumFix available

A mutation XSS affects users calling bleach.clean with all of: svg or math in the allowed tags p or br in allowed tags style, title, noscript, script, textarea, noframes, iframe, or xmp in allowed tags the keyword argument strip_comments=False Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
Required

What an attacker can affect

Confidentiality
Low
Integrity
Low
Availability
None

Exploit likelihood

0.48%Down 0.4 points since Feb 17, 2023
90%50%10%1%

What each source reports

NVD Score used 6.1

A mutation XSS affects users calling bleach.clean with all of: svg or math in the allowed tags p or br in allowed tags style, title, noscript, script, textarea, noframes, iframe, or xmp in allowed tags the keyword argument strip_comments=False Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.

Record
CVE-2021-23980
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness
CWE-79
Updated
2026-11-02
CVE List 6.1

A mutation XSS affects users calling bleach.clean with all of: svg or math in the allowed tags p or br in allowed tags style, title, noscript, script, textarea, noframes, iframe, or xmp in allowed tags the keyword argument strip_comments=False Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.

Record
CVE-2021-23980
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness
CWE-79
Updated
2026-11-02
EUVDEUVD-2021-0036 6.1

A mutation XSS affects users calling bleach.clean with all of: svg or math in the allowed tags p or br in allowed tags style, title, noscript, script, textarea, noframes, iframe, or xmp in allowed tags the keyword argument strip_comments=False Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.

Record
EUVD-2021-0036
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Updated
2026-11-02
GitHub AdvisoriesGHSA-vv2x-vrpj-qqpq 6.9

Cross-site scripting in Bleach

Impact

A mutation XSS affects users calling bleach.clean with all of:

  • svg or math in the allowed tags
  • p or br in allowed tags
  • style, title, noscript, script, textarea, noframes, iframe, or xmp in allowed tags
  • the keyword argument strip_comments=False

Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.

Patches

Users are encouraged to upgrade to bleach v3.3.0 or greater.

Note: bleach v3.3.0 introduces a breaking change to escape HTML comments by default.

Workarounds

  • modify bleach.clean calls to at least one of:

    • not allow the style, title, noscript, script, textarea, noframes, iframe, or xmp tag
    • not allow svg or math tags
    • not allow p or br tags
    • set strip_comments=True
  • A strong Content-Security-Policy without unsafe-inline and unsafe-eval script-srcs) will also help mitigate the risk.

References

Credits

  • Reported by Yaniv Nizry from the CxSCA AppSec group at Checkmarx
  • Additional eject tags not mentioned in the original advisory and the CSP mitigation line being truncated in the revised advisory reported by Michał Bentkowski at Securitum

For more information

If you have any questions or comments about this advisory:

Record
GHSA-vv2x-vrpj-qqpq
CVSS 4.0
6.9 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness
CWE-79
Updated
2026-11-02
OSVALPINE-CVE-2021-23980 6.1

A mutation XSS affects users calling bleach.clean with all of: svg or math in the allowed tags p or br in allowed tags style, title, noscript, script, textarea, noframes, iframe, or xmp in allowed tags the keyword argument strip_comments=False Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.

Record
ALPINE-CVE-2021-23980
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Updated
2026-11-03
OSV 6.1

A mutation XSS affects users calling bleach.clean with all of: svg or math in the allowed tags p or br in allowed tags style, title, noscript, script, textarea, noframes, iframe, or xmp in allowed tags the keyword argument strip_comments=False Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.

Record
CVE-2021-23980
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Updated
2026-11-02
Show 12 moreShow less
OSVDEBIAN-CVE-2021-23980 6.1

A mutation XSS affects users calling bleach.clean with all of: svg or math in the allowed tags p or br in allowed tags style, title, noscript, script, textarea, noframes, iframe, or xmp in allowed tags the keyword argument strip_comments=False Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.

Record
DEBIAN-CVE-2021-23980
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Updated
2026-11-02
OSVGHSA-vv2x-vrpj-qqpq 6.9

Cross-site scripting in Bleach

Impact

A mutation XSS affects users calling bleach.clean with all of:

  • svg or math in the allowed tags
  • p or br in allowed tags
  • style, title, noscript, script, textarea, noframes, iframe, or xmp in allowed tags
  • the keyword argument strip_comments=False

Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.

Patches

Users are encouraged to upgrade to bleach v3.3.0 or greater.

Note: bleach v3.3.0 introduces a breaking change to escape HTML comments by default.

Workarounds

  • modify bleach.clean calls to at least one of:

    • not allow the style, title, noscript, script, textarea, noframes, iframe, or xmp tag
    • not allow svg or math tags
    • not allow p or br tags
    • set strip_comments=True
  • A strong Content-Security-Policy without unsafe-inline and unsafe-eval script-srcs) will also help mitigate the risk.

References

Credits

  • Reported by Yaniv Nizry from the CxSCA AppSec group at Checkmarx
  • Additional eject tags not mentioned in the original advisory and the CSP mitigation line being truncated in the revised advisory reported by Michał Bentkowski at Securitum

For more information

If you have any questions or comments about this advisory:

Record
GHSA-vv2x-vrpj-qqpq
CVSS 4.0
6.9 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness
CWE-79
Updated
2026-11-02
OSVOESA-2022-1861 6.1

python-bleach security update

Bleach is an HTML sanitizing library that escapes or strips markup and attributes based on a white list.

Security Fix(es):

No description is available for this CVE.(CVE-2021-23980)

Record
OESA-2022-1861
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Updated
2026-11-02
OSVRHSA-2021:0781 7.5

Red Hat Security Advisory: Red Hat Ansible Automation Platform 1.2.2 security and bug fix update

Record
RHSA-2021:0781
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
OSVUBUNTU-CVE-2021-23980 6.1

A mutation XSS affects users calling bleach.clean with all of: svg or math in the allowed tags p or br in allowed tags style, title, noscript, script, textarea, noframes, iframe, or xmp in allowed tags the keyword argument strip_comments=False Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.

Record
UBUNTU-CVE-2021-23980
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Updated
2026-11-02
OSVMGASA-2021-0260 No score

Updated python-bleach packages fix a security vulnerability

It was reported that python-bleach, a whitelist-based HTML-sanitizing library, is prone to a mutation XSS vulnerability in bleach.clean when "svg" or "math" are in the allowed tags, 'p' or "br" are in allowed tags, "style", "title", "noscript", "script", "textarea", "noframes", "iframe", or "xmp" are in allowed tags and 'strip_comments=False' is set (CVE-2021-23980).

Record
MGASA-2021-0260
Updated
2026-11-02
OSVopenSUSE-SU-2021:0552-1 No score

Security update for python-bleach

This update for python-bleach fixes the following issues:

  • CVE-2021-23980: Fixed mutation XSS on bleach.clean with specific combinations of allowed tags (boo#1184547)

Update to 3.1.5:

  • replace missing setuptools dependency with packaging. Thank you Benjamin Peterson.

Update to 3.1.4 (boo#1168280, CVE-2020-6817):

  • bleach.clean behavior parsing style attributes could result in a regular expression denial of service (ReDoS). Calls to bleach.clean with an allowed tag with an allowed style attribute were vulnerable to ReDoS. For example, bleach.clean(..., attributes={'a': ['style']}).
  • Style attributes with dashes, or single or double quoted values are cleaned instead of passed through.

update to 3.1.3 (boo#1167379, CVE-2020-6816):

  • Add relative link to code of conduct. (#442)
  • Drop deprecated 'setup.py test' support. (#507)
  • Fix typo: curren -> current in tests/test_clean.py (#504)
  • Test on PyPy 7
  • Drop test support for end of life Python 3.4
  • bleach.clean behavior parsing embedded MathML and SVG content with RCDATA tags did not match browser behavior and could result in a mutation XSS. Calls to bleach.clean with strip=False and math or svg tags and one or more of the RCDATA tags script, noscript, style, noframes, iframe, noembed, or xmp in the allowed tags whitelist were vulnerable to a mutation XSS.
Record
openSUSE-SU-2021:0552-1
Updated
2026-11-02
OSVopenSUSE-SU-2021:0571-1 No score

Security update for python-bleach

This update for python-bleach fixes the following issues:

  • CVE-2021-23980: Fixed mutation XSS on bleach.clean with specific combinations of allowed tags (boo#1184547)

Update to 3.1.5:

  • replace missing setuptools dependency with packaging. Thank you Benjamin Peterson.

Update to 3.1.4 (boo#1168280, CVE-2020-6817):

  • bleach.clean behavior parsing style attributes could result in a regular expression denial of service (ReDoS). Calls to bleach.clean with an allowed tag with an allowed style attribute were vulnerable to ReDoS. For example, bleach.clean(..., attributes={'a': ['style']}).
  • Style attributes with dashes, or single or double quoted values are cleaned instead of passed through.

update to 3.1.3 (boo#1167379, CVE-2020-6816):

  • Add relative link to code of conduct. (#442)
  • Drop deprecated 'setup.py test' support. (#507)
  • Fix typo: curren -> current in tests/test_clean.py (#504)
  • Test on PyPy 7
  • Drop test support for end of life Python 3.4
  • bleach.clean behavior parsing embedded MathML and SVG content with RCDATA tags did not match browser behavior and could result in a mutation XSS. Calls to bleach.clean with strip=False and math or svg tags and one or more of the RCDATA tags script, noscript, style, noframes, iframe, noembed, or xmp in the allowed tags whitelist were vulnerable to a mutation XSS.

This update was imported from the openSUSE:Leap:15.2:Update update project.

Record
openSUSE-SU-2021:0571-1
Updated
2026-11-02
OSVopenSUSE-SU-2024:11219-1 No score

python36-bleach-3.3.0-1.4 on GA media

These are all security issues fixed in the python36-bleach-3.3.0-1.4 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:11219-1
Updated
2026-11-02
OSVopenSUSE-SU-2024:14134-1 No score

python310-bleach-6.1.0-1.5 on GA media

These are all security issues fixed in the python310-bleach-6.1.0-1.5 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:14134-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:11323-1 No score

python313-bleach-6.4.0-1.1 on GA media

These are all security issues fixed in the python313-bleach-6.4.0-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:11323-1
Updated
2026-11-02
OSVPYSEC-2021-865 No score

In Mozilla Bleach before 3.3.0, a mutation XSS affects users calling bleach.clean with math or svg; p or br; and style, title, noscript, script, textarea, noframes, iframe, or xmp tags with strip_comments=False.

Record
PYSEC-2021-865
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
bleach
PyPI
before 3.3.0
3.3.0
py3-bleach
Alpine:v3.15
before 3.3.0-r0
3.3.0-r0
py3-bleach
Alpine:v3.16
before 3.3.0-r0
3.3.0-r0
py3-bleach
Alpine:v3.17
before 3.3.0-r0
3.3.0-r0
py3-bleach
Alpine:v3.18
before 3.3.0-r0
3.3.0-r0
py3-bleach
Alpine:v3.19
before 3.3.0-r0
3.3.0-r0
py3-bleach
Alpine:v3.20
before 3.3.0-r0
3.3.0-r0
py3-bleach
Alpine:v3.21
before 3.3.0-r0
3.3.0-r0
py3-bleach
Alpine:v3.22
before 3.3.0-r0
3.3.0-r0
py3-bleach
Alpine:v3.23
before 3.3.0-r0
3.3.0-r0
Show 41 moreShow less
Affected packages
PackageAffectedFixed
py3-bleach
Alpine:v3.24
before 3.3.0-r0
3.3.0-r0
python-bleach
Debian:12
before 3.2.1-2.1
3.2.1-2.1
python-bleach
Debian:13
before 3.2.1-2.1
3.2.1-2.1
python-bleach
Debian:14
before 3.2.1-2.1
3.2.1-2.1
python-bleach
Debian:9
before 2.0-1+deb9u1, plus listed versions
2.0-1
2.0-1+deb9u1
python-bleach
Debian:10
before 3.1.2-0+deb10u2, plus listed versions
3.1.0-13.1.0-23.1.1-0+deb10u13.1.1-13.1.2-0+deb10u1
3.1.2-0+deb10u2
bleach
PyPI
before 3.3.0, plus listed versions
0.10.1.10.1.20.20.2.1
Show 45 moreShow less
0.2.20.30.3.10.3.30.3.40.5.00.5.11.0.01.0.11.0.21.0.31.0.41.1.01.1.11.1.21.1.31.1.41.1.51.21.2.11.2.21.41.4.11.4.21.4.31.5.02.0.02.12.1.12.1.22.1.32.1.43.0.03.0.13.0.23.1.03.1.13.1.23.1.33.1.43.1.53.2.03.2.13.2.23.2.3
3.3.0
python-bleach
Mageia:7
before 3.1.4-1.1.mga7
3.1.4-1.1.mga7
python-bleach
Mageia:8
before 3.3.0-1.mga8
3.3.0-1.mga8
python-bleach
openEuler:22.03-LTS
before 5.0.1-1.oe2203
5.0.1-1.oe2203
automation-hub
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 0:4.2.2-1.el7pc
0:4.2.2-1.el7pc
python-bleach
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 0:3.3.0-1.el7pc
0:3.3.0-1.el7pc
python-bleach-allowlist
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 0:1.0.3-1.el7pc
0:1.0.3-1.el7pc
python-galaxy-importer
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 0:0.2.15-1.el7pc
0:0.2.15-1.el7pc
python-galaxy-ng
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 0:4.2.2-1.el7pc
0:4.2.2-1.el7pc
python-pulp-ansible
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 1:0.5.6-1.el7pc
1:0.5.6-1.el7pc
python3-bleach
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 0:3.3.0-1.el7pc
0:3.3.0-1.el7pc
python3-bleach-allowlist
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 0:1.0.3-1.el7pc
0:1.0.3-1.el7pc
python3-django
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 0:2.2.18-1.el7pc
0:2.2.18-1.el7pc
python3-galaxy-importer
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 0:0.2.15-1.el7pc
0:0.2.15-1.el7pc
python3-galaxy-ng
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 0:4.2.2-1.el7pc
0:4.2.2-1.el7pc
python3-pulp-ansible
Red Hat:ansible_automation_platform:4.2::el7
From an advisory covering 6 CVEs
before 1:0.5.6-1.el7pc
1:0.5.6-1.el7pc
automation-hub
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 0:4.2.2-1.el8pc
0:4.2.2-1.el8pc
python-bleach
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 0:3.3.0-1.el8pc
0:3.3.0-1.el8pc
python-bleach-allowlist
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 0:1.0.3-1.el8pc
0:1.0.3-1.el8pc
python-galaxy-importer
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 0:0.2.15-1.el8pc
0:0.2.15-1.el8pc
python-galaxy-ng
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 0:4.2.2-1.el8pc
0:4.2.2-1.el8pc
python-pulp-ansible
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 1:0.5.6-1.el8pc
1:0.5.6-1.el8pc
python3-bleach
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 0:3.3.0-1.el8pc
0:3.3.0-1.el8pc
python3-bleach-allowlist
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 0:1.0.3-1.el8pc
0:1.0.3-1.el8pc
python3-django
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 0:2.2.18-1.el8pc
0:2.2.18-1.el8pc
python3-galaxy-importer
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 0:0.2.15-1.el8pc
0:0.2.15-1.el8pc
python3-galaxy-ng
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 0:4.2.2-1.el8pc
0:4.2.2-1.el8pc
python3-pulp-ansible
Red Hat:ansible_automation_platform:4.2::el8
From an advisory covering 6 CVEs
before 1:0.5.6-1.el8pc
1:0.5.6-1.el8pc
python-bleach
Ubuntu:Pro:16.04:LTS
before 1.4.2-1ubuntu0.1~esm1, plus listed versions
1.4-11.4.2-1
1.4.2-1ubuntu0.1~esm1
python-bleach
Ubuntu:Pro:18.04:LTS
before 2.1.2-1ubuntu0.1~esm1, plus listed versions
2.0-12.1.2-1
2.1.2-1ubuntu0.1~esm1
python-bleach
Ubuntu:Pro:20.04:LTS
before 3.1.1-1ubuntu0.1~esm1, plus listed versions
3.1.0-13.1.0-23.1.1-1
3.1.1-1ubuntu0.1~esm1
python-bleach
openSUSE:Leap 15.2
From an advisory covering 3 CVEs
before 3.1.5-lp152.2.3.1
3.1.5-lp152.2.3.1
python-bleach
SUSE:Package Hub 15 SP2
From an advisory covering 3 CVEs
before 3.1.5-bp152.2.4.1
3.1.5-bp152.2.4.1
python-bleach
openSUSE:Tumbleweed
From an advisory covering 5 CVEs
before 6.1.0-1.5
6.1.0-1.5
python-bleach
openSUSE:Tumbleweed
From an advisory covering 5 CVEs
before 6.4.0-1.1
6.4.0-1.1

History

History
RecordedChangedSources
affected, facts
affected, aliases, referencesOSV
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-23980 is a medium vulnerability (CVSS 6.1) in Mozilla Bleach, published February 2, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.48%, the 41st percentile. Fixed in bleach 3.3.0.

References

Show 53 moreShow less
MoveEnter Open