Skip to content

regular expression denial-of-service (ReDoS) in BleachSanitizerFilter.sanitize_css gauntlet regular expression

Moderate
g-k published GHSA-vqhp-cxgc-6wmm Mar 26, 2020

Package

bleach (python)

Affected versions

<=3.1.3

Patched versions

3.1.4

Description

Impact

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 are vulnerable to ReDoS. For example, bleach.clean(..., attributes={'a': ['style']}).

Patches

3.1.4

Workarounds

  • do not whitelist the style attribute in bleach.clean calls

  • limit input string length

References

Credits

  • Reported by schwag09 of r2c

For more information

If you have any questions or comments about this advisory:

Severity

Moderate

CVE ID

CVE-2020-6817

Weaknesses

No CWEs