CVE-2018-25032: Nokogiri Nokogiri Affected By Zlib's Out-of-bounds Vulnerability

HIGH
Advisory Identifier: GHSA-jc36-42cf-vqwj
CVSS 7.5
CWE-787
Published
Advisory Summary

CVE-2018-25032 is a HIGH (CVSS 7.5) nokogiri affected by zlib's out-of-bounds vulnerability (CWE-787: Out-of-bounds Write) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves nokogiri affected by zlib's out-of-bounds write vulnerability. Remediation is available by upgrading affected packages to version 1.13.4.

CVE-2018-25032 at a Glance

CVE Identifier CVE-2018-25032
GHSA Identifier GHSA-jc36-42cf-vqwj
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-787: Out-of-bounds Write
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.1/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-25032

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.13.4
Upgrade nokogiri to 1.13.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 CVE-2018-25032, 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.13.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-787: Out-of-bounds Write, where the product writes data past the end, or before the beginning, of the intended buffer. 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

zlib 1.2.11 allows memory corruption when deflating (i.e., when compressing) if the input has many distant matches.

CVE-2018-25032 Affected Nokogiri Versions

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

References

GitHub Advisory / Wiki ADVISORY
https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-v6gp-9mmm-c6p5
NVD — CVE-2018-25032 NVD
https://nvd.nist.gov/vuln/detail/CVE-2018-25032
Nokogiri Source Repository REPOSITORY
https://github.com/madler/zlib/issues/605
Security Fix Commit FIX COMMIT
https://github.com/madler/zlib/commit/5c44459c3b28a9bd3283aaceab7c615f8020c531
Nokogiri Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html
Nokogiri Security Information SECURITY
https://www.openwall.com/lists/oss-security/2022/03/28/3
Nokogiri Security Information SECURITY
https://www.openwall.com/lists/oss-security/2022/03/28/1
Nokogiri Security Information SECURITY
https://www.openwall.com/lists/oss-security/2022/03/24/1
Nokogiri Security Information SECURITY
https://www.debian.org/security/2022/dsa-5111
support.apple.com/kb/ht213257 WEB
https://support.apple.com/kb/HT213257
support.apple.com/kb/ht213256 WEB
https://support.apple.com/kb/HT213256
support.apple.com/kb/ht213255 WEB
https://support.apple.com/kb/HT213255
Nokogiri Security Information SECURITY
https://security.netapp.com/advisory/ntap-20220729-0004
Nokogiri Security Information SECURITY
https://security.netapp.com/advisory/ntap-20220526-0009
Nokogiri Security Information SECURITY
https://security.gentoo.org/glsa/202210-42
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XOKFMSNQ5D5WGMALBNBXU3GE442V74WU
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VOKNP2L734AEL47NRYGVZIKEFOUBQY5Y
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NS2D2GFPFGOJUL4WQ3DUAY7HF4VWQ77F
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/JZZPTWRYQULAOL3AW7RZJNVZ2UONXCV4
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DF62MVMH3QUGMBDCB3DY2ERQ6EBHTADB
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DCZFIJBJTZ7CL5QXBFKTQ22Q26VINRUF
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2022/09/msg00023.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2022/05/msg00008.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2022/04/msg00000.html
Nokogiri Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2018-25032.yml
Nokogiri Source Repository REPOSITORY
https://github.com/madler/zlib/compare/v1.2.11...v1.2.12
cert-portal.siemens.com/productcert/pdf/ssa... WEB
https://cert-portal.siemens.com/productcert/pdf/ssa-333517.pdf
seclists.org/fulldisclosure/2022... WEB
http://seclists.org/fulldisclosure/2022/May/33
seclists.org/fulldisclosure/2022... WEB
http://seclists.org/fulldisclosure/2022/May/35
seclists.org/fulldisclosure/2022... WEB
http://seclists.org/fulldisclosure/2022/May/38
Nokogiri Security Information SECURITY
http://www.openwall.com/lists/oss-security/2022/03/25/2
Nokogiri Security Information SECURITY
http://www.openwall.com/lists/oss-security/2022/03/26/1

Frequently Asked Questions

What is CVE-2018-25032?
CVE-2018-25032 is a security vulnerability in Nokogiri involving Nokogiri affected by zlib's Out-of-bounds Write vulnerability under CWE-787: Out-of-bounds Write.
Which Nokogiri versions are affected?
Affected versions include releases prior to 1.13.4 across affected packages: nokogiri.
What version fixes CVE-2018-25032?
Upgrading to 1.13.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.13.4. Upgrade your dependency to 1.13.4 or later.
What is the CVSS score of CVE-2018-25032?
CVE-2018-25032 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2018-25032?
CVE-2018-25032 is classified under CWE-787: Out-of-bounds Write (The product writes data past the end, or before the beginning, of the intended buffer.).
How can I check RubyGems dependencies for CVE-2018-25032?
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-jc36-42cf-vqwj",
  "modified" : "2023-06-23T21:37:14Z",
  "published" : "2022-03-26T00:00:33Z",
  "aliases" : [ "CVE-2018-25032" ],
  "summary" : "Nokogiri affected by zlib's Out-of-bounds Write vulnerability",
  "details" : "zlib 1.2.11 allows memory corruption when deflating (i.e., when compressing) if the input has many distant matches.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/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.13.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-v6gp-9mmm-c6p5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-25032"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/madler/zlib/issues/605"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/madler/zlib/commit/5c44459c3b28a9bd3283aaceab7c615f8020c531"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.openwall.com/lists/oss-security/2022/03/28/3"
  }, {
    "type" : "WEB",
    "url" : "https://www.openwall.com/lists/oss-security/2022/03/28/1"
  }, {
    "type" : "WEB",
    "url" : "https://www.openwall.com/lists/oss-security/2022/03/24/1"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2022/dsa-5111"
  }, {
    "type" : "WEB",
    "url" : "https://support.apple.com/kb/HT213257"
  }, {
    "type" : "WEB",
    "url" : "https://support.apple.com/kb/HT213256"
  }, {
    "type" : "WEB",
    "url" : "https://support.apple.com/kb/HT213255"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220729-0004"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220526-0009"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202210-42"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XOKFMSNQ5D5WGMALBNBXU3GE442V74WU"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VOKNP2L734AEL47NRYGVZIKEFOUBQY5Y"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NS2D2GFPFGOJUL4WQ3DUAY7HF4VWQ77F"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/JZZPTWRYQULAOL3AW7RZJNVZ2UONXCV4"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DF62MVMH3QUGMBDCB3DY2ERQ6EBHTADB"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DCZFIJBJTZ7CL5QXBFKTQ22Q26VINRUF"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2022/09/msg00023.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2022/05/msg00008.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2022/04/msg00000.html"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2018-25032.yml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/madler/zlib/compare/v1.2.11...v1.2.12"
  }, {
    "type" : "WEB",
    "url" : "https://cert-portal.siemens.com/productcert/pdf/ssa-333517.pdf"
  }, {
    "type" : "WEB",
    "url" : "http://seclists.org/fulldisclosure/2022/May/33"
  }, {
    "type" : "WEB",
    "url" : "http://seclists.org/fulldisclosure/2022/May/35"
  }, {
    "type" : "WEB",
    "url" : "http://seclists.org/fulldisclosure/2022/May/38"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2022/03/25/2"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2022/03/26/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-787" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-06-23T21:37:14Z",
    "nvd_published_at" : "2022-03-25T09:15:00Z"
  }
}