CVE-2018-3740 Sanitize vulnerable to Improper Input Validation and Cross-site Scripting
Attackers can inject malicious scripts via crafted HTML fragments due to improper attribute sanitization in the Ruby Sanitize gem.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2018-3740?
CVE-2018-3740 is a high-severity cross-site scripting vulnerability in Ryan Grove sanitize (ruby gem), published on 30 Mar 2018. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.
Which versions are affected by CVE-2018-3740?
2 open source packages ship an affected version, including sanitize. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
sanitize RubyGems | From 3.0.0 | 4.6.3 |
sanitize RubyGems | From 3.0.0 | 4.6.3 |
Products include Sanitize Project Sanitize.
How do I fix CVE-2018-3740?
Upgrade sanitize to 4.6.3 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2018-3740 being exploited?
There is no known exploitation of CVE-2018-3740 in the wild and no public exploit code.
Other vulnerabilities in Ryan Grove sanitize (ruby gem)
Sources
Also known as DEBIAN-CVE-2018-3740, DSA-4358-1, GHSA-7f42-p84j-f58p, UBUNTU-CVE-2018-3740.