Skip to main content
Menu
Advisories

Stored Cross-Site Scripting via Unsanitized SVG Content in the Inline SVG Block

GHSA-3HHM-5QC9-Q4XFPublished Updated GitHub

Description

Safe SVG versions prior to 2.5.1 did not sanitize SVG content when the Inline SVG block rendered it. The block read the selected SVG file and output its contents directly into both the block editor and the front-end page. Sanitization happened only at upload time. If an SVG reached the uploads directory without going through that step, any script in it would run when the block displayed it.

Impact

If an unsanitized SVG is present in the Media Library, for example because it was added outside the normal WordPress upload flow, any script it contains runs in the browser of anyone who views a page or edits a post where that SVG is inlined with the Inline SVG block. This could lead to stored cross-site scripting against site visitors and editors, including Administrators. Exploitation requires an unsanitized SVG to already be in place, which does not happen in a typical setup.

Affected versions

< 2.5.1

Patched versions

2.5.1

Remediation

Upgrade Safe SVG to version 2.5.1 or later. The fix sanitizes SVG content when it is rendered, both on the front end and in the block editor, as well as at upload time.

Affected versions

References

GitHub · 10up/safe-svg