CVE-2021-3537: Nokogiri Nokogiri Implements Libxml2 Version Vulnerable Vulnerability

MODERATE
Advisory Identifier: GHSA-286v-pcf5-25rc
CVSS 5.9
CWE-476
Published
Advisory Summary

CVE-2021-3537 is a MODERATE (CVSS 5.9) nokogiri implements libxml2 version vulnerable vulnerability (CWE-476: NULL Pointer Dereference) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves nokogiri implements libxml2 version vulnerable to null pointer dereferencing. Remediation is available by upgrading affected packages to version 1.11.4.

CVE-2021-3537 at a Glance

CVE Identifier CVE-2021-3537
GHSA Identifier GHSA-286v-pcf5-25rc
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-476: NULL Pointer Dereference
Affected Product Nokogiri
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
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-2021-3537

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.11.4
Upgrade nokogiri to 1.11.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-2021-3537, 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.11.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-476: NULL Pointer Dereference, where the product dereferences a pointer that it expects to be valid but is null. 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

A vulnerability found in libxml2 in versions before 2.9.11 shows that it did not propagate errors while parsing XML mixed content, causing a NULL dereference. If an untrusted XML document was parsed in recovery mode and post-validated, the flaw could be used to crash the application. The highest threat from this vulnerability is to system availability.

CVE-2021-3537 Affected Nokogiri Versions

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

References

NVD — CVE-2021-3537 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-3537
bugzilla.redhat.com/show_bug.cgi WEB
https://bugzilla.redhat.com/show_bug.cgi?id=1956522
Nokogiri Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2021-3537.yml
Nokogiri Source Repository REPOSITORY
https://github.com/sparklemotion/nokogiri
Nokogiri Source Repository REPOSITORY
https://github.com/sparklemotion/nokogiri/blob/2edbbef95f1dc12c1ddc5ebda71b9159026245fe/CHANGELOG.md?plain=1#L722
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2021/05/msg00008.html
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BZOMV5J4PMZAORVT64BKLV6YIZAFDGX6
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QVM4UJ3376I6ZVOYMHBNX4GY3NIV52WV
Nokogiri Security Information SECURITY
https://nokogiri.org/CHANGELOG.html#1114-2021-05-14
Nokogiri Security Information SECURITY
https://security.gentoo.org/glsa/202107-05
Nokogiri Security Information SECURITY
https://security.netapp.com/advisory/ntap-20210625-0002
Nokogiri Security Information SECURITY
https://www.oracle.com/security-alerts/cpuapr2022.html
Nokogiri Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html
Nokogiri Security Information SECURITY
https://www.oracle.com/security-alerts/cpuoct2021.html

Frequently Asked Questions

What is CVE-2021-3537?
CVE-2021-3537 is a security vulnerability in Nokogiri involving Nokogiri Implements libxml2 version vulnerable to null pointer dereferencing under CWE-476: NULL Pointer Dereference.
Which Nokogiri versions are affected?
Affected versions include releases prior to 1.11.4 across affected packages: nokogiri.
What version fixes CVE-2021-3537?
Upgrading to 1.11.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.11.4. Upgrade your dependency to 1.11.4 or later.
What is the CVSS score of CVE-2021-3537?
CVE-2021-3537 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-3537?
CVE-2021-3537 is classified under CWE-476: NULL Pointer Dereference (The product dereferences a pointer that it expects to be valid but is NULL.).
How can I check RubyGems dependencies for CVE-2021-3537?
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-286v-pcf5-25rc",
  "modified" : "2023-07-10T13:02:03Z",
  "published" : "2022-05-24T19:02:26Z",
  "aliases" : [ "CVE-2021-3537" ],
  "summary" : "Nokogiri Implements libxml2 version vulnerable to null pointer dereferencing",
  "details" : "A vulnerability found in libxml2 in versions before 2.9.11 shows that it did not propagate errors while parsing XML mixed content, causing a NULL dereference. If an untrusted XML document was parsed in recovery mode and post-validated, the flaw could be used to crash the application. The highest threat from this vulnerability is to system availability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/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.11.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-3537"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1956522"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2021-3537.yml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sparklemotion/nokogiri"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sparklemotion/nokogiri/blob/2edbbef95f1dc12c1ddc5ebda71b9159026245fe/CHANGELOG.md?plain=1#L722"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2021/05/msg00008.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BZOMV5J4PMZAORVT64BKLV6YIZAFDGX6"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QVM4UJ3376I6ZVOYMHBNX4GY3NIV52WV"
  }, {
    "type" : "WEB",
    "url" : "https://nokogiri.org/CHANGELOG.html#1114-2021-05-14"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202107-05"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20210625-0002"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuoct2021.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-476" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-07-05T21:11:25Z",
    "nvd_published_at" : "2021-05-14T20:15:00Z"
  }
}