# CVE-2021-21236: Regular Expression Denial of Service in CairoSVG

- Severity: Medium 5.7 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.36%, higher than 72% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2021-01-06T16:57:50.000Z
- Modified: 2026-09-10T03:49:14.069Z
- Also known as: GHSA-hq37-853p-g5cf, PYSEC-2021-5
- Weaknesses: CWE-400
- Assigned by: GitHub_M

## Description

CairoSVG is a Python (pypi) package. CairoSVG is an SVG converter based on Cairo. In CairoSVG before version 2.5.1, there is a regular expression denial of service (REDoS) vulnerability. When processing SVG files, the python package CairoSVG uses two regular expressions which are vulnerable to Regular Expression Denial of Service (REDoS). If an attacker provides a malicious SVG, it can make cairosvg get stuck processing the file for a very long time. This is fixed in version 2.5.1. See Referenced GitHub advisory for more information.

(As written by CVE List.)

## Affected

- Kozea CairoSVG: < 2.5.1
- cairosvg (PyPI): before 2.5.1; before cfc9175e590531d90384aa88845052de53d94bf3
- courtbouillon cairosvg: before 2.5.1

## Every score

- GitHub_M: CVSS:3.1 5.7 Medium `CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H`
- GitHub: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- GitHub: CVSS:4.0 High `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:P`
- NVD: CVSS:3.1 5.5 Medium `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H`
- NVD: CVSS:2.0 4.3 Medium `AV:N/AC:M/Au:N/C:N/I:N/A:P`

## References

- <https://github.com/Kozea/CairoSVG/security/advisories/GHSA-hq37-853p-g5cf> (exploit, advisory, third-party-advisory, web)
- <https://pypi.org/project/CairoSVG/> (package, product, third-party-advisory)
- <https://github.com/Kozea/CairoSVG/commit/cfc9175e590531d90384aa88845052de53d94bf3> (fix, patch, third-party-advisory, web)
- <https://github.com/Kozea/CairoSVG/releases/tag/2.5.1> (release-notes, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-21236> (advisory)
- <https://github.com/Kozea/CairoSVG> (package)
- <https://github.com/pypa/advisory-database/tree/main/vulns/cairosvg/PYSEC-2021-5.yaml> (web)
- <https://pypi.org/project/CairoSVG> (web)

## Sources

- CVE List: [CVE-2021-21236](https://www.cve.org/CVERecord?id=CVE-2021-21236), CVE Terms of Use, modified 2024-08-03
- GitHub Advisory Database: [GHSA-hq37-853p-g5cf](https://github.com/advisories/GHSA-hq37-853p-g5cf), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2021-21236](https://nvd.nist.gov/vuln/detail/CVE-2021-21236), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2021-5](https://osv.dev/vulnerability/PYSEC-2021-5), CC-BY-4.0, modified 2023-11-08

---

Page: https://cve.day/CVE-2021-21236 · Whole record: https://cve.day/CVE-2021-21236.json · Rebuilt by cve.day 2026-11-25T22:57:59.153Z
