CVE-2015-7499: Nokogiri Heap-based Buffer Overflow Vulnerability

MODERATE
Advisory Identifier: GHSA-jxjr-5h69-qw3w
CWE-119
Published
Advisory Summary

CVE-2015-7499 is a MODERATE heap-based buffer overflow vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves heap-based buffer overflow in nokogiri. Remediation is available by upgrading affected packages to version 1.6.7.2.

CVE-2015-7499 at a Glance

CVE Identifier CVE-2015-7499
GHSA Identifier GHSA-jxjr-5h69-qw3w
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
Affected Product Nokogiri
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix CVE-2015-7499

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.2
Upgrade nokogiri to 1.6.7.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-2015-7499, 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.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-119: Improper Restriction of Operations within the Bounds of a Memory Buffer, where the product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. this may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data. 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

Heap-based buffer overflow in the xmlGROW function in parser.c in libxml2 before 2.9.3. A remote attacker could provide a specially crafted XML or HTML file that, when processed by an application using libxml2, would cause that application to use an excessive amount of CPU, leak potentially sensitive information, or crash the application.

CVE-2015-7499 Affected Nokogiri Versions

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

References

xmlsoft.org/news.html WEB
http://xmlsoft.org/news.html
NVD — CVE-2015-7499 NVD
https://nvd.nist.gov/vuln/detail/CVE-2015-7499
bugzilla.redhat.com/show_bug.cgi WEB
https://bugzilla.redhat.com/show_bug.cgi?id=1281925
git.gnome.org/browse/libxml2/comm... WEB
https://git.gnome.org/browse/libxml2/commit/?id=28cd9cb747a94483f4aea7f0968d202c20bb4cfc
git.gnome.org/browse/libxml2/comm... WEB
https://git.gnome.org/browse/libxml2/commit/?id=35bcb1d758ed70aa7b257c9c3b3ff55e54e3d0da
GitHub Advisory / Wiki ADVISORY
https://github.com/advisories/GHSA-jxjr-5h69-qw3w
Nokogiri Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2015-7499.yml
groups.google.com/forum/ WEB
https://groups.google.com/forum/#!topic/ruby-security-ann/Dy7YiKb_pMM
Nokogiri Security Information SECURITY
https://security.gentoo.org/glsa/201701-37
Nokogiri Security Information SECURITY
https://web.archive.org/web/20210724022841/http://www.securityfocus.com/bid/79509
Nokogiri Security Information SECURITY
https://web.archive.org/web/20211205133229/https://securitytracker.com/id/1034243
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
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
www.ubuntu.com/usn/usn-2834-1 WEB
http://www.ubuntu.com/usn/USN-2834-1

Frequently Asked Questions

What is CVE-2015-7499?
CVE-2015-7499 is a security vulnerability in Nokogiri involving Heap-based buffer overflow in nokogiri under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
Which Nokogiri versions are affected?
Affected versions include releases prior to 1.6.7.2 across affected packages: nokogiri.
What version fixes CVE-2015-7499?
Upgrading to 1.6.7.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.6.7.2. Upgrade your dependency to 1.6.7.2 or later.
What CWE is associated with CVE-2015-7499?
CVE-2015-7499 is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer (The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.).
How can I check RubyGems dependencies for CVE-2015-7499?
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-jxjr-5h69-qw3w",
  "modified" : "2023-07-05T17:45:36Z",
  "published" : "2018-09-17T21:57:38Z",
  "aliases" : [ "CVE-2015-7499" ],
  "summary" : "Heap-based buffer overflow in nokogiri",
  "details" : "Heap-based buffer overflow in the xmlGROW function in parser.c in libxml2 before 2.9.3.  A remote attacker could provide a specially crafted XML or HTML file that, when processed by an application using libxml2, would cause that application to use an excessive amount of CPU, leak potentially sensitive information, or crash the application.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "nokogiri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.6.0"
      }, {
        "fixed" : "1.6.7.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.6.7.1"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2015-7499"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1281925"
  }, {
    "type" : "WEB",
    "url" : "https://git.gnome.org/browse/libxml2/commit/?id=28cd9cb747a94483f4aea7f0968d202c20bb4cfc"
  }, {
    "type" : "WEB",
    "url" : "https://git.gnome.org/browse/libxml2/commit/?id=35bcb1d758ed70aa7b257c9c3b3ff55e54e3d0da"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-jxjr-5h69-qw3w"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2015-7499.yml"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/forum/#!topic/ruby-security-ann/Dy7YiKb_pMM"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/201701-37"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20210724022841/http://www.securityfocus.com/bid/79509"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20211205133229/https://securitytracker.com/id/1034243"
  }, {
    "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://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.ubuntu.com/usn/USN-2834-1"
  }, {
    "type" : "WEB",
    "url" : "http://xmlsoft.org/news.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:44:24Z",
    "nvd_published_at" : "2015-12-15T21:59:00Z"
  }
}