This release fixes a stored XSS vulnerability that affects sites where users who aren’t fully trusted can upload media (Authors by default, or Editors and Admins on multisite).
Security
- Stored XSS via
javascript:URLs split by control characters (GHSA-mq5f-h28m-xr5r). Browsers strip tabs and newlines from URLs, sohref="java	script:…"passed validation and ran as JavaScript. Any user who can upload media could store a script that runs for anyone who opens the SVG’s URL directly. Fixed in #3.
Updating doesn’t re-check SVGs already in the media library. Review SVGs uploaded while 1.0.1 or earlier was active, especially by users below the Editor role.
Hardening
- SVGs are rejected when a check can’t run (such as at the PCRE backtrack limit), instead of passing (#5)
- Attributes, event handlers and elements are checked in the parsed document, not only with regular expressions (#3, #5)
- The 5MB limit and SVG checks apply on every upload path (sideloads, XML-RPC, importers, files sent without a type) and to the file as stored (#6)
- Large files validate with flat memory and stay fast without PCRE JIT, and libxml’s limits on oversized and deeply nested documents apply again (#6)
Fixes
- SVG uploads work with stream-wrapped storage such as S3 Uploads (
s3://); they previously failed with “Invalid file path” (#4) - Harmless attributes like
data-onclickanddescriptionare no longer rejected (#3, #5) - The file extension check is case-insensitive (#6)
Newly rejected
SVGs with any of these were accepted before and are now rejected:
- A doctype, or processing instructions other than XMP’s
xpacket - A root element other than
svgin the SVG namespace foreignObject, or XHTML, MathML or XSLT elementsdata:image/svg+xmlURLs- Content that doesn’t parse as XML
An SVG over 5MB, or one that can’t be read, now stops an XML-RPC upload or an import run with an error instead of being added.
Full Changelog: Comparing v1.0.1...v1.0.2 · roots/allow-svg · GitHub