Skip to main content

libexpat CVE-2026-50219

| EUVDEUVD-2026-34206 MEDIUM
Use After Free (CWE-416)
2026-06-04 mitre GHSA-v3cw-2f3g-f38x
5.9
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Supply crafted XML to libexpat-based application
  2. Delivery
    Trigger XML event handler callback during parsing
  3. Exploit
    Handler invokes XML_ParserFree or XML_Parse re-entrantly
  4. Execution
    Parser struct freed/reset while still on call stack
  5. Persist
    Use-after-free accessed during stack unwind
  6. Impact
    Memory corruption yields data disclosure or heap corruption

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Memory lifecycle management
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Privilege Escalation

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that an application built on libexpat (before 2.8.2) invokes one of five specific API functions - XML_GetBuffer, XML_Parse, XML_ParseBuffer, XML_ParserFree, or XML_ParserReset - from within an active XML event handler callback (element handler, character data handler, entity reference handler, etc.) during a policy violation scenario. This re-entrant call pattern is the necessary and specific trigger; applications whose handlers do not call back into these libexpat lifecycle functions are not exploitable regardless of the XML input they process. The CVSS PR:N (no privileges required) means an unprivileged local user can supply the XML input, but the AC:H rating reflects that the re-entrant handler pattern must already exist in the target application code or its language binding. Language bindings (e.g., Python's xml.parsers.expat) that expose parser control to handler callbacks may extend this exposure to remote network contexts if they accept XML from untrusted sources. Exploitation is limited to versions of libexpat before 2.8.2; applications using libexpat as a shared library can be remediated by OS package upgrade without recompiling the application.

Impact

The CVSS 3.1 base score of 4.9 (Medium) reflects AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L. The local attack vector (AV:L) and high attack complexity (AC:H) are significant mitigating factors: exploitation is not a simple network-to-RCE path but requires a specific re-entrant handler call pattern to be reachable. The impact vector (C:L/I:L/A:L) is consistent with a use-after-free that leaks or corrupts limited memory rather than guaranteeing full process takeover. No EPSS score was provided in available data, and the CVE is not listed in CISA KEV, indicating no confirmed widespread exploitation. However, the risk is meaningfully elevated by libexpat's pervasive embedding: it underlies Python's standard library XML modules, meaning a vulnerable pattern in a Python application could be triggered by attacker-supplied XML documents rather than requiring local binary access - creating a potential gap between the CVSS AV:L assessment and realistic deployment risk. CVSS indicates local vector but language bindings may expose this remotely via network-delivered XML - defenders should verify their specific binding's exposure. No POC exists at time of analysis, keeping real-world risk lower than the library's broad install base might otherwise suggest.

Exploit ScenarioDerived

An attacker submits crafted XML to an application that uses libexpat (directly or via a Python/PHP/other binding) where the application's entity or character data handler calls XML_ParserFree or XML_Parse re-entrantly during parsing - a pattern sometimes seen in binding layers that allow handler-level parser lifecycle control. The re-entrant call frees or resets the still-active parser struct, creating a dangling pointer that is subsequently accessed during stack unwind, yielding a use-after-free that leaks heap memory contents or corrupts adjacent allocations. No public POC exists at time of analysis, and achieving reliable code execution would require additional heap-shaping steps given the high attack complexity rating.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 04, 2026

Use-after-free in libexpat before 2.8.2 allows memory corruption, information disclosure, and potential code execution when prohibited API functions are called from within XML event handler callbacks. All libexpat consumers - including language bindings such as CPython's xml.parsers.expat - are affected when handler code (or attacker-influenced handler logic) invokes XML_GetBuffer, XML_Parse, XML_ParseBuffer, XML_ParserFree, or XML_ParserReset in a re-entrant manner during active parsing. No public exploit code exists at time of analysis and this CVE is not listed in the CISA Known Exploited Vulnerabilities catalog, but the CPython project has an associated open issue (python/cpython#146169) indicating ecosystem-wide reach.

RemediationAI

The primary remediation is to upgrade libexpat to version 2.8.2, which introduces handler call depth tracking and blocks the prohibited re-entrant API calls with a hard error (XML_STATUS_ERROR). The fix is upstream in PR #1246 (https://github.com/libexpat/libexpat/pull/1246); however, the formal release date for 2.8.2 was listed as TBD (placeholder date) at time of PR submission - monitor the libexpat releases page for a tagged artifact before deploying. For Python consumers, track https://github.com/python/cpython/issues/146169 for a coordinated CPython fix and upgrade to the patched Python release once available. As a compensating control where upgrading is not immediately possible, application developers should audit all XML event handler callbacks to ensure none of the following functions are called from within a handler context: XML_GetBuffer, XML_Parse, XML_ParseBuffer, XML_ParserFree, XML_ParserReset. Removing or deferring such calls eliminates the re-entrant trigger condition; this is a code change rather than a configuration change and requires application-level review. Restricting untrusted XML input at the network boundary reduces attack surface but does not eliminate the vulnerability if internal handler logic is already non-compliant.

Affected VersionsENISA

libexpat 0 <2.8.2

Affected Packages

euvd libexpat fix: 2.8.2

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

libexpat (CPE: cpe:2.3:a:libexpat_project:libexpat:*:*:*:*:*:*:*:*) is a widely embedded C XML stream parser used directly and via language bindings in Python, PHP, Perl, Ruby, and many others. The library dispatches user-supplied handler callbacks (element start/end, character data, entity references, etc.) during XML_Parse and XML_ParseBuffer calls. Prior to 2.8.2, the parser struct (XML_ParserStruct) lacked a handler call depth counter (m_handlerCallDepth), so the library could not detect when its own API functions were invoked re-entrantly from within an active handler. CWE-416 (Use After Free) is the root cause: if XML_ParserFree or XML_ParserReset is called from within a handler, the parser object is freed or reset while still referenced by the active call stack, leaving dangling pointers. Similarly, calling XML_Parse or XML_ParseBuffer re-entrantly can corrupt internal parser state. The fix in PR #1246 adds beforeHandler/afterHandler bookkeeping functions that increment/decrement m_handlerCallDepth, and guards each prohibited function with an isCalledFromInsideHandler() check that returns XML_STATUS_ERROR on violation.

Know when Libexpat gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

NVD PRIMARY 5.9 MEDIUM
AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
SUSE 4.9 MEDIUM
AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
Red Hat 4.9 MEDIUM

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
Low

Lifecycle Timeline

2
CVSS changed
Jul 22, 2026 - 20:22 NVD
4.9 (MEDIUM) 5.9 (MEDIUM)
Patch available
Jun 04, 2026 - 07:01 EUVD

DescriptionNVD

libexpat before 2.8.2 lacks handler call depth tracking for calls to XML_GetBuffer, XML_Parse, XML_ParseBuffer, XML_ParserFree, or XML_ParserReset from within handlers in cases of a policy violation. Thus, a use-after-free can occur,

Threat Intelligence Overview

EPSS Score
0.0%
Top 98% exploitable
Social Media
1
Sightings
Data Quality
8 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment MSRC Vendor CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Use-after-free vulnerabilities occur when a program continues to access memory through a pointer after that memory has been deallocated.

Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

CVE-2022-25315 CRITICAL POC
9.8 Feb 18

In Expat (aka libexpat) before 2.4.5, there is an integer overflow in storeRawNames. Rated critical severity (CVSS 9.8),

CVE-2025-59375 HIGH POC
7.5 Sep 15

libexpat in Expat before 2.7.2 allows attackers to trigger large dynamic memory allocations via a small document that is

CVE-2019-15903 HIGH POC
7.5 Sep 04

In libexpat before 2.2.8, crafted XML input could fool the parser into changing from DTD parsing to document parsing too

CVE-2026-115506 HIGH POC
8.7 Oct 22

CPU exhaustion in libexpat through 2.9.0 lets remote attackers stall XML parsing workloads by supplying a moderately siz

CVE-2026-93990 HIGH POC
8.7 Sep 19

Malformed UTF-16 decoding in libexpat through 2.8.4 lets remote attackers hide XML markup from the parser: a lone high s

CVE-2022-43680 HIGH POC
7.5 Oct 24

In libexpat through 2.4.9, there is a use-after free caused by overeager destruction of a shared DTD in XML_ExternalEnti

CVE-2024-28757 HIGH POC
7.5

Alpine Linux: expat fixed in 2.6.2-r0

CVE-2017-9233 HIGH POC
7.5 Jul 25

XML External Entity vulnerability in libexpat 2.2.0 and earlier (Expat XML Parser Library) allows attackers to put the p

CVE-2026-45186 HIGH POC
7.5 May 10

Denial of service in libexpat before 2.8.1 lets remote attackers exhaust CPU by submitting moderately sized crafted XML

CVE-2013-0340 MEDIUM POC
6.8 Jan 21

expat before version 2.4.0 does not properly handle entities expansion unless an application developer uses the XML_SetE

CVE-2016-0718 CRITICAL
9.8 May 26

Expat allows context-dependent attackers to cause a denial of service (crash) or possibly execute arbitrary code via a m

CVE-2024-45492 CRITICAL
9.8 Aug 30

An issue was discovered in libexpat before 2.6.3. Rated critical severity (CVSS 9.8), this vulnerability is remotely exp

Vendor StatusVendor

Debian

expat
Release Status Fixed Version Urgency
bullseye vulnerable 2.2.10-2+deb11u5 -
bullseye (security) vulnerable 2.2.10-2+deb11u7 -
bookworm vulnerable 2.5.0-1+deb12u2 -
bookworm (security) vulnerable 2.5.0-1+deb12u1 -
trixie vulnerable 2.7.1-2 -
forky, sid vulnerable 2.8.1-1 -
(unstable) fixed (unfixed) -

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise Desktop 15 SP7 Affected
SUSE Linux Enterprise High Performance Computing 15 SP7 Affected
SUSE Linux Enterprise Micro 5.3 Affected
SUSE Linux Enterprise Micro 5.4 Affected
SUSE Linux Enterprise Micro 5.5 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy