CVE-2018-3740: Sanitize vulnerable to Improper Input Validation and Cross-site Scripting
7.5
CVSS Score
3.0
Basic Information
CVE ID
GHSA ID
EPSS Score
0.4842%
CWE
Published
3/21/2018
Updated
1/23/2023
KEV Status
No
Technology
Ruby
Technical Details
CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
sanitize | rubygems | >= 3.0.0, < 4.6.3 | 4.6.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from libxml2's handling of comments in attributes not being properly escaped, which Sanitize's CleanElement transformer didn't account for. The patch adds explicit escaping for these attributes. The vulnerable function is the attribute processing loop in CleanElement#call, which prior to 4.6.3 didn't include the gsub replacement for spaces and quotes in affected attributes. The commit diff clearly shows the addition of UNSAFE_LIBXML_ESCAPE_REGEX and UNSAFE_LIBXML_ESCAPE_CHARS handling in this function, confirming this was the missing security measure.