Security advisory
An XSS vulnerability was discovered in python-lxml's clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2021-28957
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 31 Oct 2026, 11:43 UTC · Revision 1
Source evidence
An XSS vulnerability was discovered in python-lxml's clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.
osv:CVE-2021-28957
Complete source record
{
"id": "f9768a7f3169490079395b1460cdcf1f247b6975443551f7713eca4bfee225b7",
"url": "https://osv.dev/vulnerability/CVE-2021-28957",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "CVE-2021-28957",
"summary": "An XSS vulnerability was discovered in python-lxml's clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.",
"evidence": "osv:CVE-2021-28957",
"products": [],
"severity": "medium",
"structured": {
"id": "CVE-2021-28957",
"aliases": [
"CVE-2021-28957",
"GHSA-jq4v-f5q6-mjqq",
"PYSEC-2021-19"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/lxml/lxml",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "a5f9cb52079dc57477c460dbe6ba0f775e14a999"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:lxml:lxml:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "0"
},
{
"fixed": "4.6.3"
}
],
"source": "CPE_RANGE"
},
{
"range": [
{
"fixed": "a5f9cb52079dc57477c460dbe6ba0f775e14a999"
}
],
"source": "REFERENCES_COMMIT"
}
]
}
}
],
"versions": [
"lxml-4.6.2",
"lxml-4.6.1",
"lxml-4.6.0",
"lxml-4.5.2",
"lxml-4.5.1",
"lxml-4.5.0",
"lxml-4.4.1",
"lxml-4.4.0",
"lxml-4.3.2",
"lxml-4.3.1",
"lxml-4.3.0",
"lxml-4.2.2",
"lxml-4.2.1",
"lxml-4.2.0",
"lxml-4.1.1",
"lxml-4.1.0",
"lxml-4.0.0",
"lxml-3.8.0-py27fix",
"lxml-3.8.0",
"lxml-3.7.2",
"lxml-3.7.1",
"lxml-3.7.0",
"lxml-3.6.1",
"lxml-3.6.0",
"lxml-3.5.0",
"lxml-3.5.0b1",
"lxml-3.4.1",
"lxml-3.4.0",
"lxml-3.4.0beta1",
"lxml-3.3.3",
"lxml-3.3.2",
"lxml-3.3.1",
"lxml-3.3.0",
"lxml-3.3.0beta5",
"lxml-3.3.0beta4",
"lxml-3.3.0beta3",
"lxml-3.3.0beta2",
"lxml-3.3.0beta1",
"lxml-3.2.3",
"lxml-3.2.2",
"lxml-3.2.1",
"lxml-3.2.0",
"lxml-3.1.1",
"lxml-3.1.0",
"lxml-3.1beta1",
"lxml-3.0.1",
"lxml-3.0",
"lxml-3.0beta1",
"lxml-3.0alpha2",
"lxml-3.0alpha1",
"lxml-2.3.1",
"lxml-2.3",
"lxml-2.3beta1",
"lxml-2.3alpha2",
"lxml-2.3alpha1",
"lxml-2.2.2",
"lxml-2.2.1",
"lxml-2.2",
"lxml-2.1",
"lxml-2.1beta3",
"lxml-2.1beta2",
"lxml-2.1beta1",
"lxml-2.1alpha1",
"lxml-2.0.1",
"lxml-2.0",
"lxml-2.0beta2",
"lxml-2.0beta1",
"lxml-2.0alpha6",
"lxml-2.0alpha5",
"lxml-2.0alpha4",
"lxml-2.0alpha3",
"lxml-2.0alpha2",
"lxml-2.0alpha1",
"lxml-1.2",
"lxml-1.1",
"lxml-1.1beta",
"lxml-1.1alpha",
"lxml-1.0",
"lxml-1.0.beta",
"lxml-0.9",
"lxml-0.7",
"lxml-0.6",
"lxml-0.5.1"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-28957.json"
}
}
],
"modified": "2026-10-20T10:54:36.472668547Z",
"provider": "osv",
"references": [
"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/3C2R44VDUY7FJVMAVRZ2WY7XYL4SVN45/",
"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/XXN3QPWCTQVOGW4BMWV3AUUZZ4NRZNSQ/",
"https://lists.debian.org/debian-lts-announce/2021/03/msg00031.html",
"https://security.gentoo.org/glsa/202208-06",
"https://security.netapp.com/advisory/ntap-20210521-0004/",
"https://www.debian.org/security/2021/dsa-4880",
"https://bugs.launchpad.net/lxml/+bug/1888153",
"https://github.com/lxml/lxml/commit/a5f9cb52079dc57477c460dbe6ba0f775e14a999",
"https://github.com/lxml/lxml/pull/316/commits/10ec1b4e9f93713513a3264ed6158af22492f270",
"https://www.oracle.com/security-alerts/cpuoct2021.html"
],
"provider_metadata": {
"unresolved_ranges": [
{
"cpes": [
"cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*",
"cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*"
],
"vendor_product": "debian:debian_linux",
"extracted_events": [
{
"range": [
{
"introduced": "9.0"
},
{
"last_affected": "9.0"
},
{
"introduced": "10.0"
},
{
"last_affected": "10.0"
}
],
"source": "CPE_STRING"
}
]
},
{
"cpes": [
"cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*",
"cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*"
],
"vendor_product": "fedoraproject:fedora",
"extracted_events": [
{
"range": [
{
"introduced": "33"
},
{
"last_affected": "33"
},
{
"introduced": "34"
},
{
"last_affected": "34"
}
],
"source": "CPE_STRING"
}
]
},
{
"cpes": [
"cpe:2.3:a:oracle:zfs_storage_appliance_kit:8.8:*:*:*:*:*:*:*"
],
"vendor_product": "oracle:zfs_storage_appliance_kit",
"extracted_events": [
{
"range": [
{
"introduced": "8.8"
},
{
"last_affected": "8.8"
}
],
"source": "CPE_STRING"
}
]
}
]
}
},
"related_cves": [
{
"value": "CVE-2021-28957",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 385714,
"published_at": "2021-03-21T05:15:13.367+00:00"
}