Miggo Logo

CVE-2021-3537: Nokogiri Implements libxml2 version vulnerable to null pointer dereferencing

5.9

CVSS Score
3.1

Basic Information

EPSS Score
0.33055%
Published
5/24/2022
Updated
7/10/2023
KEV Status
No
Technology
TechnologyRuby

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
nokogirirubygems< 1.11.41.11.4

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability (CVE-2021-3537) resides in the libxml2 C library, specifically in versions prior to 2.9.11, when parsing XML mixed content in recovery mode. Nokogiri bundles libxml2, and versions of Nokogiri using a vulnerable libxml2 (e.g., 2.9.10) are affected. The provided commit 9b90a8854f74b5f672a437ba0043a503bc259d1b explicitly upgrades libxml2 from 2.9.10 to 2.9.12, which patches this vulnerability. The identified Nokogiri functions, Nokogiri::XML::Document.parse and Nokogiri.XML, are the primary Ruby API entry points for parsing XML documents. These functions allow users to specify parse options, including recovery mode (Nokogiri::XML::ParseOptions::RECOVER). When these functions are invoked with recovery mode enabled on a version of Nokogiri that includes the vulnerable libxml2, they pass the input to the underlying vulnerable C code, potentially triggering the NULL pointer dereference and application crash. Therefore, these Nokogiri functions would appear in a runtime profile during the exploitation of this vulnerability.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

* vuln*r**ility *oun* in li*xml* in v*rsions ***or* *.*.** s*ows t**t it *i* not prop***t* *rrors w*il* p*rsin* XML mix** *ont*nt, **usin* * NULL **r***r*n**. I* *n untrust** XML *o*um*nt w*s p*rs** in r**ov*ry mo** *n* post-v*li**t**, t** *l*w *oul*

Reasoning

T** vuln*r**ility (*V*-****-****) r*si**s in t** li*xml* * li*r*ry, sp**i*i**lly in v*rsions prior to *.*.**, w**n p*rsin* XML mix** *ont*nt in r**ov*ry mo**. Noko*iri *un*l*s li*xml*, *n* v*rsions o* Noko*iri usin* * vuln*r**l* li*xml* (*.*., *.*.**