CVE-2026-56131: libexpat Use-After-Free in XML_ResumeParser Handler Call Tracking
libexpat, a widely-used XML parsing library, contains a use-after-free vulnerability in versions before 2.8.2. The flaw occurs when the XML_ResumeParser function is called from within a handler and a policy violation is detected. In such cases, the library fails to properly track the call stack depth, leaving freed memory accessible and potentially exploitable. This is analogous to an earlier vulnerability (CVE-2026-50219) in the same codebase.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 4.9 MEDIUM · CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
- Weaknesses (CWE)
- CWE-416
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-19 / 2026-06-23
NVD description (verbatim)
libexpat before 2.8.2 lacks handler call depth tracking for calls to XML_ResumeParser from within handlers in cases of a policy violation. Thus, a use-after-free can occur (similar to the CVE-2026-50219 situation).
1 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-56131 is a use-after-free condition (CWE-416) in libexpat arising from insufficient handler call depth tracking during XML_ResumeParser invocations. When a policy violation occurs and XML_ResumeParser is called from within a handler routine, the library does not correctly maintain the internal call stack counter. This allows a subsequent memory free operation to proceed while the freed memory region remains accessible via lingering references, creating a window for information disclosure or code execution depending on heap state and attacker control.
Business impact
Organizations deploying libexpat in XML parsing pipelines—common in configuration management, document processing, web services, and API gateways—face potential application instability and, in worst-case scenarios, privilege escalation or data exfiltration. The vulnerability is classified as MEDIUM severity, meaning impact is real but exploitation requires local access and specific handler conditions. For software vendors shipping libexpat as a dependency, this requires coordinated patching and customer notification.
Affected systems
libexpat versions prior to 2.8.2 are affected. Any application or library that bundles, links against, or depends on vulnerable versions of libexpat is in scope. This includes XML processors in configuration parsers, document handling systems, embedded devices, and containerized workloads. Verify your libexpat version and all downstream dependencies that may transitively pull in the library.
Exploitability
Exploitation is not trivial. The attack requires local execution context, specific timing around handler invocation and policy violation, and heap memory manipulation to convert use-after-free into a meaningful primitive. The CVSS score of 4.9 (MEDIUM) reflects this constraint: while local attackers with no special privileges can trigger the condition, successful weaponization demands sophistication. No public exploit code has been indexed in the CISA KEV catalog, indicating real-world exploitation has not yet become widespread.
Remediation
Upgrade libexpat to version 2.8.2 or later. Review your software bill of materials (SBOM) to identify all direct and transitive dependencies on libexpat. Test upgrades in a staging environment to ensure compatibility with your XML parsing workflows. For embedded systems or containerized deployments, rebuild and redeploy after patching the library.
Patch guidance
1. Obtain libexpat 2.8.2 or newer from the official project repository or your package manager. 2. Perform regression testing on XML parsing functionality with your organization's typical XML inputs and edge cases. 3. For vendored or embedded copies, manually update source trees and rebuild. 4. Prioritize patching in environments where libexpat processes untrusted XML (public APIs, user uploads, external data feeds). 5. Verify the patch by checking the library version string post-deployment.
Detection guidance
Monitor for libexpat versions in use via Software Composition Analysis (SCA) tools integrated into your CI/CD pipeline. Runtime detection is difficult without heap instrumentation; instead, focus on inventory and version scanning. Check application logs for XML parsing errors or crashes that might indicate exploitation attempts. In high-trust environments, memory sanitizers (AddressSanitizer, Valgrind) can help identify use-after-free conditions during testing.
Why prioritize this
Although marked MEDIUM severity, this vulnerability warrants prompt but not emergency patching because (a) it requires local access, (b) exploitation is non-trivial, and (c) it has not appeared in active exploitation databases. However, organizations processing untrusted XML, running multi-tenant systems, or hosting containerized workloads should prioritize this in the next regular patching cycle, as escaped containers or lateral movement scenarios could lower the bar for exploitation.
Risk score, explained
The CVSS v3.1 score of 4.9 reflects: Local attack vector (AV:L) — attacker must be on the target system; High attack complexity (AC:H) — specific conditions and timing are required; No privileges needed (PR:N); No user interaction (UI:N); Confidentiality, Integrity, and Availability each impacted at Low scope (C:L, I:L, A:L) — potential read of freed memory, potential code execution, potential denial of service, but not complete system compromise. This balances real risk with practical exploitation difficulty.
Frequently asked questions
How is this different from CVE-2026-50219?
CVE-2026-50219 was a related use-after-free in libexpat. This vulnerability (CVE-2026-56131) targets the same library but exploits a gap in call depth tracking specifically during XML_ResumeParser invocation from handlers. Both underscore the importance of rigorous handler state management in recursive XML parsing. Check your vendor advisory for detailed technical distinctions.
Do I need to patch immediately if I'm not processing untrusted XML?
If your XML sources are internal, pre-validated, and confined to trusted networks, risk is lower but not zero. Lateral movement or container escape could still expose the vulnerability. Apply the patch within your standard maintenance window (typically 30 days), and sooner if you support multi-tenant or open-access systems.
Will upgrading libexpat break my application?
libexpat 2.8.2 is a bug-fix release and maintains backward compatibility with the public API. Test in a staging environment with your actual XML workloads to confirm, but breakage is unlikely. Consult the project's release notes for any deprecations or behavioral changes.
How do I check if my software includes libexpat?
Use Software Composition Analysis (SCA) tools (Snyk, Black Duck, FOSSA, etc.) to scan your application and dependencies. On Linux/Unix, run `pkg-config --modversion expat` or check your package manager (`apt show libexpat1`, `rpm -qa | grep expat`). Verify version numbers against 2.8.2 as the threshold.
This analysis is based on publicly available information current as of June 2026. CVSS scores and severity ratings are derived from the CVE record and NIST standards. Actual risk and exploitability may vary depending on your specific environment, deployment model, and threat model. No exploit code is provided or referenced. Organizations should conduct their own threat assessment and consult vendor advisories and security bulletins before making patching decisions. SEC.co and its analysts provide no warranty for the completeness or accuracy of remediation steps; always verify against official vendor documentation. Source: NVD (public-domain), retrieved 2026-07-27. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-50219MEDIUMlibexpat Use-After-Free via Handler Re-Entrancy
- CVE-2025-55644MEDIUMHeap Use-After-Free in GPAC MP4Box v2.4 DoS Vulnerability
- CVE-2025-55650MEDIUMHeap Use-After-Free in GPAC MP4Box v2.4 DoS Vulnerability
- CVE-2025-60486MEDIUMHeap Use-After-Free in GPAC MP4Box MPEG-2 Dasher – DoS Vulnerability
- CVE-2026-10232MEDIUMAssimp Use-After-Free in ASE Parser (CVSS 5.3)
- CVE-2026-10634MEDIUMZephyr TCP Stack Use-After-Free Race Condition
- CVE-2026-10635MEDIUMXtensa Memory Domain Use-After-Free in Zephyr RTOS
- CVE-2026-10637MEDIUMZephyr IPv6 MLD Use-After-Free Denial of Service