Every CVE Search/ Get API key

CVE-2018-3740

Sanitize vulnerable to Improper Input Validation and Cross-site Scripting

7.5 HighFix available

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

1.47%Up 0.4 points since Apr 14, 2021
90%50%10%1%

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 HighCVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
CVSS 2.0
5.0 MediumAV: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 HighCVSS: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 HighCVSS: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 HighCVSS: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 HighCVSS: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 HighCVSS: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

Affected packages
PackageAffectedFixed
sanitize
RubyGems
3.0.0 up to 4.6.3
4.6.3
ruby-sanitize
Debian:12
before 4.6.6-1
4.6.6-1
ruby-sanitize
Debian:13
before 4.6.6-1
4.6.6-1
ruby-sanitize
Debian:14
before 4.6.6-1
4.6.6-1
ruby-sanitize
Debian:9
before 2.1.0-2+deb9u1, plus listed versions
2.1.0-2
2.1.0-2+deb9u1
sanitize
RubyGems
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 less
3.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-sanitize
Ubuntu: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-sanitize
Ubuntu: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

History
RecordedChangedSources
aliasesEUVD
first indexedCVE 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

Show 6 moreShow less
MoveEnter Open