# CVE-2018-1311: Use after free in Apache Xerces-C

> A use-after-free flaw in Apache Xerces-C allows attackers to cause denial of service or execute code via malicious external DTDs.

- **Severity:** High 8.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 18 Dec 2019
- **Updated:** 4 Nov 2025
- **Also known as:** DEBIAN-CVE-2018-1311, DLA-2498-1, DSA-4814-1, ECHO-8795-b753-f167, GHSA-7rpp-hwhj-9hv8, MGASA-2020-0296, OESA-2024-1160, OESA-2024-1232, OESA-2024-1233, OESA-2024-1234, OESA-2024-1235, OESA-2024-1236, RHSA-2020:0702, RHSA-2020:0704, SUSE-SU-2021:2920-1, SUSE-SU-2021:2944-1, SUSE-SU-2021:2958-1, SUSE-SU-2024:0299-1, SUSE-SU-2024:0300-1, SUSE-SU-2024:0320-1, UBUNTU-CVE-2018-1311, USN-6579-1, USN-6579-2, openSUSE-SU-2021:1231-1, openSUSE-SU-2021:2958-1, openSUSE-SU-2024:13540-1

## What is CVE-2018-1311?

CVE-2018-1311 is a high-severity use after free vulnerability in Debian Debian Linux, published on 18 Dec 2019. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The Apache Xerces-C 3.0.0 to 3.2.3 XML parser contains a use-after-free error triggered during the scanning of external DTDs. This flaw has not been addressed in the maintained version of the library and has no current mitigation other than to disable DTD processing. This can be accomplished via the DOM using a standard parser feature, or via SAX using the XERCES_DISABLE_DTD environment variable.

Weakness: CWE-416 (Use After Free)

## Which versions are affected by CVE-2018-1311?

It affects 10 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `xerces-c` | Red Hat:enterprise_linux:6::client | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-debuginfo` | Red Hat:enterprise_linux:6::client | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-devel` | Red Hat:enterprise_linux:6::client | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-doc` | Red Hat:enterprise_linux:6::client | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c` | Red Hat:enterprise_linux:6::computenode | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-debuginfo` | Red Hat:enterprise_linux:6::computenode | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-devel` | Red Hat:enterprise_linux:6::computenode | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-doc` | Red Hat:enterprise_linux:6::computenode | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c` | Red Hat:enterprise_linux:6::server | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-debuginfo` | Red Hat:enterprise_linux:6::server | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-devel` | Red Hat:enterprise_linux:6::server | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-doc` | Red Hat:enterprise_linux:6::server | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c` | Red Hat:enterprise_linux:6::workstation | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-debuginfo` | Red Hat:enterprise_linux:6::workstation | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-devel` | Red Hat:enterprise_linux:6::workstation | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c-doc` | Red Hat:enterprise_linux:6::workstation | All versions | 0:3.0.1-21.el6_10 |
| `xerces-c` | Red Hat:enterprise_linux:7::client | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-debuginfo` | Red Hat:enterprise_linux:7::client | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-devel` | Red Hat:enterprise_linux:7::client | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-doc` | Red Hat:enterprise_linux:7::client | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c` | Red Hat:enterprise_linux:7::computenode | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-debuginfo` | Red Hat:enterprise_linux:7::computenode | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-devel` | Red Hat:enterprise_linux:7::computenode | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-doc` | Red Hat:enterprise_linux:7::computenode | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c` | Red Hat:enterprise_linux:7::server | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-debuginfo` | Red Hat:enterprise_linux:7::server | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-devel` | Red Hat:enterprise_linux:7::server | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-doc` | Red Hat:enterprise_linux:7::server | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c` | Red Hat:enterprise_linux:7::workstation | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-debuginfo` | Red Hat:enterprise_linux:7::workstation | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-devel` | Red Hat:enterprise_linux:7::workstation | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c-doc` | Red Hat:enterprise_linux:7::workstation | All versions | 0:3.1.1-10.el7_7 |
| `xerces-c` | SUSE:Enterprise Storage 6 | All versions | 3.1.4-3.6.1 |
| `xerces-c` | SUSE:Enterprise Storage 7.1 | All versions | 3.1.4-150200.10.11.1 |
| `xerces-c` | SUSE:Enterprise Storage 7.1 | All versions | 3.2.3-150300.3.6.1 |
| `xerces-c` | SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS | All versions | 3.1.4-3.6.1 |
| `xerces-c` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 3.1.4-3.6.1 |
| `xerces-c` | SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | All versions | 3.1.4-150200.10.11.1 |
| `xerces-c` | SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | All versions | 3.1.4-150200.10.11.1 |
| `xerces-c` | SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | All versions | 3.2.3-150300.3.6.1 |

Products: Apache Xerces-C\+\+, Debian Debian Linux, Fedoraproject Fedora, Oracle Goldengate, Redhat Enterprise Linux Desktop, Redhat Enterprise Linux Eus, Redhat Enterprise Linux Server, Redhat Enterprise Linux Server Aus, Redhat Enterprise Linux Server Tus, Redhat Enterprise Linux Workstation.

## How do I fix CVE-2018-1311?

Apply a workaround.

## Is CVE-2018-1311 being exploited?

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

Public exploit code:

- // SPDX-FileCopyrightText: Portions Copyright 2021 Siemens   // Modified on 15-Jul-2021 by Siemens and/or its affiliates to fix CVE-2018-1311: Apache Xerces-C use-after-free vulnerability scanning external DTD. Copyright 2021 Siemens. (github_poc): https://github.com/johnjamesmccann/xerces-3.2.3-DTD-hotfix

## Other vulnerabilities in Debian Debian Linux

- [CVE-2017-12627](https://insights.sbomify.com/CVE-2017-12627/): Null dereference in Apache Xerces C++ (critical 9.8)
- [CVE-2016-2099](https://insights.sbomify.com/CVE-2016-2099/): Use after free in n/a (critical 9.8)
- [CVE-2023-37536](https://insights.sbomify.com/CVE-2023-37536/): HCL BigFix Platform is vulnerable to an integer overflow in xerces-c++ 3.2.3 (high 8.2)
- [CVE-2024-23807](https://insights.sbomify.com/CVE-2024-23807/): Apache Xerces C++: Use-after-free on external DTD scan (high 8.1)
- [CVE-2008-4482](https://insights.sbomify.com/CVE-2008-4482/): Denial of service in n/a (high 7.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2018-1311 and fix it if it is affected.

What it is: CVE-2018-1311 is a high-severity use after free vulnerability in Debian Debian Linux, published on 18 Dec 2019. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2018-1311 in the wild and no public exploit code.

Affected product: Debian Debian Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

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-2018-1311/ (Markdown: https://insights.sbomify.com/CVE-2018-1311/index.md)
```

## Sources

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

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