<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/the-woes-of-sanitizing-svgs-pwfqj7jvs" -->

---
title: The woes of sanitizing SVGs | daily.dev
description: A detailed history of SVG sanitization vulnerabilities in Scratch (the coding platform) from 2019 to 2026, covering XSS attacks, HTTP leaks via CSS @import,...
canonical: https://daily.dev/posts/the-woes-of-sanitizing-svgs-pwfqj7jvs
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The woes of sanitizing SVGs | daily.dev
og:description: A detailed history of SVG sanitization vulnerabilities in Scratch (the coding platform) from 2019 to 2026, covering XSS attacks, HTTP leaks via CSS @import,...
og:url: https://daily.dev/posts/the-woes-of-sanitizing-svgs-pwfqj7jvs
og:image: https://api.daily.dev/og/posts/PWFQj7jvS.png
og:image:alt: The woes of sanitizing SVGs
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# The woes of sanitizing SVGs

**[Hacker News](https://daily.dev/sources/hn)** · 15 min read · 1 upvotes · 0 comments

## Summary

A detailed history of SVG sanitization vulnerabilities in Scratch (the coding platform) from 2019 to 2026, covering XSS attacks, HTTP leaks via CSS @import, url(), image-set(), and CSS nesting bypass bugs. Each fix added more complexity to a custom sanitization pipeline, yet new bypasses kept emerging. The author argues this approach is fundamentally unsustainable and presents an alternative used in TurboWarp (a Scratch fork): sandboxing SVGs inside an iframe with a strict Content-Security-Policy, letting the browser enforce security rather than trying to out-parse every possible CSS trick. Two currently unfixed vulnerabilities are also disclosed, including one found by Claude Opus after publication.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://muffin.ink/blog/scratch-svg-sanitization>

## Similar posts on daily.dev

- [Novel clickjacking attack relies on CSS and SVG](https://daily.dev/posts/novel-clickjacking-attack-relies-on-css-and-svg-609qdgjok) · The Register · 1 upvotes · 0 comments
- [CVE-2026-55877: XSS in symfony/ux-icons via unsanitized SVG content in local files and Iconify on-demand responses \(Symfony Blog\)](https://daily.dev/posts/cve-2026-55877-xss-in-symfony-ux-icons-via-unsanitized-svg-content-in-local-files-and-iconify-on-de-hrpqqcxja) · Symfony · 0 upvotes · 0 comments
- [SVG Filters - Clickjacking 2.0](https://daily.dev/posts/svg-filters---clickjacking-2-0-5wxezdnbz) · Lobsters · 0 upvotes · 0 comments
- [GHSA-9wjq-cp2p-hrgf \(loofah\): SVG \`href\` attribute bypasses local-reference restriction in Loofah](https://daily.dev/posts/ghsa-9wjq-cp2p-hrgf-loofah-svg-href-attribute-bypasses-local-reference-restriction-in-loofah-onzax4oq3) · RUBYLAND · 0 upvotes · 0 comments
- [CVE-2026-2441 Explained: CSS Zero-Day Browser Security](https://daily.dev/posts/cve-2026-2441-explained-css-zero-day-browser-security-3lvuhpbw0) · SitePoint · 1 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#svg](https://daily.dev/tags/svg), [#web-security](https://daily.dev/tags/web-security)

[View this post on daily.dev](https://daily.dev/posts/the-woes-of-sanitizing-svgs-pwfqj7jvs)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"The woes of sanitizing SVGs","url":"https://daily.dev/posts/the-woes-of-sanitizing-svgs-pwfqj7jvs","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/the-woes-of-sanitizing-svgs-pwfqj7jvs"},"datePublished":"2026-04-27T18:03:33.641Z","dateModified":"2026-04-27T18:03:59.931Z","description":"A detailed history of SVG sanitization vulnerabilities in Scratch (the coding platform) from 2019 to 2026, covering XSS attacks, HTTP leaks via CSS @import,...","image":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","thumbnailUrl":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","isAccessibleForFree":true,"articleSection":"Hacker News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/the-woes-of-sanitizing-svgs-pwfqj7jvs","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,svg,web-security","timeRequired":"PT15M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"The woes of sanitizing SVGs"}]}
```

