graphite-project / graphite-web

A highly scalable real-time graphing system
http://graphite.readthedocs.org/
Apache License 2.0
5.88k stars 1.26k forks source link

[BUG] Stored XSS in template name #2745

Open takyoni opened 2 years ago

takyoni commented 2 years ago

Describe the bug It's possible to execute JS on application context by modifying the API query values when saving a template.

To Reproduce Access to a new dashboard in graphite-web instance (i.e. http://localhost/dashboard). You don't really need data in it. Use the "Save As Template " feature (In the context menu Dashboard > Save As Template ). Give it a name. <img src=1 onerror=alert(1)> String to replace <img src=1 onerror=alert(1)> Use the "Template finder" feature (In the context menu Dashboard > Template finder ). You can see XSS Expected behavior This can be solved by removing or ignoring requests containing the characters "<" ">" and/or other escaping/scripting characters. -> Sanitize the value before using it.

Screenshots Снимок экрана (2040) Снимок экрана (2041) Снимок экрана (2042) Снимок экрана (2044) Снимок экрана (2043)

Environment (please complete the following information):

deniszh commented 1 year ago

Fixed in #2785