Bug 2529697 (CVE-2026-74860) - CVE-2026-74860 libxml2: double-free/UAF in libxml2 Python bindings
Summary: CVE-2026-74860 libxml2: double-free/UAF in libxml2 Python bindings
Keywords:
Status: NEW
Alias: CVE-2026-74860
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 2529699 2529700 2529703 2529704 2529705 2529706 2529701
Blocks:
TreeView+ depends on / blocked
 
Reported: 2026-09-08 07:30 UTC by OSIDB Bzimport
Modified: 2026-11-02 03:32 UTC (History)
27 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2026:72291 0 None None None 2026-09-28 01:56:01 UTC
Red Hat Product Errata RHBA-2026:72477 0 None None None 2026-09-28 11:48:15 UTC
Red Hat Product Errata RHBA-2026:73415 0 None None None 2026-09-29 12:38:31 UTC
Red Hat Product Errata RHBA-2026:73745 0 None None None 2026-09-30 04:15:15 UTC
Red Hat Product Errata RHBA-2026:73918 0 None None None 2026-09-30 11:25:27 UTC
Red Hat Product Errata RHBA-2026:74142 0 None None None 2026-09-30 21:41:12 UTC
Red Hat Product Errata RHBA-2026:74468 0 None None None 2026-10-01 16:27:42 UTC
Red Hat Product Errata RHSA-2026:71585 0 None None None 2026-09-24 19:00:43 UTC
Red Hat Product Errata RHSA-2026:71586 0 None None None 2026-09-24 12:55:06 UTC
Red Hat Product Errata RHSA-2026:71641 0 None None None 2026-09-24 16:03:11 UTC
Red Hat Product Errata RHSA-2026:89750 0 None None None 2026-10-26 03:05:01 UTC
Red Hat Product Errata RHSA-2026:89759 0 None None None 2026-10-26 03:20:04 UTC
Red Hat Product Errata RHSA-2026:90309 0 None None None 2026-10-26 15:42:28 UTC
Red Hat Product Errata RHSA-2026:92352 0 None None None 2026-10-29 13:33:14 UTC
Red Hat Product Errata RHSA-2026:92589 0 None None None 2026-10-29 19:49:49 UTC
Red Hat Product Errata RHSA-2026:93463 0 None None None 2026-11-02 03:32:50 UTC
Red Hat Product Errata RHSA-2026:93473 0 None None None 2026-11-02 03:23:13 UTC

Description OSIDB Bzimport 2026-09-08 07:30:23 UTC
SUMMARY
A double-free / use-after-free exists in the SAX attributeDecl callback handler (pythonAttributeDecl in python/libxml.c). When parsing XML containing a DTD <!ATTLIST> declaration with enumerated attribute values, each value string is freed twice: PyList_SetItem() steals the reference, and an explicit Py_DECREF() then drops the refcount to zero and frees the object, leaving a dangling pointer in the list.

AFFECTED COMPONENT

libxml2 with Python bindings enabled (python3-libxml2 / libxml2-python)

The defect is long-standing; the affected code in pythonAttributeDecl has been unchanged for many years.

Reproduced on upstream commit 4b35628e97472eaf23d8a841d2f711f7c2f96255 (2026-02-24).

IMPACT

Denial of service: 100% reproducible crash (SIGSEGV) in any Python application that uses the libxml2 SAX bindings (libxml2.createPushParser), registers an attributeDecl handler, and parses untrusted XML with a DTD <!ATTLIST> containing enumerated values. Verified 10/10 in isolated processes.

The use-after-free is also potentially exploitable for code execution: I was able to demonstrate hijacking the freed object's tp_dealloc function pointer in-process. Full remote code execution would require additional heap grooming and is not demonstrated. I'd defer to your team on final severity scoring; I'd characterize the reliably demonstrated impact as DoS, with code execution as a credible but conditional escalation.

ROOT CAUSE (python/libxml.c, pythonAttributeDecl)

for (node = tree; node != NULL; node = node->next) {
newName = PY_IMPORT_STRING((char *) node->name);
PyList_SetItem(nameList, count, newName); /* steals reference */
Py_DECREF(newName); /* double-free */
count++;
}

