CVE-2018-3740
Sanitize vulnerable to Improper Input Validation and Cross-site Scripting
A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- High
- Availability
- None
Exploit likelihood
What each source reports
NVD Score used
7.5
A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.
- Record
CVE-2018-3740- CVSS 3.0
- 7.5 High
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - CVSS 2.0
- 5.0 Medium
AV:N/AC:L/Au:N/C:N/I:P/A:N - Weakness
- CWE-79, CWE-20
- Updated
- 2026-11-02
CVE List No score
A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.
- Record
CVE-2018-3740- Weakness
- CWE-79
- Updated
- 2026-11-02
EUVDEUVD-2018-0174 No score
A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.
- Record
EUVD-2018-0174- Updated
- 2026-11-03
GitHub AdvisoriesGHSA-7f42-p84j-f58p
7.5
Sanitize vulnerable to Improper Input Validation and Cross-site Scripting
When Sanitize <= 4.6.2 is used in combination with libxml2 >= 2.9.2, a specially crafted HTML fragment can cause libxml2 to generate improperly escaped output, allowing non-whitelisted attributes to be used on whitelisted elements.
This can allow HTML and JavaScript injection, which could result in XSS if Sanitize's output is served to browsers.
- Record
GHSA-7f42-p84j-f58p- CVSS 3.0
- 7.5 High
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Weakness
- CWE-20, CWE-79
- Updated
- 2026-11-02
OSV
7.5
A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.
- Record
CVE-2018-3740- CVSS 3.0
- 7.5 High
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
OSVDEBIAN-CVE-2018-3740
7.5
A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.
- Record
DEBIAN-CVE-2018-3740- CVSS 3.0
- 7.5 High
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
OSVGHSA-7f42-p84j-f58p
7.5
Sanitize vulnerable to Improper Input Validation and Cross-site Scripting
When Sanitize <= 4.6.2 is used in combination with libxml2 >= 2.9.2, a specially crafted HTML fragment can cause libxml2 to generate improperly escaped output, allowing non-whitelisted attributes to be used on whitelisted elements.
This can allow HTML and JavaScript injection, which could result in XSS if Sanitize's output is served to browsers.
- Record
GHSA-7f42-p84j-f58p- CVSS 3.0
- 7.5 High
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Weakness
- CWE-20, CWE-79
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2018-3740
7.5
A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.
- Record
UBUNTU-CVE-2018-3740- CVSS 3.0
- 7.5 High
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
sanitizeRubyGems |
3.0.0 up to 4.6.3 | 4.6.3 |
ruby-sanitizeDebian:12 |
before 4.6.6-1 | 4.6.6-1 |
ruby-sanitizeDebian:13 |
before 4.6.6-1 | 4.6.6-1 |
ruby-sanitizeDebian:14 |
before 4.6.6-1 | 4.6.6-1 |
ruby-sanitizeDebian:9 |
before 2.1.0-2+deb9u1, plus listed versions 2.1.0-2 |
2.1.0-2+deb9u1 |
sanitizeRubyGems |
3.0.0 up to 4.6.3, plus listed versions 3.0.13.0.23.0.33.0.43.1.0 Show 12 moreShow less3.1.13.1.24.0.04.0.14.1.04.2.04.3.04.4.04.5.04.6.04.6.14.6.2 |
4.6.3 |
ruby-sanitizeUbuntu:16.04:LTS |
before 2.1.0-2+deb9u1build0.16.04.1, plus listed versions 2.1.0-12.1.0-2 |
2.1.0-2+deb9u1build0.16.04.1 |
ruby-sanitizeUbuntu:18.04:LTS |
before 2.1.0-2+deb9u1build0.18.04.1, plus listed versions 2.1.0-2 |
2.1.0-2+deb9u1build0.18.04.1 |
History
| Recorded | Changed | Sources |
|---|---|---|
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2018-3740 is a high vulnerability (CVSS 7.5) in Sanitize Project Sanitize, published March 21, 2018. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.47%, the 73rd percentile. Fixed in sanitize 4.6.3.
References
debian.org/security/2018/dsa-4358
github.com/rgrove/sanitize/issues/176
about.gitlab.com/2018/06/25/security-release-gitlab-11-dot-0-dot-1-released
github.com/rgrove/sanitize/commit/01629a162e448a83d901456d0ba8b65f3b03d46e
nvd.nist.gov/vuln/detail/CVE-2018-3740
github.com/rgrove/sanitize/commit/93feeb38e21864146bb29191792b971dbe1ec62e