simonw/datasette-css-properties

Is ?_raw=column an XSS security hole?

Ouverte

#1 ouverte le 7 janv. 2021

 (8 commentaires) (0 réaction) (0 personne assignée)Python (1 fork)github user discovery
help wanted

Métriques du dépôt

Stars
 (15 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

The ?_raw=column mechanism makes me a little nervous. It feels like it could be used for XSS, since it allows attackers to inject exact values into a page that is served by Datasette - e.g. https://latest-with-plugins.datasette.io/fixtures.css?sql=select+%27%3Cscript%3Ealert(%22evil%2C+perhaps%22)%3C%2Fscript%3E%27+as+evil%3B&_raw=evil

:root {
  --evil: <script>alert("evil, perhaps")</script>;
}

But that page is served with the text/css content-type - it's not HTML.

Could a browser be tricked into rendering it as HTML, in which case it would open up a XSS hole in the hosting Datasette instance?

Guide contributeur