Jessica Entwistle
October 29 2026
Security researchers at PortSwigger published findings on 28 October 2026 showing that six of the eight most widely used SVG sanitiser libraries can be bypassed in ways that allow JavaScript execution. The research demonstrates that a specific response header configuration can cause Firefox to run JavaScript even when the response body contains only apparently harmless XML. The findings are significant because SVG sanitisers are widely used by developers as a primary defence against cross-site scripting attacks via user-uploaded files, and many teams have built their upload security posture around the assumption that these libraries reliably neutralise malicious content.
SVG file uploads are common in a wide range of web applications, including customer portals, content management systems, SaaS platforms, e-commerce sites and internal tools that allow users to upload logos, avatars or documents. If an attacker can bypass a sanitiser and upload a malicious SVG, they may be able to execute JavaScript in the context of other users' browser sessions. This opens the door to credential theft, session hijacking, account takeover and data exfiltration — all without requiring any additional access to the server itself. The risk is compounded by the fact that many organisations have not reviewed their sanitiser library choices recently, and may be unaware that the library they are using is among those found to be bypassable. The research also highlights a broader point: defence-in-depth matters. Relying on a single sanitiser as the sole control for uploaded file safety is a fragile approach, particularly when the sanitiser's behaviour depends on browser-specific content-type handling that may not be consistent across all environments.
Development and security teams should identify which SVG sanitiser library is in use across their web applications and check whether it is among those identified in PortSwigger's research as bypassable. Where SVG upload functionality is not strictly necessary, disabling it or restricting accepted file types is the most straightforward mitigation. Where SVG support is required, converting uploaded SVGs to raster image formats server-side before storage or display removes the risk of malicious script execution entirely. Penetration testing of file upload functionality should be updated to include SVG-specific test cases that reflect the bypass techniques documented in this research. Teams should also review their content security policy headers to understand whether they provide any meaningful additional layer of protection in the event of a sanitiser bypass.
Source: PortSwigger Research