NIST deprecates RSA-2048 from 2030. Find every one of them before attackers do.
💎
💎 RubyGems
Not in CISA KEV
HIGH severity

CVE-2018-3740 — sanitize

HIGHFix: rgrove/sanitize@01629a1

CVE-2018-3740 is a high-severity (CVSS 7.5) Cross-site Scripting (XSS) vulnerability in sanitize. A fix is available for sanitize — see the affected versions and patch details below.

Sanitize vulnerable to Improper Input Validation and Cross-site Scripting

Also known asGHSA-7f42-p84j-f58p
Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Oct 29, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

EPSS Exploitation Probability

via FIRST.org ↗
1.5%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs74th percentile — riskier than 74% of all scored CVEsHighest risk
0.00%0.67%1.35%2.02%0.3%1.5%Apr 26Aug 26Oct 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

Where this sits among everything scored

Real-World Exposure

1 pkg affected
💎sanitize

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects RubyGems packages — download data is not available via public APIs for these ecosystems.

Description

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.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
💎RubyGemssanitize≥ 3.0.0&&< 4.6.34.6.3bundle update sanitize --conservative

Affected Products

1 product · 1 configurations
Application
sanitizesanitize_project
≤ 4.6.0
range

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for sanitize, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update sanitize to 4.6.3 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2018-3740 is resolved across your whole dependency graph.

  3. Workarounds

    Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.

Frequently Asked Questions

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.
O3 Security · Impact-Aware SCA

Is CVE-2018-3740 in your dependencies?

Find it across RubyGems, including transitive dependencies.

CVE-2018-3740: sanitize XSS — Fixed in 4.6.3