CVE-2015-5312: Nokogiri Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-xjqg-9jvg-fgx2
CWE-400
Published
Advisory Summary

CVE-2015-5312 is a HIGH denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves nokogiri subject to dos via libxml2 vulnerability. Remediation is available by upgrading affected packages to version 1.6.7.1.

CVE-2015-5312 at a Glance

CVE Identifier CVE-2015-5312
GHSA Identifier GHSA-xjqg-9jvg-fgx2
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Nokogiri
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix CVE-2015-5312

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.6.7.1
Upgrade nokogiri to 1.6.7.1
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-2015-5312, 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.6.7.1), 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. 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

The xmlStringLenDecodeEntities function in parser.c in libxml2 before 2.9.3 (as used in nokogiri before 1.6.7.1) does not properly prevent entity expansion, which allows context-dependent attackers to cause a denial of service (CPU consumption) via crafted XML data, a different vulnerability than CVE-2014-3660.

CVE-2015-5312 Affected Nokogiri Versions

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

References

NVD — CVE-2015-5312 NVD
https://nvd.nist.gov/vuln/detail/CVE-2015-5312
bugzilla.redhat.com/show_bug.cgi WEB
https://bugzilla.redhat.com/show_bug.cgi?id=1276693
git.gnome.org/browse/libxml2/comm... WEB
https://git.gnome.org/browse/libxml2/commit/?id=69030714cde66d525a8884bda01b9e8f0abf8e1e
Nokogiri Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2015-5312.yml
groups.google.com/forum/ WEB
https://groups.google.com/forum/#!topic/ruby-security-ann/aSbgDiwb24s
h20566.www2.hpe.com/portal/site/hpsc/pu... WEB
https://h20566.www2.hpe.com/portal/site/hpsc/public/kb/docDisplay?docId=emr_na-c04944172
Nokogiri Security Information SECURITY
https://security.gentoo.org/glsa/201701-37
support.apple.com/ht206166 WEB
https://support.apple.com/HT206166
support.apple.com/ht206167 WEB
https://support.apple.com/HT206167
support.apple.com/ht206168 WEB
https://support.apple.com/HT206168
support.apple.com/ht206169 WEB
https://support.apple.com/HT206169
Nokogiri Security Information SECURITY
http://lists.apple.com/archives/security-announce/2016/Mar/msg00000.html
lists.opensuse.org/opensuse-updates/20... WEB
http://lists.opensuse.org/opensuse-updates/2015-12/msg00120.html
lists.opensuse.org/opensuse-updates/20... WEB
http://lists.opensuse.org/opensuse-updates/2016-01/msg00031.html
marc.info/ WEB
http://marc.info/?l=bugtraq&m=145382616617563&w=2
rhn.redhat.com/errata/rhsa-2015-25... WEB
http://rhn.redhat.com/errata/RHSA-2015-2549.html
rhn.redhat.com/errata/rhsa-2015-25... WEB
http://rhn.redhat.com/errata/RHSA-2015-2550.html
Nokogiri Security Information SECURITY
http://www.debian.org/security/2015/dsa-3430
Nokogiri Security Information SECURITY
http://www.oracle.com/technetwork/topics/security/bulletinjan2016-2867206.html
Nokogiri Security Information SECURITY
http://www.oracle.com/technetwork/topics/security/linuxbulletinoct2015-2719645.html
www.ubuntu.com/usn/usn-2834-1 WEB
http://www.ubuntu.com/usn/USN-2834-1
xmlsoft.org/news.html WEB
http://xmlsoft.org/news.html

Frequently Asked Questions

What is CVE-2015-5312?
CVE-2015-5312 is a security vulnerability in Nokogiri involving Nokogiri subject to DoS via libxml2 vulnerability under CWE-400: Uncontrolled Resource Consumption.
Which Nokogiri versions are affected?
Affected versions include releases prior to 1.6.7.1 across affected packages: nokogiri.
What version fixes CVE-2015-5312?
Upgrading to 1.6.7.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nokogiri affected?
Yes, nokogiri is affected in releases prior to 1.6.7.1. Upgrade your dependency to 1.6.7.1 or later.
What CWE is associated with CVE-2015-5312?
CVE-2015-5312 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check RubyGems dependencies for CVE-2015-5312?
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-xjqg-9jvg-fgx2",
  "modified" : "2023-03-13T23:53:36Z",
  "published" : "2018-08-21T19:03:04Z",
  "aliases" : [ "CVE-2015-5312" ],
  "summary" : "Nokogiri subject to DoS via libxml2 vulnerability",
  "details" : "The xmlStringLenDecodeEntities function in parser.c in libxml2 before 2.9.3 (as used in nokogiri before 1.6.7.1) does not properly prevent entity expansion, which allows context-dependent attackers to cause a denial of service (CPU consumption) via crafted XML data, a different vulnerability than CVE-2014-3660.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "nokogiri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.6.0"
      }, {
        "fixed" : "1.6.7.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.6.7.0"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2015-5312"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1276693"
  }, {
    "type" : "WEB",
    "url" : "https://git.gnome.org/browse/libxml2/commit/?id=69030714cde66d525a8884bda01b9e8f0abf8e1e"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2015-5312.yml"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/forum/#!topic/ruby-security-ann/aSbgDiwb24s"
  }, {
    "type" : "WEB",
    "url" : "https://h20566.www2.hpe.com/portal/site/hpsc/public/kb/docDisplay?docId=emr_na-c04944172"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/201701-37"
  }, {
    "type" : "WEB",
    "url" : "https://support.apple.com/HT206166"
  }, {
    "type" : "WEB",
    "url" : "https://support.apple.com/HT206167"
  }, {
    "type" : "WEB",
    "url" : "https://support.apple.com/HT206168"
  }, {
    "type" : "WEB",
    "url" : "https://support.apple.com/HT206169"
  }, {
    "type" : "WEB",
    "url" : "http://lists.apple.com/archives/security-announce/2016/Mar/msg00000.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-updates/2015-12/msg00120.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-updates/2016-01/msg00031.html"
  }, {
    "type" : "WEB",
    "url" : "http://marc.info/?l=bugtraq&m=145382616617563&w=2"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2015-2549.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2015-2550.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.debian.org/security/2015/dsa-3430"
  }, {
    "type" : "WEB",
    "url" : "http://www.oracle.com/technetwork/topics/security/bulletinjan2016-2867206.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.oracle.com/technetwork/topics/security/linuxbulletinoct2015-2719645.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.ubuntu.com/usn/USN-2834-1"
  }, {
    "type" : "WEB",
    "url" : "http://xmlsoft.org/news.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T22:03:39Z",
    "nvd_published_at" : null
  }
}