CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-WFPW-MMFH-QQ69

GHSA-WFPW-MMFH-QQ69: Use-After-Free Vulnerability in Nokogiri XML Node-Level XInclude Processing

Amit Schendel
Amit Schendel
Senior Security Researcher

Jun 19, 2026·7 min read·58 visits

Executive Summary (TL;DR)

A Use-After-Free vulnerability in Nokogiri's CRuby C-extension engine allows memory corruption or application crashes when XInclude is run on previously traversed DOM structures. The issue is resolved in version 1.19.4 by performing XInclude substitutions on a defensive copy.

Nokogiri is a popular Ruby gem used for parsing XML and HTML documents. A Use-After-Free (UAF) vulnerability exists in its CRuby implementation during XInclude processing. When an application traverses an XML document and exposes nodes to Ruby before calling `do_xinclude`, the underlying C library `libxml2` can free these structures in-place. This leaves active Ruby objects holding pointers to freed memory, leading to potential segmentation faults, memory corruption, or information disclosure.

Vulnerability Overview

The library Nokogiri is a widely used XML and HTML processing library for the Ruby programming language. In its CRuby implementation, Nokogiri relies heavily on native C extensions wrapping the libxml2 library. This architecture allows Nokogiri to achieve high-performance parsing, schema validation, and XPath querying. However, managing the lifecycle of C-level memory structures alongside Ruby garbage-collected objects requires precise pointer tracking and reference counting.

GHSA-WFPW-MMFH-QQ69 identifies a Use-After-Free (UAF) vulnerability inside the XML node-level XInclude processing engine, specifically within the Nokogiri::XML::Node#do_xinclude method. The vulnerability arises because of a misalignment between the lifetime of C memory structures managed by libxml2 and the Ruby objects wrapping them. When XML documents containing XML Inclusions (XInclude) elements are processed, the underlying engine can free structural nodes without notifying the Ruby-level garbage collector.

The attack surface is exposed when an application processes untrusted XML documents, parses them into a Document Object Model (DOM), traverses the DOM to expose specific subtrees to the Ruby runtime, and subsequently triggers manual XInclude processing. Because this API call sequence is uncommon, the severity is classified as low. Nevertheless, if triggered, the flaw leads to memory corruption, potential information disclosure, or application crash.

Root Cause Analysis

To understand the root cause, one must examine how Nokogiri bridges Ruby objects and C structures. When Nokogiri processes an XML document, it maps C structures like xmlNode and xmlNs to Ruby classes such as Nokogiri::XML::Node and Nokogiri::XML::Namespace. Nokogiri maintains an internal registry to track these allocations. This registry ensures that as long as a Ruby object references a node, the underlying C structure is not freed, and conversely, that dead Ruby wrappers do not leak C memory.

The core of the vulnerability lies within the interaction between Nokogiri::XML::Node#do_xinclude and the libxml2 function xmlXIncludeProcessNode. When executing XInclude processing, libxml2 parses external targets and merges them into the current document. If the document contains an <xi:include> tag, libxml2 replaces this element with the target contents. Consequently, the original <xi:include> node, its child nodes (such as <xi:fallback>), and its local namespaces are freed within the C library heap.

If the Ruby application has already traversed into the subtree of the <xi:include> element before calling do_xinclude, the Ruby interpreter has already instantiated wrapper objects pointing directly to those internal C nodes. Since libxml2 executes the free operation directly inside the C layer, Nokogiri's reference-tracking system is bypassed. The live Ruby objects are left holding pointers to deallocated heap locations, representing a classic Use-After-Free condition.

Subsequent operations on these stale Ruby wrapper objects cause the virtual machine to dereference the invalid pointers. If the memory remains unallocated, the application typically terminates with a segmentation fault. If the memory has been reallocated by other processes or structures within the Ruby allocator, the application may read arbitrary heap memory or write to active structures, resulting in data exposure or remote code execution.

Code-Level Mechanics and Fix Analysis

The vulnerability manifests when invoking Nokogiri::XML::Node#do_xinclude on a document that has already been traversed. In older versions of Nokogiri, this method invoked the underlying C library directly on the active DOM tree. The C extension executed the processing in-place, modifying the live document structure and freeing nodes that were still bound to active Ruby-level variables.

To prevent this in-place modification and subsequent pointer invalidation, the maintainers modified the implementation in version 1.19.4. The updated code performs the XInclude processing on a duplicate, defensive copy of the document or nodes. Below is a conceptual representation of the modification introduced in the remediation:

# Vulnerable implementation concept
def do_xinclude
  # Modifies the live C structure directly in-place
  # This frees nodes that Ruby objects may still reference
  _native_do_xinclude(self)
end
 
# Patched implementation concept in 1.19.4
def do_xinclude
  # Perform XInclude processing on a duplicate of the node/document
  # This protects the active, traversed tree from being modified in-place
  duplicate_node = self.dup
  _native_do_xinclude(duplicate_node)
  
  # Replace the children of the current node safely with the processed duplicate
  self.children = duplicate_node.children
  self
