{"id":17724,"date":"2022-01-31T17:33:17","date_gmt":"2022-01-31T16:33:17","guid":{"rendered":"https:\/\/herolab.usd.de\/?page_id=17724"},"modified":"2022-02-01T10:57:21","modified_gmt":"2022-02-01T09:57:21","slug":"usd-2021-0023","status":"publish","type":"page","link":"https:\/\/herolab.usd.de\/en\/security-advisories\/usd-2021-0023\/","title":{"rendered":"usd-2021-0023"},"content":{"rendered":"\n\n[et_pb_section fb_built=\"1\" _builder_version=\"4.9.4\" _module_preset=\"default\" background_color=\"#2E353D\" custom_padding=\"||0px|||\" global_colors_info=\"{}\"][et_pb_row _builder_version=\"4.9.4\" _module_preset=\"default\" global_colors_info=\"{}\"][et_pb_column type=\"4_4\" _builder_version=\"4.9.4\" _module_preset=\"default\" global_colors_info=\"{}\"][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" global_colors_info=\"{}\"]<h1>usd-2021-0023 | Grafana<\/h1>\n<p><strong>Advisory ID<\/strong>: usd-2021-0023<br \/><strong>Affected Product<\/strong>: Grafana<br \/><strong>Affected Version<\/strong>: &lt; v8.1.3<br \/><strong>Vulnerability Type<\/strong>: CWE-20: Improper Input Validation (https:\/\/cwe.mitre.org\/data\/definitions\/20.html)<br \/><strong>Security Risk<\/strong>: Low<br \/><strong>Vendor URL<\/strong>: <a href=\"https:\/\/grafana.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/grafana.com\/\u00a0<\/a> <br \/><strong>Vendor Status<\/strong>: Fixed<\/p>\n<p><span><\/span><\/p>\n<h3>Description<\/h3>\n<p>Grafana before v8.1.3 is vulnerable to Stylesheet injections that could be used to launch <a href=\"https:\/\/www.nds.ruhr-uni-bochum.de\/media\/emma\/veroeffentlichungen\/2012\/08\/16\/scriptlessAttacks-ccs2012.pdf\" target=\"_blank\" rel=\"noopener\">Scriptless Attacks<\/a>.<\/p>\n<p>Scriptless Attacks rely on the injection of untrusted stylesheets into a web application. By loading malicious stylesheets, an attacker can potentially disclose sensitive data.<\/p>\n<p>Grafana allowed users to customize the appearance of the application by choosing an <em>UI theme<\/em>. In doing so, the application accepts arbitrary values as theme parameters and embeds the user controlled contents within an HTML link tag without sufficient sanitization.<\/p>\n<p><span><\/span><\/p>\n<h3>Proof of Concept (PoC)<\/h3>\n<p><em>Note: the setup that was analyzed consisted of multiple applications that were deployed to different paths of the same domain (usd.de\/a\/, usd.de\/b\/, ...).<\/em><\/p>\n<p>A benign request to set the <em>UI theme<\/em>\u00a0looks as follows:<\/p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" global_colors_info=\"{}\"]<p>PUT \/monitoring\/api\/user\/preferences HTTP\/2<br \/>Host: usd.de<br \/>Cookie: [REDACTED]<br \/>[...]<\/p>\n<p>{<br \/>\"homeDashboardId\":1,<br \/>\"theme\":\"dark\",<br \/>\"timezone\":\"\"<br \/>}<\/p>[\/et_pb_text][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" global_colors_info=\"{}\"]<p>As the <strong>theme<\/strong>\u00a0parameter is not sufficently sanitized, with the following request, any stylesheet that can be found on the webserver can be referenced:<\/p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" global_colors_info=\"{}\"]<p>PUT \/monitoring\/api\/user\/preferences HTTP\/2<br \/>Host: usd.de<br \/>Cookie: [REDACTED]<br \/>[...]<\/p>\n<p>{<br \/>\"homeDashboardId\":1,<br \/>\"theme\":\"<span>\u2215<\/span>..<span>\u2215<\/span>..<span>\u2215<\/span>..<span>\u2215<\/span>..<span>\u2215<\/span>..<span>\u2215<\/span>..\/usd-api\/doc\/swagger-ui\/swagger-ui.css#\",<br \/>\"timezone\":\"\"<br \/>}<\/p>[\/et_pb_text][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" custom_margin=\"||27px||false|false\" global_colors_info=\"{}\"]<p>In the following, Grafana uses the <strong>theme<\/strong>\u00a0without further sanitization:<\/p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" global_colors_info=\"{}\"]<p>&lt;link rel=\"stylesheet\" href=\"public\/build\/grafana.\/..<span>\u2215<\/span>..<span>\u2215<\/span>..<span>\u2215<\/span>..<span>\u2215<\/span>..<span>\u2215<\/span>..\/usd-api\/doc\/swagger-ui\/swagger-ui.css#.e45e7ed64ba6056a33a4.css\" \/&gt;<\/p>[\/et_pb_text][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" custom_margin=\"||27px||false|false\" global_colors_info=\"{}\"]<p>The screenshot below indicates that the stylesheet is loaded:<\/p>[\/et_pb_text][et_pb_image src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/01\/css-injection-grafana.png\" title_text=\"css-injection-grafana\" _builder_version=\"4.13.1\" _module_preset=\"default\" global_colors_info=\"{}\"][\/et_pb_image][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" global_colors_info=\"{}\"]<div class=\"e16902-22 x-container max width\">\n<div class=\"e16902-23 x-column x-sm x-1-1\">\n<h3>Fix<\/h3>\n<p>It is recommended to consider all user input to the application as potentially malicious. All input to the application should be verified and if necessary replaced. Meta characters should be treated with care. It is recommended to use whitelisting wherever possible.<\/p>\n<h3><\/h3>\n<h3>References<\/h3>\n<ul>\n<li><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/20.html\" target=\"_blank\" rel=\"noopener\">https:\/\/cwe.mitre.org\/data\/definitions\/20.html<\/a>\u00a0<\/li>\n<li><a href=\"https:\/\/www.nds.ruhr-uni-bochum.de\/media\/emma\/veroeffentlichungen\/2012\/08\/16\/scriptlessAttacks-ccs2012.pdf\" target=\"_blank\" rel=\"noopener\">https:\/\/www.nds.ruhr-uni-bochum.de\/media\/emma\/veroeffentlichungen\/2012\/08\/16\/scriptlessAttacks-ccs2012.pdf<\/a>\u00a0<\/li>\n<\/ul>\n<h3><\/h3>\n<h3>Timeline<\/h3>\n<ul>\n<li>2021-08-11: This vulnerability was identified by Tobias Hamann and Lauritz Holtmann.<\/li>\n<li>2021-08-11: Advisory submitted to vendor via e-mail.<\/li>\n<li>2021-10-15: Patch is released with Grafana v8.1.3: <a href=\"https:\/\/grafana.com\/docs\/grafana\/latest\/release-notes\/release-notes-8-1-3\/\" target=\"_blank\" rel=\"noopener\">https:\/\/grafana.com\/docs\/grafana\/latest\/release-notes\/release-notes-8-1-3\/<\/a><\/li>\n<li>2022-01-31: Security advisory published by usd AG.<\/li>\n<\/ul>\n<h3><\/h3>\n<h3>Credits<\/h3>\n<p>This security vulnerability was found by Tobias Hamann and Lauritz Holtmann of usd AG.<\/p>\n<\/div>\n<\/div>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]\n\n","protected":false},"excerpt":{"rendered":"<p>usd-2021-0023 | Grafana Advisory ID: usd-2021-0023Affected Product: GrafanaAffected Version: &lt; v8.1.3Vulnerability Type: CWE-20: Improper Input Validation (https:\/\/cwe.mitre.org\/data\/definitions\/20.html)Security Risk: LowVendor URL: https:\/\/grafana.com\/\u00a0 Vendor Status: Fixed Description Grafana before v8.1.3 is vulnerable to Stylesheet injections that could be used to launch Scriptless Attacks. Scriptless Attacks rely on the injection of untrusted stylesheets into a web application. By [&hellip;]<\/p>\n","protected":false},"author":96,"featured_media":0,"parent":16124,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","inline_featured_image":false,"footnotes":""},"class_list":["post-17724","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/17724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/users\/96"}],"replies":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/comments?post=17724"}],"version-history":[{"count":0,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/17724\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/16124"}],"wp:attachment":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/media?parent=17724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}