Why SVGs Can Execute JavaScript
SVG is not a raster image—it is an XML dialect. The SVG specification explicitly supports <script> tags and event handlers like onload and onerror.
If a user-uploaded SVG is served with Content-Type: image/svg+xml and viewed directly, the browser executes the script in the origin context of the application.
Never serve user-uploaded SVGs inline without stripping script tags, or force Content-Disposition: attachment.