CVE-2014-3146
Medium · 6.1CVSS
6.1
EPSS
6.3%
Published
May 14, 2014
CISA due date
—
Cloudanix analysis
A flaw in an HTML cleaning library lets attackers slip malicious code into web pages that should have been made safe, potentially exposing users who view the content.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Data Tampering
- Component
- Library
- Class
- XSS
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The lxml.html.clean module's clean_html function fails to sanitize control characters embedded in link schemes due to an incomplete blacklist, allowing crafted HTML to bypass sanitization and execute arbitrary JavaScript in the context of the rendered page.
Why it matters to the business
Attackers can inject scripts that steal user data, hijack sessions, or deface content when users view sanitized but still vulnerable HTML output from affected applications.
How an attack unfolds
An attacker supplies HTML containing a link element whose href scheme includes control characters to the clean_html function; the incomplete blacklist permits the payload to survive sanitization and render as executable script in victim browsers.
How to fix it
Upgrade lxml to version 3.3.5 or later; after upgrade, re-test all code paths that invoke clean_html on external or user-supplied content.
How to confirm the fix worked
Confirm installed lxml version is at least 3.3.5; run unit tests that feed control-character link schemes to clean_html and verify the output no longer contains executable script tags.
Typical attack path
- Identify an application endpoint that passes untrusted HTML through lxml.html.clean.clean_html
- Craft a link element with a scheme containing ASCII control characters that evades the blacklist
- Submit the payload via user-controlled input or stored content
- Victim browser renders the unsanitized output and executes the injected script
How to detect it
Review application logs for calls to clean_html receiving link schemes that contain non-printable characters; examine web server access logs for requests carrying unusual href values with control characters.
What your security team should do
- Immediately update lxml to 3.3.5+ in all environments
- Audit code for direct or indirect calls to clean_html on untrusted data
- Add automated dependency scanning to prevent future outdated lxml deployments
The record
Incomplete blacklist vulnerability in the lxml.html.clean module in lxml before 3.3.5 allows remote attackers to conduct cross-site scripting (XSS) attacks via control characters in the link scheme to the clean_html function.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| PyPI | lxml | 0 | 3.3.5 |
| Debian:11 | lxml | 0 | 3.3.5-1 |
| Debian:12 | lxml | 0 | 3.3.5-1 |
| Debian:13 | lxml | 0 | 3.3.5-1 |
| Debian:6.0 | lxml | 0 | 2.2.8-2+deb6u1 |
| Debian:7 | lxml | 0 | 2.3.2-1+deb7u1 |
| Mageia:3 | python-lxml | 0 | 3.0.1-2.1.mga3 |
| Mageia:4 | python-lxml | 0 | 3.2.4-1.1.mga4 |
| Ubuntu:14.04:LTS | lxml | 0 | 3.3.3-1ubuntu0.1 |