XSS Vulnerability in python-lxml's clean module

py3-lxml Updated 02 Oct 2025

Summary

03/12/2020
N/A
Yes i
Medium
6.1

CVE-2020-27783: A XSS vulnerability was discovered in python-lxml's clean module. Affects py3-lxml versions < 4.6.2-r0. Fixed in 4.6.2-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

python-lxml is a Python library that provides a Pythonic binding for the C libraries libxml2 and libxslt. It allows developers to work with XML and HTML files, providing a powerful and efficient way to parse, manipulate, and generate XML and HTML content. The clean module in python-lxml is responsible for sanitizing HTML input to prevent cross-site scripting (XSS) attacks.

Vulnerability Detail

A cross-site scripting (XSS) vulnerability (CVE-2020-27783) was discovered in python-lxml's clean module. The module's parser did not properly imitate browsers, resulting in different behaviors between the sanitizer and the user's page. This flaw could be exploited by a remote attacker to inject and execute arbitrary HTML/JS code on the target system. The vulnerability has a CVSS score of 6.1, indicating a moderate severity.

How To Fix

Minimum fixed version

4.6.2-r0

This is the first release that contains the fix.

sudo apk add --upgrade py3-lxml

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is essential to apply the recommended fix by updating the python-lxml package to the latest version.

Conclusion

The XSS vulnerability in python-lxml's clean module can be exploited by a remote attacker to inject and execute arbitrary HTML/JS code. It is crucial to update the python-lxml package to the latest version (4.6.2-r0 or later) to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for py3-lxml →

Share this vulnerability

FAQ

python-lxml is a Python library that provides a Pythonic binding for the C libraries libxml2 and libxslt. It allows developers to work with XML and HTML files, providing a powerful and efficient way to parse, manipulate, and generate XML and HTML content.

Cross-site scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users. This can lead to unauthorized access, data theft, and other malicious activities.

The XSS vulnerability in python-lxml's clean module is due to the module's parser not properly imitating browsers. This results in different behaviors between the sanitizer and the user's page, allowing a remote attacker to inject and execute arbitrary HTML/JS code.

The impact of this vulnerability is that a remote attacker can inject and execute arbitrary HTML/JS code on the target system. This can lead to various malicious activities, such as stealing sensitive information, performing unauthorized actions, or defacing websites.

To fix this vulnerability, update the python-lxml package to version 4.6.2-r0 or later. This can be done by using the package manager or manually installing the updated version from the official python-lxml repository.

Related vulnerabilities

Recent vulnerabilities recorded for py3-lxml.

How To Fix

Minimum fixed version

4.6.2-r0

This is the first release that contains the fix.

sudo apk add --upgrade py3-lxml

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback