SVG Sanitization Bypass for Files Uploaded via Sideloading or the REST API
Description
Safe SVG versions prior to 2.2.6 did not sanitize SVG files uploaded through WordPress's sideload upload path. Safe SVG sanitized SVGs uploaded through the standard media uploader. WordPress also has a second upload path, used when media is sideloaded and when files are uploaded as raw data through the REST API media endpoint, and that path skipped sanitization. Because Safe SVG still allowed the SVG file type, unsanitized SVGs could be uploaded this way.
Impact
An authenticated user with permission to upload media (Author-level access or higher by default) could upload an SVG containing malicious scripts by using the REST API or another sideload-based upload. If that file is later viewed directly or displayed on the site, the script can run in the browser of a visitor or logged-in user, including Administrators. This could lead to stored cross-site scripting.
Affected versions
< 2.2.6
Patched versions
2.2.6
Remediation
Upgrade Safe SVG to version 2.2.6 or later. The fix applies the same sanitization to SVGs uploaded through the sideload and REST API paths as to standard uploads. Site owners should also review any SVG files uploaded before upgrading.