/

CVE-2026-49825

Severity:

HIGH RISK

(8.2)

Cross-Site Scripting (CWE-79) in lxml HTML Sanitizer

CVE-2026-49825

Awaiting Analysis

Vulnerability type

Category:

Cross-Site Scripting

CWE:

CWE-79, CWE-184

Impact:

Client-Side Script Execution

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A missing xlink:href entry in lxml's HTML link-attribute definitions can allow URL sanitization checks to be bypassed in embedded SVG, MathML, and related content.

When applications rely on affected lxml sanitization behavior and process attacker-controlled markup, unsafe URLs may remain in output and could enable cross-site scripting or related client-side attacks.

Affected context

The issue occurs in applications that use lxml HTML sanitization for untrusted markup containing embedded content such as SVG or MathML. It becomes risky when sanitization decisions depend on the library's link-attribute definitions and the resulting HTML is later rendered by a browser in a security-sensitive context.

Exploit preconditions

  • Attack surface: Application functionality that accepts or transforms attacker-controlled HTML, SVG, MathML, or related embedded markup
  • Required access: Ability to submit or influence content processed by lxml
  • Trigger point: Sanitization or filtering of link attributes before the processed content is rendered
  • Why exploitation is possible: The sanitizer does not account for xlink:href, allowing an unsafe URL in that attribute to evade applicable URL checks

Why this happens

The underlying bug is an incomplete security-relevant attribute definition. Because xlink:href was omitted from lxml's recognized link attributes, sanitization logic could fail to apply URL validation to that attribute.

This maps primarily to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') and relates to CWE-184: Incomplete List of Disallowed Inputs. The insecure pattern is relying on an allowlist or denylist that does not comprehensively cover equivalent attribute forms across supported markup namespaces.

Potential impact

  • An attacker may bypass URL filtering in sanitized embedded content.
  • A browser may interpret the resulting markup in an unsafe way.
  • Applications could expose users to cross-site scripting or related client-side code execution.
  • Session data, page content, or user actions may be exposed depending on browser context and application privileges.

General mitigation guidance

Mitigation generally focuses on complete, context-aware HTML sanitization and reducing trust in user-supplied markup.

Common defensive patterns include:

  • Use maintained sanitization components with comprehensive handling for namespaced and equivalent URL-bearing attributes.
  • Prefer restrictive, schema-aware allowlists over incomplete denylist filtering.
  • Treat SVG, MathML, and other active or embedded markup as separate security contexts.
  • Render untrusted content in appropriately isolated browser contexts where feasible.
  • Apply a restrictive Content Security Policy and avoid granting unnecessary script capabilities.
  • Minimize application and user privileges so any client-side compromise has limited impact.

How teams detect issues like this

Organizations can detect similar issues through:

  • Static analysis and dependency checks for outdated XML or HTML sanitization components.
  • Code review searches for custom attribute allowlists or denylists that omit namespaced URL attributes.
  • Tests containing SVG, MathML, namespace-qualified attributes, and alternate URL-bearing forms.
  • Security regression tests that verify unsafe URLs are removed or neutralized before rendering.
  • Policy enforcement requiring centralized, context-aware sanitization for untrusted markup.

Automated application security and dependency review tools may help identify vulnerable component usage and incomplete filtering patterns.

Sources

SourceLink
github.comgithub.com/fedora-python/lxml_html_clean/commit/322357ac61c6cf80fcbaba53b4e92e31f3ded9f2
github.comgithub.com/fedora-python/lxml_html_clean/releases/tag/0.4.5
github.comgithub.com/fedora-python/lxml_html_clean/security/advisories/GHSA-4jhm-jv67-739f
github.comgithub.com/lxml/lxml/commit/5927a6d5e851845140975d99b65461e255caaab0
github.comgithub.com/lxml/lxml/releases/tag/lxml-6.1.1

Frequently asked

questions

It can be exploitable through an application-facing content submission or processing feature when an attacker can influence markup that is later rendered in a browser. Exploitability depends on the application's rendering context and other browser security controls.

Not necessarily. Authentication requirements depend on whether unauthenticated users can submit content or whether an authenticated account can influence content consumed by other users.

Use a maintained, context-aware HTML sanitizer that recognizes namespaced URL-bearing attributes and applies strict validation before output is rendered.

Maintain comprehensive sanitization test suites, cover SVG and MathML cases, avoid custom incomplete attribute lists, and enforce dependency and security-review policies for content-processing libraries.

Find out what's already
exploitable in your codebase.