CVE-2018-14404: Nokogiri Nokogiri NULL Pointer Dereference Vulnerability

HIGH
Advisory Identifier: GHSA-6qvp-r6r3-9p7h
CVSS 7.5
CWE-476
Published
Advisory Summary

CVE-2018-14404 is a HIGH (CVSS 7.5) nokogiri null pointer dereference vulnerability (CWE-476: NULL Pointer Dereference) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves nokogiri null pointer dereference. Remediation is available by upgrading affected packages to version 1.8.5.

CVE-2018-14404 at a Glance

CVE Identifier CVE-2018-14404
GHSA Identifier GHSA-6qvp-r6r3-9p7h
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-476: NULL Pointer Dereference
Affected Product Nokogiri
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2018-14404

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.8.5
Upgrade nokogiri to 1.8.5
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 CVE-2018-14404, 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.8.5), 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

A NULL pointer dereference vulnerability exists in the `xpath.c:xmlXPathCompOpEval()` function of libxml2 through 2.9.8 when parsing an invalid XPath expression in the `XPATH_OP_AND` or `XPATH_OP_OR` case. Applications processing untrusted XSL format inputs with the use of the libxml2 library may be vulnerable to a denial of service attack due to a crash of the application.

CVE-2018-14404 Affected Nokogiri Versions

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

References

Frequently Asked Questions

What is CVE-2018-14404?
CVE-2018-14404 is a security vulnerability in Nokogiri involving Nokogiri NULL Pointer Dereference under CWE-476: NULL Pointer Dereference.
Which Nokogiri versions are affected?
Affected versions include releases prior to 1.8.5 across affected packages: nokogiri.
What version fixes CVE-2018-14404?
Upgrading to 1.8.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nokogiri affected?
Yes, nokogiri is affected in releases prior to 1.8.5. Upgrade your dependency to 1.8.5 or later.
What is the CVSS score of CVE-2018-14404?
CVE-2018-14404 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2018-14404?
CVE-2018-14404 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 CVE-2018-14404?
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-6qvp-r6r3-9p7h",
  "modified" : "2025-12-04T16:20:45Z",
  "published" : "2019-01-17T14:05:03Z",
  "aliases" : [ "CVE-2018-14404" ],
  "summary" : "Nokogiri NULL Pointer Dereference",
  "details" : "A NULL pointer dereference vulnerability exists in the `xpath.c:xmlXPathCompOpEval()` function of libxml2 through 2.9.8 when parsing an invalid XPath expression in the `XPATH_OP_AND` or `XPATH_OP_OR` case. Applications processing untrusted XSL format inputs with the use of the libxml2 library may be vulnerable to a denial of service attack due to a crash of the application.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "nokogiri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.8.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-14404"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sparklemotion/nokogiri/issues/1785"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:1543"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901817"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1595985"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2018-14404.yml"
  }, {
    "type" : "WEB",
    "url" : "https://gitlab.gnome.org/GNOME/libxml2/issues/10"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2018/09/msg00035.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2020/09/msg00009.html"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20190719-0002"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/3739-1"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/3739-2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-476" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:20:04Z",
    "nvd_published_at" : "2018-07-19T13:29:00Z"
  }
}