GHSA-wfpw-mmfh-qq69: Nokogiri Possible Use-After-Free Vulnerability
LOWGHSA-wfpw-mmfh-qq69 is a LOW possible use-after-free vulnerability (CWE-416: Use After Free) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves possible use-after-free in xinclude processing. Remediation is available by upgrading affected packages to version 1.19.4.
GHSA-wfpw-mmfh-qq69 at a Glance
How to Fix GHSA-wfpw-mmfh-qq69
To remediate this vulnerability, upgrade all affected Nokogiri dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade nokogiri to 1.19.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for nokogiri
How to Check if You Are Affected
To determine whether your application is affected by GHSA-wfpw-mmfh-qq69, inspect your project dependencies for Nokogiri:
inspect dependencies for nokogiri
Analyze the terminal output to locate any version of Nokogiri in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.19.4), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-416: Use After Free, where the product reuses or references memory after it has been freed. at some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer. In Nokogiri, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-wfpw-mmfh-qq69 Affected Nokogiri Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
nokogiri
|
RubyGems |
< 1.19.4
|
1.19.4
|
References
Frequently Asked Questions
What is GHSA-wfpw-mmfh-qq69?
Which Nokogiri versions are affected?
What version fixes GHSA-wfpw-mmfh-qq69?
Is nokogiri affected?
What CWE is associated with GHSA-wfpw-mmfh-qq69?
How can I check RubyGems dependencies for GHSA-wfpw-mmfh-qq69?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-wfpw-mmfh-qq69",
"modified" : "2026-06-19T16:37:25Z",
"published" : "2026-06-19T16:37:25Z",
"aliases" : [ ],
"summary" : "Nokogiri: Possible Use-After-Free in XInclude Processing",
"details" : "### Summary\n\nXInclude substitution performed by `Nokogiri::XML::Node#do_xinclude` replaced each `<xi:include>` in place, freeing the include node along with its children (such as `<xi:fallback>` and its descendants) and any namespaces declared on them. If an application had already exposed one of those nodes or namespaces to Ruby, the corresponding Ruby object was left pointing at freed memory. Using the object could result in invalid reads or writes to memory.\n\nNokogiri 1.19.4 substitutes each `<xi:include>` on a defensive copy by default, so the structures libxml2 frees are never the ones bound to live Ruby objects.\n\nOnly the CRuby implementation is affected; JRuby is not affected.\n\n### Severity\n\nThe Nokogiri maintainers have evaluated this as low severity. Reaching it requires an unusual API-usage pattern that does not arise during normal use. The application must parse a document without XInclude, traverse into an `<xi:include>` subtree to expose its nodes or namespaces to Ruby, and only then invoke XInclude processing. The common case, requesting XInclude at parse time, operates on a freshly parsed document whose nodes are not yet exposed to Ruby and is not affected. Nokogiri 1.19.4 makes this pattern safe by default and requires no change to application code.\n\n### Mitigation\n\nUpgrade to Nokogiri 1.19.4 or later.\n\nAs a workaround for earlier versions, perform XInclude substitution at parse time (with the `xinclude` parse option) rather than calling `#do_xinclude` on a document that has already been traversed. A freshly parsed document has no nodes exposed to Ruby, so the substitution is safe.\n\n### Credit\n\nThis issue was responsibly reported by Zheng Yu from depthfirst.com.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "nokogiri"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.19.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-wfpw-mmfh-qq69"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/sparklemotion/nokogiri"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-416" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-19T16:37:25Z",
"nvd_published_at" : null
}
}