end

By working on a duplicate tree, any node destruction occurs on elements that have never been exposed to the Ruby runtime. The active DOM tree remains intact, and any previously referenced Ruby nodes continue to point to valid memory addresses. This defense-in-depth approach completely isolates the side-effects of the destructive C-level operations from the user-facing Ruby variables.

Exploitation Methodology

Exploiting this Use-After-Free vulnerability requires a specific, multi-step API interaction. The attacker must find an application endpoint that accepts untrusted XML documents, parses them, traverses into an XInclude subtree to instantiate Ruby objects, and then explicitly executes XInclude processing on the node or document.

The following block illustrates the conceptual flow required to trigger the vulnerability:

To reproduce the memory corruption, an XML document must contain an <xi:include> element and an <xi:fallback> element. The application must parse the input without the immediate XInclude option, run a search or traversal such as doc.at_xpath("//xi:fallback") to create a live Ruby object, and then call doc.do_xinclude. Calling any method on the retrieved fallback node after this point causes the Ruby interpreter to access freed memory.

Because this sequence of API calls is highly uncommon, the exploitability of this vulnerability in real-world scenarios is extremely limited. Applications typically either process XIncludes at parse time or do not process them at all. Furthermore, there are no known public exploits or automated exploitation payloads targeting this vulnerability in the wild, indicating that the threat remains theoretical.

Impact Assessment

The impact of a Use-After-Free vulnerability is heavily dependent on the memory layout and the actions performed on the stale pointers. At a minimum, accessing the freed memory results in an immediate segmentation fault, leading to a Denial of Service (DoS) of the application process. In multi-threaded application servers, a segmentation fault typically terminates the worker process, impacting availability.

In highly specific environments, an attacker could attempt to manipulate the heap layout to achieve arbitrary code execution. By triggering the allocation of attacker-controlled structures immediately after the XInclude node is freed, the stale pointer could be made to point to controlled payload data. If the application then invokes a virtual method or dereferences a callback pointer on the stale Ruby object, control flow could be hijacked.

However, executing such heap grooming techniques within the Ruby virtual machine is highly complex due to the asynchronous nature of the Ruby garbage collector and the internal allocator designs of CRuby. The vulnerability is thus considered a low-severity risk. Since JRuby does not use the C-based libxml2 wrapper, but instead relies on native Java parsers, systems running on the JRuby runtime are completely immune to this vulnerability.

Remediation and Detection

The primary remediation path is upgrading the Nokogiri gem to version 1.19.4 or higher. This update changes the behavior of #do_xinclude to use defensive copying, shielding active Ruby references from the underlying memory modifications. If an immediate upgrade is not feasible, developers should inspect their codebases for instances of explicit #do_xinclude invocations.

Where upgrading is delayed, developers can mitigate the risk by modifying the XML parsing configuration. Rather than calling #do_xinclude manually on an already parsed and traversed document, applications should enable XInclude processing at the initial parsing stage. This approach processes the XML inclusions before any Ruby objects are created, preventing the lifetime misalignment entirely.

# Safe pattern for older Nokogiri versions:
# Enable XInclude processing during parsing
doc = Nokogiri::XML(xml_data) do |config|
  config.xinclude
end

Additionally, static analysis can be utilized to locate potential vulnerabilities. Security teams should run software composition analysis (SCA) tools to identify vulnerable versions of the Nokogiri gem within their dependency graphs. Security audits should focus on ensuring that untrusted XML input is sanitized and that unnecessary parsing options, such as external entity resolution and XIncludes, are disabled unless explicitly required.

Technical Appendix

CVSS Score
4.8/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L

Affected Systems

Nokogiri (CRuby implementation)

Affected Versions Detail

Product
Affected Versions
Fixed Version
nokogiri
sparklemotion
< 1.19.41.19.4
AttributeDetail
CWE IDCWE-416
Attack VectorNetwork (with local programmatic triggers)
CVSS Score4.8 (Medium/Low)
ImpactMemory Corruption / Denial of Service
Exploit StatusNone (No public exploit)
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1203Exploitation for Client Execution
Execution
T1211Exploitation for Defense Evasion
Defense Evasion
CWE-416
Use After Free

Vulnerability Timeline

GitHub Advisory GHSA-WFPW-MMFH-QQ69 is published.
2026-06-19
Advisory metadata is modified to reflect affected package specifications.
2026-06-19

References & Sources

  • [1]Official GitHub Security Advisory
  • [2]Official Repository

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•32 minutes ago•CVE-2026-114146
9.0

CVE-2026-114146: Elevation of Privilege in ASP.NET Core SignalR Connection Dispatcher

