CVE-2016-4658: Nokogiri Nokogiri Does Not Forbid Namespace Vulnerability
CRITICALCVE-2016-4658 is a CRITICAL (CVSS 9.8) nokogiri does not forbid namespace vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves nokogiri does not forbid namespace nodes in xpointer ranges. Remediation is available by upgrading affected packages to version 1.7.1.
CVE-2016-4658 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2016-4658
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.
Upgrade nokogiri to 1.7.1
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-2016-4658, 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.7.1), 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
CVE-2016-4658 Affected Nokogiri Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
nokogiri
|
RubyGems |
< 1.7.1
|
1.7.1
|
References
Frequently Asked Questions
What is CVE-2016-4658?
Which Nokogiri versions are affected?
What version fixes CVE-2016-4658?
Is nokogiri affected?
What is the CVSS score of CVE-2016-4658?
What CWE is associated with CVE-2016-4658?
How can I check RubyGems dependencies for CVE-2016-4658?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-fr52-4hqw-p27f",
"modified" : "2022-04-26T18:24:04Z",
"published" : "2018-08-21T19:03:26Z",
"aliases" : [ "CVE-2016-4658" ],
"summary" : "Nokogiri does not forbid namespace nodes in XPointer ranges",
"details" : "xpointer.c in libxml2 before 2.9.5 (as used in nokogiri before 1.7.1 amongst other products) does not forbid namespace nodes in XPointer ranges, which allows remote attackers to execute arbitrary code or cause a denial of service (use-after-free and memory corruption) via a crafted XML document.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "nokogiri"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.7.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-4658"
}, {
"type" : "WEB",
"url" : "https://git.gnome.org/browse/libxml2/commit/?id=c1d1f7121194036608bf555f08d3062a36fd344b"
}, {
"type" : "WEB",
"url" : "https://security.gentoo.org/glsa/201701-37"
}, {
"type" : "WEB",
"url" : "https://support.apple.com/HT207141"
}, {
"type" : "WEB",
"url" : "https://support.apple.com/HT207142"
}, {
"type" : "WEB",
"url" : "https://support.apple.com/HT207143"
}, {
"type" : "WEB",
"url" : "https://support.apple.com/HT207170"
}, {
"type" : "WEB",
"url" : "http://lists.apple.com/archives/security-announce/2016/Sep/msg00006.html"
}, {
"type" : "WEB",
"url" : "http://lists.apple.com/archives/security-announce/2016/Sep/msg00008.html"
}, {
"type" : "WEB",
"url" : "http://lists.apple.com/archives/security-announce/2016/Sep/msg00010.html"
}, {
"type" : "WEB",
"url" : "http://lists.apple.com/archives/security-announce/2016/Sep/msg00011.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-119" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T21:35:10Z",
"nvd_published_at" : "2016-09-25T10:59:02Z"
}
}