PyList_SetItem() does not increment the refcount, so the subsequent Py_DECREF() over-decrements. Because of CPython pymalloc free-list reuse, list entries can end up pointing at the same freed address; cleanup after the SAX callback then decrefs dangling pointers and corrupts allocator state.

PROOF OF CONCEPT (minimal DoS)

import libxml2
class Handler:
def attributeDecl(self, *args): pass
def startElement(self, *a): pass
def endElement(self, *a): pass
def characters(self, *a): pass
xml = b'''<?xml version="1.0"?>
<!DOCTYPE r [
<!ELEMENT r EMPTY>
<!ATTLIST r a (xx|yy|zz|ww|qq) "xx">
]>
<r a="xx"/>'''
h = Handler()
c = libxml2.createPushParser(h, "", 0, "t")
c.parseChunk(xml, len(xml), 1) # SIGSEGV

UPSTREAM FIX (already merged and closed)

Fix: remove the erroneous Py_DECREF(newName) since PyList_SetItem already takes ownership.

 Merge request: https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/397  ("python: Do not decref string after adding to the list")

 Fix commit: 046931e6

 Issue report: https://gitlab.gnome.org/GNOME/libxml2/-/work_items/1076

 Upstream maintainer Nick Wellnhofer confirmed it appears to be a security issue and asked that a CVE be requested; the maintainer who merged the fix indicated CVE assignment is not handled by the project itself.

SUGGESTED CLASSIFICATION

CWE-415 (Double Free), leading to CWE-416 (Use After Free)

ENVIRONMENT

OS: Ubuntu 22.04 x86_64; Python 3.10.12; GCC 11.4.0; libxml2 built from source with -fsanitize=address.

I'm happy to provide the full ASan trace or the code-execution PoC on request. Please let me know if you need anything else to proceed.

Thank you,
Adnan Jakati!https://mailtrack.io/trace/mail/773e02eeb348f92b41f2a5d93b4c46af0007ab1f.png?u=12519192!

Comment 1 Jon Orris 2026-09-24 12:55:03 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 10

Via RHSA-2026:71586 https://access.redhat.com/errata/RHSA-2026:71586

Comment 2 Jon Orris 2026-09-24 16:03:09 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2026:71641 https://access.redhat.com/errata/RHSA-2026:71641

Comment 3 Jon Orris 2026-09-24 16:03:10 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2026:71641 https://access.redhat.com/errata/RHSA-2026:71641

Comment 4 Jon Orris 2026-09-24 19:00:41 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2026:71585 https://access.redhat.com/errata/RHSA-2026:71585

Comment 5 Jon Orris 2026-10-26 03:04:58 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9.4 Update Services for SAP Solutions

Via RHSA-2026:89750 https://access.redhat.com/errata/RHSA-2026:89750

Comment 6 Jon Orris 2026-10-26 03:20:01 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 10.0 Extended Update Support

Via RHSA-2026:89759 https://access.redhat.com/errata/RHSA-2026:89759

Comment 7 Jon Orris 2026-10-26 15:42:25 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9.6 Extended Update Support

Via RHSA-2026:90309 https://access.redhat.com/errata/RHSA-2026:90309

Comment 8 Jon Orris 2026-10-29 13:33:12 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9.2 Update Services for SAP Solutions

Via RHSA-2026:92352 https://access.redhat.com/errata/RHSA-2026:92352

Comment 9 Jon Orris 2026-10-29 19:49:47 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.6 Advanced Mission Critical Update Support
  Red Hat Enterprise Linux 8.6 Extended Update Support Long-Life Add-On

Via RHSA-2026:92589 https://access.redhat.com/errata/RHSA-2026:92589

Comment 10 Jon Orris 2026-11-02 03:23:10 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.4 Advanced Mission Critical Update Support
  Red Hat Enterprise Linux 8.4 Extended Update Support Long-Life Add-On

Via RHSA-2026:93473 https://access.redhat.com/errata/RHSA-2026:93473

Comment 11 Jon Orris 2026-11-02 03:32:47 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.8 Update Services for SAP Solutions
  Red Hat Enterprise Linux 8.8 Telecommunications Update Service

Via RHSA-2026:93463 https://access.redhat.com/errata/RHSA-2026:93463


Note You need to log in before you can comment on or make changes to this bug.