This issue has been created
There are 2 updates.
 
 
XWiki Commons / cid:jira-generated-image-avatar-3c8e9dc5-2b04-47ed-b652-a4cfb093a3c6 XCOMMONS-3868 Open

The namespace handling of the HTML sanitizer doesn't match browsers inside HTML integration points

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-a53ba649-d2cc-4d9b-945e-af5f99081e81 Michael Hamann created this issue on 02/Nov/26 10:40
 
Summary: The namespace handling of the HTML sanitizer doesn't match browsers inside HTML integration points
Issue Type: cid:jira-generated-image-avatar-3c8e9dc5-2b04-47ed-b652-a4cfb093a3c6 Bug
Affects Versions: 14.6-rc-1
Assignee: Unassigned
Components: XML
Created: 02/Nov/26 10:40
Priority: cid:jira-generated-image-static-major-42ece802-3283-45c5-8565-72165e71c47e Major
Reporter: Michael Hamann
Description:

In restricted HTML cleaning, the sanitizer computes the namespace of each element (HTML, SVG or MathML) to decide which elements are allowed where. Below an HTML integration point, this computation doesn't match what browsers do:

  • Inside the SVG desc and title elements, browsers parse every child element as HTML except svg and math. The sanitizer treats any SVG element there, e.g., g, circle or title, as an SVG element.
  • Inside the MathML mi, mo, mn, ms and mtext elements, browsers parse every child element as HTML except mglyph and malignmark. The sanitizer treats any MathML element there as a MathML element.

For example, for <svg><desc><g><title>...</title></g></desc></svg> the sanitizer allows HTML content inside the title element as it considers it an SVG title, while the browser creates an HTML g and an HTML title whose content is text. No case was found where this makes the output unsafe, but the sanitizer's checks are only reliable when they match the browser's parsing.

In addition, DOMPurify, which the sanitizer is based on, no longer treats SVG desc and title (since 3.1.2) and foreignObject (since 3.1.7) as HTML integration points, as a hardening against mutation XSS. HTML content in these elements has hardly any use, as they contain alternative text.

The namespace computation should follow the browser's parsing rules, and HTML content inside SVG desc and title should be removed as in DOMPurify.

 
 

2 updates

 
cid:jira-generated-image-avatar-a53ba649-d2cc-4d9b-945e-af5f99081e81 Changes by Michael Hamann on 02/Nov/26 10:40
 
Fix Version: 18.10.0-rc-1
Assignee: Michael Hamann