An incorrect authorization vulnerability (CWE-863) exists in the ASP.NET Core SignalR HTTP Connection Dispatcher (`Microsoft.AspNetCore.Http.Connections`). The connection negotiation process failed to bind the authenticated caller identity to the generated connection state, and subsequent transport or message dispatch handlers failed to verify caller consistency. Consequently, an authenticated low-privilege attacker who obtains a valid connection identifier or token can inject messages into or hijack another user's SignalR session, achieving an elevation of privilege across security boundaries.

Alon Barad
Alon Barad
1 views•11 min read
•about 2 hours ago•CVE-2026-109478
7.5

CVE-2026-109478: Algorithmic Complexity Denial of Service in ASP.NET Core Header Parsing

CVE-2026-109478 is a network-accessible Denial of Service (DoS) vulnerability in ASP.NET Core caused by inefficient algorithmic complexity (CWE-407) when parsing comma-separated HTTP request headers. Prior to the patch, the internal helper method ParsingHelpers.GetHeaderSplit repeatedly called StringValues.Concat inside a loop iterating over each comma-separated token. Because StringValues allocates a new array of size k + 1 and copies all existing elements upon each concatenation, processing N tokens incurs O(N^2) time and space complexity. An unauthenticated remote attacker can send HTTP requests with headers containing thousands of short, comma-separated values to exhaust CPU cycles and induce severe Garbage Collection (GC) pauses, rendering the web application unresponsive.

Alon Barad
Alon Barad
5 views•11 min read
•about 3 hours ago•CVE-2026-114147
7.5

CVE-2026-114147: Denial of Service via Memory Leak in ASP.NET Core SignalR Redis Backplane

CVE-2026-114147 is a high-severity Denial of Service (DoS) vulnerability affecting ASP.NET Core and specifically the Microsoft.AspNetCore.SignalR.StackExchangeRedis scale-out provider across .NET 8.0, 9.0, 10.0, and 11.0 preview releases. The vulnerability originates from a string comparison mismatch between internal per-connection group collections and the centralized Redis channel subscription registry, compounded by a race condition during connection teardown. Remote unauthenticated attackers can exploit this flaw to leave orphaned connection contexts and active Redis pub/sub listeners pinned in memory, leading to unbounded memory exhaustion and application process termination.

Amit Schendel
Amit Schendel
3 views•10 min read
•about 4 hours ago•CVE-2026-114156
6.5

CVE-2026-114156: Path Equivalence Security Feature Bypass in Microsoft ASP.NET Core

CVE-2026-114156 is an improper resolution of path equivalence vulnerability (CWE-41) in Microsoft ASP.NET Core affecting .NET 11.0 preview releases and Microsoft Visual Studio 2026. The vulnerability stems from a discrepancy between how path prefix validation helpers (such as PathString.StartsWithSegments) and downstream routing mechanisms handle alternate path separators and percent-encoded characters. An unauthenticated remote attacker can exploit this mismatch over the network to bypass path-based authorization middleware and access restricted endpoints.

Amit Schendel
Amit Schendel
5 views•8 min read
•about 5 hours ago•CVE-2026-114157
7.5

CVE-2026-114157: Local Privilege Escalation via Race Condition in ASP.NET Core Kestrel Named Pipes Transport

CVE-2026-114157 is a high-severity local privilege escalation and security feature bypass vulnerability affecting ASP.NET Core on Microsoft Windows. The flaw resides in the Kestrel web server's Named Pipes transport layer (Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes) and stems from a race condition (CWE-362) during broken pipe error recovery. When an active connection throws an IOException during handshake acceptance, the connection listener previously disposed of the broken NamedPipeServerStream instance before acquiring a replacement stream from its internal pool. This sequence created a momentary window where zero server instances of the named pipe existed in the Windows Named Pipe File System (NPFS). A local, low-privileged attacker can exploit this timing window to create a named pipe with the identical name and a permissive Discretionary Access Control List (DACL), hijacking subsequent inter-process communications and escalating privileges across security boundaries.

Amit Schendel
Amit Schendel
6 views•11 min read
•about 5 hours ago•CVE-2026-124194
6.5

CVE-2026-124194: Forced Authentication and NetNTLMv2 Credential Leakage in Microsoft Office Outlook

CVE-2026-124194 is a forced authentication and spoofing vulnerability in Microsoft Office Outlook caused by a missing user interface warning before dereferencing remote network paths (CWE-356). By embedding an attacker-controlled Universal Naming Convention (UNC) path within MAPI message properties such as PidLidReminderFileParameter, an unauthenticated remote attacker can force a victim's system to initiate an outbound SMB or WebDAV connection upon opening or previewing a crafted message. This automatic authentication handshake leaks the user's NetNTLMv2 hash, enabling offline password cracking or real-time NTLM relay attacks. The vulnerability was exploited in the wild as a zero-day prior to its remediation in Microsoft's November 2026 Patch Tuesday updates and is listed in the CISA Known Exploited Vulnerabilities (KEV) catalog.

Alon Barad
Alon Barad
17 views•10 min read