# CVE-2021-4249: xml-conduit DOCTYPE Entity Expansion Parse.hs infinite loop

> Remote attackers can cause a denial of service via an infinite loop in the DOCTYPE entity expansion handler of the xml-conduit library.

- **Severity:** Medium 4.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 18 Dec 2022
- **Updated:** 15 Apr 2025
- **Also known as:** DEBIAN-CVE-2021-4249, GHSA-r5mv-3cq3-727q, HSEC-2023-0004, UBUNTU-CVE-2021-4249, openSUSE-SU-2026:11086-1

## What is CVE-2021-4249?

CVE-2021-4249 is a medium-severity denial of service vulnerability in unspecified xml-conduit, published on 18 Dec 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

A vulnerability was found in xml-conduit. It has been classified as problematic. Affected is an unknown function of the file xml-conduit/src/Text/XML/Stream/Parse.hs of the component DOCTYPE Entity Expansion Handler. The manipulation leads to infinite loop. It is possible to launch the attack remotely. Upgrading to version 1.9.1.0 is able to address this issue. The name of the patch is 4be1021791dcdee8b164d239433a2043dc0939ea. It is recommended to upgrade the affected component. The identifier of this vulnerability is VDB-216204.

Weakness: CWE-404 (Improper Resource Shutdown or Release)

## Which versions are affected by CVE-2021-4249?

1 open source package ship an affected version, including xml-conduit. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `xml-conduit` | Hackage | From 0.5.0 | 1.9.1.0 |
| `ghc-xml-conduit` | openSUSE:Tumbleweed | All versions | 1.10.1.0-2.1 |

Products: Haskell Xml-Conduit.

## How do I fix CVE-2021-4249?

Upgrade xml-conduit to 1.9.1.0 or later.

## Is CVE-2021-4249 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-4249 and fix it if it is affected.

What it is: CVE-2021-4249 is a medium-severity denial of service vulnerability in unspecified xml-conduit, published on 18 Dec 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2021-4249 in the wild and no public exploit code.

Affected packages and fixed versions:
- xml-conduit (Hackage): affected from 0.5.0; fixed in 1.9.1.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-2021-4249/ (Markdown: https://insights.sbomify.com/CVE-2021-4249/index.md)
```

## Sources

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

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