GHSA-9cv2-cfxc-v4v2: Nokogiri Null Pointer Dereference Calling Methods Vulnerability

LOW
CWE-476
Published
Advisory Summary

GHSA-9cv2-cfxc-v4v2 is a LOW null pointer dereference calling methods vulnerability (CWE-476: NULL Pointer Dereference) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves null pointer dereference calling methods on uninitialized wrapper classes. Remediation is available by upgrading affected packages to version 1.19.4.

GHSA-9cv2-cfxc-v4v2 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-9cv2-cfxc-v4v2
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-476: NULL Pointer Dereference
Affected Product Nokogiri
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix GHSA-9cv2-cfxc-v4v2

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.

nokogiri fixed: 1.19.4
Upgrade nokogiri to 1.19.4
Verify Direct and Transitive Dependencies

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-9cv2-cfxc-v4v2, 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-476: NULL Pointer Dereference, where the product dereferences a pointer that it expects to be valid but is null. 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

### Summary Nokogiri contains a bug when calling certain methods on allocated-but-uninitialized native wrapper classes that inherit from `Nokogiri::XML::Node`. This caused a NULL pointer dereference that could crash the process. Nokogiri 1.19.4 checks for missing native data pointers and raises a `RuntimeError`. JRuby is not affected. ### Severity The Nokogiri maintainers have evaluated this as low severity. This is only triggered by a programming error. It requires application code to call `.allocate` directly on a native-backed class and then invoke methods on the resulting uninitialized object. It cannot be triggered by untrusted input or through normal use of the public API. ### Mitigation Upgrade to Nokogiri 1.19.4 or later. Avoid calling `.allocate` directly on Nokogiri native-backed classes. Use the documented constructors and factory methods instead. ### Credit This issue was responsibly reported by Zheng Yu from depthfirst.com.

GHSA-9cv2-cfxc-v4v2 Affected Nokogiri Versions

1 component(s)
Fixed Versions:
1.19.4
Product / Package Ecosystem Affected Versions Fixed Version
nokogiri
RubyGems
< 1.19.4
1.19.4

References

Frequently Asked Questions

What is GHSA-9cv2-cfxc-v4v2?
GHSA-9cv2-cfxc-v4v2 is a security vulnerability in Nokogiri involving Null Pointer Dereference calling methods on uninitialized wrapper classes under CWE-476: NULL Pointer Dereference.
Which Nokogiri versions are affected?
Affected versions include releases prior to 1.19.4 across affected packages: nokogiri.
What version fixes GHSA-9cv2-cfxc-v4v2?
Upgrading to 1.19.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nokogiri affected?
Yes, nokogiri is affected in releases prior to 1.19.4. Upgrade your dependency to 1.19.4 or later.
What CWE is associated with GHSA-9cv2-cfxc-v4v2?
GHSA-9cv2-cfxc-v4v2 is classified under CWE-476: NULL Pointer Dereference (The product dereferences a pointer that it expects to be valid but is NULL.).
How can I check RubyGems dependencies for GHSA-9cv2-cfxc-v4v2?
Run the dependency tree command: 'inspect dependencies for nokogiri'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9cv2-cfxc-v4v2",
  "modified" : "2026-06-19T16:36:23Z",
  "published" : "2026-06-19T16:36:23Z",
  "aliases" : [ ],
  "summary" : "Nokogiri: Null Pointer Dereference calling methods on uninitialized wrapper classes",
  "details" : "### Summary\n\nNokogiri contains a bug when calling certain methods on allocated-but-uninitialized native wrapper classes that inherit from `Nokogiri::XML::Node`. This caused a NULL pointer dereference that could crash the process.\n\nNokogiri 1.19.4 checks for missing native data pointers and raises a `RuntimeError`.\n\nJRuby is not affected.\n\n### Severity\n\nThe Nokogiri maintainers have evaluated this as low severity. This is only triggered by a programming error. It requires application code to call `.allocate` directly on a native-backed class and then invoke methods on the resulting uninitialized object. It cannot be triggered by untrusted input or through normal use of the public API.\n\n### Mitigation\n\nUpgrade to Nokogiri 1.19.4 or later.\n\nAvoid calling `.allocate` directly on Nokogiri native-backed classes. Use the documented constructors and factory methods instead.\n\n### Credit\n\nThis issue was responsibly reported by Zheng Yu from depthfirst.com.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U"
  } ],
  "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-9cv2-cfxc-v4v2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sparklemotion/nokogiri"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-476" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-19T16:36:23Z",
    "nvd_published_at" : null
  }
}