← Lab /Security & privacy

Six of eight popular SVG sanitizers can be bypassed to run JavaScript in browsers

Security & privacy Attack · Prototype · PortSwigger Research

The claim

The authors assert that six out of eight widely used SVG sanitizers can be bypassed to achieve JavaScript execution via crafted SVG payloads.

Gareth Heyes · PortSwigger Research Writeup

Published as: “Scalable Vector Grief”

So what

Web applications that rely solely on SVG sanitizers for XSS protection may still be vulnerable to crafted payloads.

The five-minute version

The author evaluated eight popular SVG sanitization libraries and successfully bypassed six of them. Bypasses include switching an element's XML namespace to XHTML, using XSLT stylesheets delivered via a Link response header, and importing a GIF as SVG in Safari. The payloads execute JavaScript in Firefox and Safari despite the response body being harmless XML. The evidence consists of proof-of-concept code and screenshots, but no large-scale deployment data.

What they found 3

What undercuts it the paper’s own results

Stated limits 3

What’s new here 4

Artifacts & methods 8

Topics

SVG XSSsanitizer bypassXML namespace injectionXSLT processing instructionLink response header stylesheetSafari GIF importFirefox response header CSS
← Previous Authorization guardrail limits identity-changing updates to fully supported evidence