# CVE-2022-2309: NULL Pointer Dereference in lxml/lxml

> Attackers can cause a denial of service via crafted XML input processed by the iterwalk function in lxml when used with specific libxml2 versions.

- **Severity:** Medium 5.3 (`CVSS:3.0/AV:N/AC:L/PR:N/UI:N/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:** Not needed
- **Fix available:** Yes
- **Published:** 5 Jul 2022
- **Updated:** 4 Nov 2025
- **Also known as:** ALPINE-CVE-2022-2309, ALSA-2022:8226, AZL-10058, AZL-10059, CLSA-2026-1779225366, CLSA-2026-1791271358, DEBIAN-CVE-2022-2309, GHSA-wrxv-2j5q-m38w, MGASA-2022-0331, OESA-2022-1790, OESA-2024-1413, OESA-2024-1414, PYSEC-2022-230, RHSA-2022:8226, RLSA-2022:8226, SUSE-SU-2022:2878-1, SUSE-SU-2022:2908-1, UBUNTU-CVE-2022-2309, openSUSE-SU-2024:12273-1, openSUSE-SU-2024:12290-1

## What is CVE-2022-2309?

CVE-2022-2309 is a medium-severity vulnerability in Fedoraproject Fedora, published on 5 Jul 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

NULL Pointer Dereference allows attackers to cause a denial of service (or application crash). This only applies when lxml is used together with libxml2 2.9.10 through 2.9.14. libxml2 2.9.9 and earlier are not affected. It allows triggering crashes through forged input data, given a vulnerable code sequence in the application. The vulnerability is caused by the iterwalk function (also used by the canonicalize function). Such code shouldn't be in wide-spread use, given that parsing + iterwalk would usually be replaced with the more efficient iterparse function. However, an XML converter that serialises to C14N would also be vulnerable, for example, and there are legitimate use cases for this code sequence. If untrusted input is received (also remotely) and processed via iterwalk function, a crash can be triggered.

Weakness: CWE-476 (NULL Pointer Dereference)

## Which versions are affected by CVE-2022-2309?

3 open source packages ship an affected version, including lxml. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `lxml` | PyPI | All versions | 4.9.1 |
| `lxml` | PyPI | All versions | 4.9.1 |
| `lxml` | PyPI | All versions | 4.9.1 |
| `python3-lxml` | AlmaLinux:9 | All versions | 4.6.5-3.el9 |
| `python-lxml` | Red Hat:enterprise_linux:9::appstream | All versions | 0:4.6.5-3.el9 |
| `python-lxml-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:4.6.5-3.el9 |
| `python3-lxml` | Red Hat:enterprise_linux:9::appstream | All versions | 0:4.6.5-3.el9 |
| `python3-lxml-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:4.6.5-3.el9 |
| `python-lxml` | Rocky Linux:9 | All versions | 0:4.6.5-3.el9 |
| `python-lxml` | SUSE:Enterprise Storage 7 | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Linux Enterprise High Performance Computing 15 SP2-ESPOS | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Linux Enterprise Module for Basesystem 15 SP3 | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Linux Enterprise Module for Basesystem 15 SP4 | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Linux Enterprise Module for Public Cloud 15 | All versions | 4.7.1-150100.6.6.1 |
| `python-lxml` | SUSE:Linux Enterprise Module for Python 2 15 SP3 | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Linux Enterprise Server 15 SP2-BCL | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Linux Enterprise Server 15 SP2-LTSS | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Manager Proxy 4.1 | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Manager Retail Branch Server 4.1 | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | SUSE:Manager Server 4.1 | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | openSUSE:Leap 15.3 | All versions | 4.7.1-150200.3.10.1 |
| `python-lxml` | openSUSE:Leap 15.4 | All versions | 4.7.1-150200.3.10.1 |
| `libxml2` | openSUSE:Tumbleweed | All versions | 2.10.1-1.1 |

Products: Fedoraproject Fedora, Lxml Lxml.

## How do I fix CVE-2022-2309?

Upgrade lxml to 4.9.1 or later.

## Is CVE-2022-2309 being exploited?

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

## Other vulnerabilities in Fedoraproject Fedora

- [CVE-2024-4577](https://insights.sbomify.com/CVE-2024-4577/): PHP-CGI OS Command Injection (critical 9.8, exploited in the wild)
- [CVE-2021-39226](https://insights.sbomify.com/CVE-2021-39226/): Grafana Authentication Bypass (critical 9.8, exploited in the wild)
- [CVE-2019-5544](https://insights.sbomify.com/CVE-2019-5544/): VMware ESXi and Horizon DaaS OpenSLP Heap-Based Buffer Overflow (critical 9.8, exploited in the wild)
- [CVE-2024-4947](https://insights.sbomify.com/CVE-2024-4947/): Google Chromium V8 Type Confusion (critical 9.6, exploited in the wild)
- [CVE-2024-4671](https://insights.sbomify.com/CVE-2024-4671/): Google Chromium Visuals Use-After-Free (critical 9.6, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-2309 and fix it if it is affected.

What it is: CVE-2022-2309 is a medium-severity vulnerability in Fedoraproject Fedora, published on 5 Jul 2022. 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-2022-2309 in the wild and no public exploit code.

Affected packages and fixed versions:
- lxml (PyPI): affected all versions; fixed in 4.9.1
- lxml (PyPI): affected all versions; fixed in 4.9.1
- lxml (PyPI): affected all versions; fixed in 4.9.1

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

## Sources

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

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