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

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.3
- **CVSS:** 5.3 (v3.0, CNA) `CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: Low
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** Yes (see exploit references)
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 2.51% (percentile 85, 2026-11-26)
- **CWE:** CWE-476
- **Aliases:** GHSA-wrxv-2j5q-m38w, PYSEC-2022-230
- **Published:** 2022-07-05T09:00:12.000Z
- **Modified:** 2026-06-17T04:41:40.237Z

## Who should check

- Projects that depend on PyPI package lxml (\< 4.9.1)
- Anyone running lxml/lxml \>= unspecified, \< 4.9.1

## 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.

## Affected and fixed versions

- PyPI `lxml`: affected \< 4.9.1; fixed 4.9.1 (osv)
- lxml/lxml: \>= unspecified, \< 4.9.1 (cvelist)

## Mitigation

- Upgrade lxml to 4.9.1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-2309. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-2309.md
Affected: lxml < 4.9.1
Fixed in: 4.9.1

Steps:
1. Search this machine and project for lxml (PyPI), lxml/lxml: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2022-2309 being exploited?

There is no confirmed exploitation: CVE-2022-2309 is not in the CISA Known Exploited Vulnerabilities catalog. Public exploit code or a proof of concept is available. EPSS estimates a 2.51% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2022-2309?

Medium: CVSS 5.3 (v3.0, scored by CNA). Remote, no login needed.

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

lxml \< 4.9.1.

### Is there a fix for CVE-2022-2309?

Yes. Fixed in 4.9.1. Upgrade lxml to 4.9.1 or later.

### How do I check if I'm affected by CVE-2022-2309?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://security.gentoo.org/glsa/202208-06>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/URHHSIBTPTALXMECRLAC2EVDNAFSR5NO/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HGYC6L7ENH5VEGN3YWFBYMGKX6WNS7HZ/>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2022-2309>
- vendor: <https://github.com/advisories/GHSA-wrxv-2j5q-m38w>
- patch: <https://github.com/lxml/lxml/commit/86368e9cf70a0ad23cccd5ee32de847149af0c6f>
- exploit: <https://huntr.dev/bounties/8264e74f-edda-4c40-9956-49de635105ba>
- other: <https://security.netapp.com/advisory/ntap-20220915-0006/>
- other: <https://lists.debian.org/debian-lts-announce/2024/09/msg00021.html>
- other: <https://github.com/lxml/lxml>
- other: <https://github.com/lxml/lxml/blob/master/CHANGES.txt>
- other: <https://github.com/pypa/advisory-database/tree/main/vulns/lxml/PYSEC-2022-230.yaml>
- other: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HGYC6L7ENH5VEGN3YWFBYMGKX6WNS7HZ>
- other: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/URHHSIBTPTALXMECRLAC2EVDNAFSR5NO>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HGYC6L7ENH5VEGN3YWFBYMGKX6WNS7HZ>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/URHHSIBTPTALXMECRLAC2EVDNAFSR5NO>
- other: <https://security.netapp.com/advisory/ntap-20220915-0006>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-2309>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-wrxv-2j5q-m38w> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/PYSEC-2022-230> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2022-2309> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-2309>
