# CVE-2023-27586: CairoSVG improperly processes SVG files loaded from external resources


- **Severity:** Critical 9.9 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:L`)
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 20 Mar 2023
- **Updated:** 25 Feb 2025
- **Also known as:** DEBIAN-CVE-2023-27586, DSA-5382-1, GHSA-rwmf-w63j-p7gv, MGASA-2023-0126, PYSEC-2023-9, UBUNTU-CVE-2023-27586

## What is CVE-2023-27586?

CVE-2023-27586 is a critical vulnerability in Kozea CairoSVG, published on 20 Mar 2023. 

### Official description

CairoSVG is an SVG converter based on Cairo, a 2D graphics library. Prior to version 2.7.0, Cairo can send requests to external hosts when processing SVG files. A malicious actor could send a specially crafted SVG file that allows them to perform a server-side request forgery or denial of service. Version 2.7.0 disables CairoSVG's ability to access other files online by default.

Weakness: CWE-918 (Server-Side Request Forgery), CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2023-27586?

3 open source packages ship an affected version, including cairosvg and CairoSVG. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `cairosvg` | PyPI | All versions | 2.7.0 |
| `cairosvg` | PyPI | All versions | 2.7.0 |
| `CairoSVG` | PyPI | All versions | 2.7.0 |

Products: Courtbouillon Cairosvg.

## How do I fix CVE-2023-27586?

Upgrade cairosvg to 2.7.0 or later.

## Is CVE-2023-27586 being exploited?

There is no known exploitation of CVE-2023-27586 in the wild and no public exploit code.

## Other vulnerabilities in Kozea CairoSVG

- [CVE-2026-31899](https://insights.sbomify.com/CVE-2026-31899/): CairoSVG vulnerable to Exponential DoS via recursive <use> element amplification (high 7.5)
- [CVE-2021-21236](https://insights.sbomify.com/CVE-2021-21236/): Regular Expression Denial of Service in CairoSVG (medium 5.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-27586 and fix it if it is affected.

What it is: CVE-2023-27586 is a critical vulnerability in Kozea CairoSVG, published on 20 Mar 2023. 
Exploitation: There is no known exploitation of CVE-2023-27586 in the wild and no public exploit code.

Affected packages and fixed versions:
- cairosvg (PyPI): affected all versions; fixed in 2.7.0
- cairosvg (PyPI): affected all versions; fixed in 2.7.0
- CairoSVG (PyPI): affected all versions; fixed in 2.7.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-27586/ (Markdown: https://insights.sbomify.com/CVE-2023-27586/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-27586
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-27586
- OSV: https://osv.dev/vulnerability/CVE-2023-27586

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-27586/
Summaries are generated and may contain mistakes; the official description above is the record.
