CVE-2020-7595: Nokogiri Libxml As Used Vulnerability

HIGH
Advisory Identifier: GHSA-7553-jr98-vx47
CVSS 7.5
CWE-835
Published
Advisory Summary

CVE-2020-7595 is a HIGH (CVSS 7.5) libxml as used vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves libxml as used in nokogiri has an infinite loop in a certain end-of-file situation. Remediation is available by upgrading affected packages to version 1.10.8.

CVE-2020-7595 at a Glance

CVE Identifier CVE-2020-7595
GHSA Identifier GHSA-7553-jr98-vx47
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
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-2020-7595

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.10.8
Upgrade nokogiri to 1.10.8
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-2020-7595, 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.10.8), 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-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. 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

xmlStringLenDecodeEntities in parser.c in libxml2 2.9.10 has an infinite loop in a certain end-of-file situation. The Nokogiri RubyGem has patched its vendored copy of libxml2 in order to prevent this issue from affecting nokogiri.

CVE-2020-7595 Affected Nokogiri Versions

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

References

NVD — CVE-2020-7595 NVD
https://nvd.nist.gov/vuln/detail/CVE-2020-7595
Nokogiri Source Repository REPOSITORY
https://github.com/sparklemotion/nokogiri/issues/1992
Nokogiri Security Information SECURITY
https://www.oracle.com/security-alerts/cpuoct2021.html
Nokogiri Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html
Nokogiri Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2020.html
Nokogiri Security Information SECURITY
https://www.oracle.com/security-alerts/cpuapr2022.html
usn.ubuntu.com/4274-1 WEB
https://usn.ubuntu.com/4274-1
us-cert.cisa.gov/ics/advisories/icsa... WEB
https://us-cert.cisa.gov/ics/advisories/icsa-21-103-08
Nokogiri Security Information SECURITY
https://security.netapp.com/advisory/ntap-20200702-0005
Nokogiri Security Information SECURITY
https://security.gentoo.org/glsa/202010-04
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/JDPF3AAVKUAKDYFMFKSIQSVVS3EEFPQH
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5R55ZR52RMBX24TQTWHCIWKJVRV6YAWI
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/545SPOI3ZPPNPX4TFRIVE4JVRTJRKULL
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2020/09/msg00009.html
gitlab.gnome.org/gnome/libxml2/commi... WEB
https://gitlab.gnome.org/GNOME/libxml2/commit/0e1a49c89076
Nokogiri Source Repository REPOSITORY
https://github.com/sparklemotion/nokogiri
Nokogiri Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2020-7595.yml
cert-portal.siemens.com/productcert/pdf/ssa... WEB
https://cert-portal.siemens.com/productcert/pdf/ssa-292794.pdf
Nokogiri Security Information SECURITY
http://lists.opensuse.org/opensuse-security-announce/2020-05/msg00047.html

Frequently Asked Questions

What is CVE-2020-7595?
CVE-2020-7595 is a security vulnerability in Nokogiri involving libxml as used in Nokogiri has an infinite loop in a certain end-of-file situation under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Nokogiri versions are affected?
Affected versions include releases prior to 1.10.8 across affected packages: nokogiri.
What version fixes CVE-2020-7595?
Upgrading to 1.10.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nokogiri affected?
Yes, nokogiri is affected in releases prior to 1.10.8. Upgrade your dependency to 1.10.8 or later.
What is the CVSS score of CVE-2020-7595?
CVE-2020-7595 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-2020-7595?
CVE-2020-7595 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check RubyGems dependencies for CVE-2020-7595?
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-7553-jr98-vx47",
  "modified" : "2022-04-22T17:29:45Z",
  "published" : "2020-02-24T19:12:36Z",
  "aliases" : [ "CVE-2020-7595" ],
  "summary" : "libxml as used in Nokogiri has an infinite loop in a certain end-of-file situation",
  "details" : "xmlStringLenDecodeEntities in parser.c in libxml2 2.9.10 has an infinite loop in a certain end-of-file situation.\nThe Nokogiri RubyGem has patched its vendored copy of libxml2 in order to prevent this issue from affecting nokogiri.",
  "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.10.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7595"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sparklemotion/nokogiri/issues/1992"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuoct2021.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2020.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/4274-1"
  }, {
    "type" : "WEB",
    "url" : "https://us-cert.cisa.gov/ics/advisories/icsa-21-103-08"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20200702-0005"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202010-04"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/JDPF3AAVKUAKDYFMFKSIQSVVS3EEFPQH"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5R55ZR52RMBX24TQTWHCIWKJVRV6YAWI"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/545SPOI3ZPPNPX4TFRIVE4JVRTJRKULL"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2020/09/msg00009.html"
  }, {
    "type" : "WEB",
    "url" : "https://gitlab.gnome.org/GNOME/libxml2/commit/0e1a49c89076"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sparklemotion/nokogiri"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2020-7595.yml"
  }, {
    "type" : "WEB",
    "url" : "https://cert-portal.siemens.com/productcert/pdf/ssa-292794.pdf"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2020-05/msg00047.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-02-18T18:58:16Z",
    "nvd_published_at" : "2020-01-21T23:15:00Z"
  }
}