CVE-2017-15412: Nokogiri Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-r58r-74gx-6wx3
CVSS 8.8
CWE-416
Published
Advisory Summary

CVE-2017-15412 is a HIGH (CVSS 8.8) denial of service vulnerability (CWE-416: Use After Free) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves nokogiri gem, via libxml, is affected by dos vulnerabilities. Remediation is available by upgrading affected packages to version 1.8.2.

CVE-2017-15412 at a Glance

CVE Identifier CVE-2017-15412
GHSA Identifier GHSA-r58r-74gx-6wx3
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-416: Use After Free
Affected Product Nokogiri
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 8.8

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:R/S:U/C:H/I:H/A:H).

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

How to Fix CVE-2017-15412

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.2
Upgrade nokogiri to 1.8.2
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-2017-15412, 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.2), 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

Use after free in libxml2 before 2.9.5, as used in Google Chrome prior to 63.0.3239.84 and other products, allowed a remote attacker to potentially exploit heap corruption via a crafted HTML page.

CVE-2017-15412 Affected Nokogiri Versions

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

References

Frequently Asked Questions

What is CVE-2017-15412?
CVE-2017-15412 is a security vulnerability in Nokogiri involving Nokogiri gem, via libxml, is affected by DoS vulnerabilities under CWE-416: Use After Free.
Which Nokogiri versions are affected?
Affected versions include releases prior to 1.8.2 across affected packages: nokogiri.
What version fixes CVE-2017-15412?
Upgrading to 1.8.2 (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.2. Upgrade your dependency to 1.8.2 or later.
What is the CVSS score of CVE-2017-15412?
CVE-2017-15412 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2017-15412?
CVE-2017-15412 is classified under CWE-416: Use After Free (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.).
How can I check RubyGems dependencies for CVE-2017-15412?
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-r58r-74gx-6wx3",
  "modified" : "2023-08-26T00:20:04Z",
  "published" : "2022-05-14T02:19:17Z",
  "aliases" : [ "CVE-2017-15412" ],
  "summary" : "Nokogiri gem, via libxml, is affected by DoS vulnerabilities",
  "details" : "Use after free in libxml2 before 2.9.5, as used in Google Chrome prior to 63.0.3239.84 and other products, allowed a remote attacker to potentially exploit heap corruption via a crafted HTML page.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "nokogiri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.8.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-15412"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sparklemotion/nokogiri/issues/1714"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2017:3401"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2018:0287"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.gnome.org/show_bug.cgi?id=783160"
  }, {
    "type" : "WEB",
    "url" : "https://chromereleases.googleblog.com/2017/12/stable-channel-update-for-desktop.html"
  }, {
    "type" : "WEB",
    "url" : "https://crbug.com/727039"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2017-15412.yml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2017/12/msg00014.html"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/201801-03"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20201208155618/http://www.securitytracker.com/id/1040348"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2018/dsa-4086"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-416" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-26T00:20:04Z",
    "nvd_published_at" : "2018-08-28T19:29:00Z"
  }
}