{"id":"CVE-2022-21702","aliases":["CVE-2022-21702","GHSA-xc3p-28hw-q24g","BIT-GRAFANA-2022-21702"],"related":[],"kind":"vulnerability","state":"published","title":"Cross site scripting in Grafana proxy","summary":"Grafana is an open-source platform for monitoring and observability. In affected versions an attacker could serve HTML content thru the Grafana datasource or plugin proxy and trick a user to visit this HTML page using a specially crafted link and execute a Cross-site Scripting (XSS) attack. The attacker could either compromise an existing datasource for a specific Grafana instance or either set up its own public service and instruct anyone to set it up in their Grafana instance. To be impacted, all of the following must be applicable. For the data source proxy: A Grafana HTTP-based datasource configured with Server as Access Mode and a URL set, the attacker has to be in control of the HTTP server serving the URL of above datasource, and a specially crafted link pointing at the attacker controlled data source must be clicked on by an authenticated user. For the plugin proxy: A Grafana HTTP-based app plugin configured and enabled with a URL set, the attacker has to be in control of the HTTP server serving the URL of above app, and a specially crafted link pointing at the attacker controlled plugin must be clocked on by an authenticated user. For the backend plugin resource: An attacker must be able to navigate an authenticated user to a compromised plugin through a crafted link. Users are advised to update to a patched version. There are no known workarounds for this vulnerability.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Grafana is an open-source platform for monitoring and observability. In affected versions an attacker could serve HTML content thru the Grafana datasource or plugin proxy and trick a user to visit this HTML page using a specially crafted link and execute a Cross-site Scripting (XSS) attack. The attacker could either compromise an existing datasource for a specific Grafana instance or either set up its own public service and instruct anyone to set it up in their Grafana instance. To be impacted, all of the following must be applicable. For the data source proxy: A Grafana HTTP-based datasource configured with Server as Access Mode and a URL set, the attacker has to be in control of the HTTP server serving the URL of above datasource, and a specially crafted link pointing at the attacker controlled data source must be clicked on by an authenticated user. For the plugin proxy: A Grafana HTTP-based app plugin configured and enabled with a URL set, the attacker has to be in control of the HTTP server serving the URL of above app, and a specially crafted link pointing at the attacker controlled plugin must be clocked on by an authenticated user. For the backend plugin resource: An attacker must be able to navigate an authenticated user to a compromised plugin through a crafted link. Users are advised to update to a patched version. There are no known workarounds for this vulnerability.","source":"cvelist"},{"lang":"en","text":"Today we are releasing Grafana 8.3.5 and 7.5.15. This patch release includes MEDIUM severity security fix for XSS for Grafana.\n\nRelease v.8.3.5, only containing security fixes:\n\n- [Download Grafana 8.3.5](https://grafana.com/grafana/download/8.3.5)\n- [Release notes](https://grafana.com/docs/grafana/latest/release-notes/release-notes-8-3-5/)\n\nRelease v.7.5.15, only containing security fixes:\n\n- [Download Grafana 7.5.15](https://grafana.com/grafana/download/7.5.15)\n- [Release notes](https://grafana.com/docs/grafana/latest/release-notes/release-notes-7-5-15/)\n\n## XSS ([CVE-2022-21702](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21702))\n\n### Summary\n\nOn Jan. 16, an external security researcher, Jasu Viding contacted Grafana to disclose an XSS vulnerability in the way that Grafana handles data sources.\n\nAn attacker could serve HTML content through the Grafana datasource or plugin proxy and trick a user to visit this HTML page using a specially crafted link and execute a Cross-site Scripting (XSS) attack. The attacker could either compromise an existing datasource for a specific Grafana instance or either set up its own public service and instruct anyone to set it up in their Grafana instance.\n\nWe believe that this vulnerability is rated at CVSS 6.8 (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:N/A:N).  \n\n### Impact\n\nShould an existing data source connected to Grafana be compromised, it could be used to inappropriately gain access to other data sources connected to the same Grafana org.\n\n### Affected versions with MEDIUM severity \n\nTo be impacted, all of the following must be applicable:\n\n**For data source proxy**:\n - A Grafana instance running version v2.0.0-beta1 up to v8.3.4.\n - A Grafana HTTP-based datasource configured with Server as Access Mode and a URL set.\n - Attacker to be in control of the HTTP server serving the URL of above data source.\n - A specially crafted link pointing at http://host/api/datasources/proxy/\"data source id\" and attacker somehow tricks a user of the above Grafana instance to click/visit the link.\n - A user that’s already authenticated to above Grafana instance clicks on/visits the specially crafted link sent/provided by the attacker.\n\n**For plugin proxy**:\n- A Grafana instance running version v2.0.0-beta1 up to v8.3.4.\n- A Grafana HTTP-based app plugin configured and enabled with a URL set.\n- Attacker to be in control of the HTTP server serving the URL of above app.\n- A specially crafted link pointing at http://host/api/plugin-proxy/\"plugin id\" and attacker somehow tricks a user of the above Grafana instance to click/visit the link.\n- A user that’s already authenticated to above Grafana instance clicks on/visits the specially crafted link sent/provided by the attacker.\n\n**Backend plugin resource**:\n- A Grafana instance running version v7.0.0-beta1 up to v8.3.4.\n- Attacker potentially needs to craft a custom plugin to be able to pull this off, but if an attacker can compromise/control the backend service that a backend plugin connects to, it might be possible to serve HTML content via the /api/plugins/\"plugin Id\"/resources* or /api/datasources/\"id\"/resources* routes.\n- A specially crafted link pointing at /api/plugins/\"plugin Id\">/resources* or /api/datasources/\"id\"/resources* and attacker somehow tricks a user of the above Grafana instance to click/visit the link.\n- A user that’s already authenticated to above Grafana instance clicks on/visits the specially crafted link sent/provided by the attacker.\n\n### Root Causes\n#### Trigger\nReproduced and confirmed via this Golang app:\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n)\n\nfunc main() {\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"<html><body><script>alert('XSS');</script></body></html>\")\n\t})\n\n\tlog.Fatal(http.ListenAndServe(\":3011\", nil))\n}\n```\n\nA Prometheus datasource is configured in Grafana with URL http://localhost:3011.\n\nWhen visitining http://localhost:3000/api/datasources/proxy/170 the scripts declared in the HTML page executes. Confirmed in both Chrome and Firefox.\n\n### Solutions and mitigations\n\nAll installations between Grafana v2.0.0-beta1 up to v8.3.4 should be upgraded as soon as possible.\n\n#### Workarounds\n\nUsing a proxy, set a response header Content Security Policy: sandbox for the following routes:\n\n`/api/datasources/proxy*`\n`/api/plugin-proxy*`\n`/api/plugins/<pluginId>/resources*`\n`/api/datasources/<id>/resources*`\n\nAnother possible mitigation is setting the response header Content-Disposition: attachment; “proxy.txt”. Confirmed in both Chrome and Firefox.\n\n### Timeline and postmortem\n\nHere is a detailed timeline starting from when we originally learned of the issue. All times in UTC.\n\n- 2022-01-16 16:19 Issue submitted by Jasu Viding\n- 2022-01-17 14:40 CVSS score confirmed 6.8 at maximum and MEDIUM impact\n- 2022-01-17 15:15 Vulnerability confirmed reproducible \n- 2022-01-17 16:01 Begin mitigation for Grafana Cloud\n- 2022-01-18 15:12 Similar report received \n- 2022-01-19 09:57 CVE requested \n- 2022-01-19 13:21 PR with fix opened\n- 2022-01-19 19:53 GitHub issues CVE-2022-21702\n- 2022-01-20 12:43 Second similar report received\n- 2022-01-21 14:30 Private release planned for 2022-01-25, and public release planned for 2022-02-01\n- 2022-01-25 12:00 Private release with patches\n- 2022-02-01 12:00 During the public release process, we realized that private 7.x release was incomplete. Abort public release, send second private release to customers using 7.x\n- 2022-02-08 13:00 Public release\n\n### Acknowledgement\nWe would like to thank Jasu Viding for responsibly disclosing the vulnerability.\n\n### Reporting security issues\n\nIf you think you have found a security vulnerability, please send a report to security@grafana.com. This address can be used for all of Grafana Labs' open source and commercial products (including, but not limited to Grafana, Grafana Cloud, Grafana Enterprise, and grafana.com). We can accept only vulnerability reports at this address. We would prefer that you encrypt your message to us by using our PGP key. The key fingerprint is\n\nF988 7BEA 027A 049F AE8E 5CAA D125 8932 BE24 C5CA\n\nThe key is available from keyserver.ubuntu.com.\n\n### Security announcements\n\nWe maintain a [security category](https://community.grafana.com/c/support/security-announcements) on our blog, where we will always post a summary, remediation, and mitigation details for any patch containing security fixes.\n\nYou can also subscribe to our [RSS feed](https://grafana.com/tags/security/index.xml).","format":"markdown","source":"ghsa"},{"lang":"es","text":"Grafana es una plataforma de código abierto para la monitorización y la observabilidad. En las versiones afectadas, un atacante podría servir contenido HTML mediante la fuente de datos de Grafana o el proxy del plugin y engañar a un usuario para que visite esta página HTML usando un enlace especialmente diseñado y ejecutar un ataque de tipo Cross-site Scripting (XSS). El atacante podría comprometer una fuente de datos existente para una instancia específica de Grafana o bien configurar su propio servicio público e instruir a cualquiera para que lo configure en su instancia de Grafana. Para ser impactado, todo lo siguiente debe ser aplicable. Para el proxy de la fuente de datos: Una fuente de datos basada en HTTP de Grafana configurada con Servidor como Modo de Acceso y una URL establecida, el atacante debe estar en control del servidor HTTP que sirve la URL de dicha fuente de datos, y un enlace especialmente diseñado que apunte a la fuente de datos controlada por el atacante debe ser pulsado por un usuario autenticado. Para el plugin proxy: Un plugin de Grafana basado en HTTP configurado y habilitado con un conjunto de URL, el atacante debe estar en control del servidor HTTP que sirve la URL de la aplicación anterior, y un enlace especialmente diseñado que apunte al plugin controlado por el atacante debe ser marcado por un usuario autenticado. Para el recurso del plugin backend: Un atacante debe ser capaz de dirigir a un usuario autenticado a un plugin comprometido mediante un enlace diseñado. Es recomendado a usuarios actualizar a una versión parcheada. No hay medidas de mitigación adicionales conocidas para esta vulnerabilidad","source":"nvd"}],"published":"2022-02-08T19:40:11.000Z","modified":"2026-09-08T08:47:51.504Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:L/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:L/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:N/A:N","score":6.8,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:H/Au:S/C:N/I:P/A:N","score":2.1,"rating":"LOW"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":">= 2.0.0-beta1, < 7.5.15","status":"affected"},{"version":">= 8.0.0, < 8.3.5","status":"affected"}],"vendor":"grafana","product":"grafana","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.0.0-beta1","status":"affected","fixed":"7.5.15"}],"ecosystem":"Go","package":"github.com/grafana/grafana","purl":"pkg:golang/github.com/grafana/grafana","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"8.0.0","status":"affected","fixed":"8.3.5"}],"ecosystem":"Go","package":"github.com/grafana/grafana","purl":"pkg:golang/github.com/grafana/grafana","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"2.0.1","fixed":"7.5.15"},{"status":"affected","introduced":"8.0.0","fixed":"8.3.5"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"}],"vendor":"grafana","product":"grafana","cpe":"cpe:2.3:a:grafana:grafana:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","fixed":"3.0"}],"vendor":"netapp","product":"e-series_performance_analyzer","cpe":"cpe:2.3:a:netapp:e-series_performance_analyzer:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"34"},{"status":"affected","version":"35"},{"status":"affected","version":"36"}],"vendor":"fedoraproject","product":"fedora","cpe":"cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"semver","introduced":"2.0.1","status":"affected","fixed":"7.5.15"},{"type":"semver","introduced":"8.0.0","status":"affected","fixed":"8.3.5"}],"ecosystem":"Bitnami","package":"grafana","purl":"pkg:bitnami/grafana","source":"bitnami"}],"references":[{"url":"https://github.com/grafana/grafana/security/advisories/GHSA-xc3p-28hw-q24g","tags":["advisory","exploit","mitigation","release-notes","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/grafana/grafana/commit/27726868b3d7c613844b55cd209ca93645c99b85","tags":["advisory","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://grafana.com/blog/2022/02/08/grafana-7.5.15-and-8.3.5-released-with-moderate-severity-security-fixes/","tags":["advisory","release-notes","vendor-advisory","x-refsource-misc","x-transferred"],"sources":["cvelist","nvd","bitnami"]},{"url":"https://security.netapp.com/advisory/ntap-20220303-0005/","tags":["advisory","third-party-advisory","x-refsource-confirm","x-transferred"],"sources":["cvelist","nvd","bitnami"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HLAQRRGNSO5MYCPAXGPH2OCSHOGHSQMQ/","tags":["vendor-advisory","web","x-refsource-fedora","x-transferred"],"sources":["cvelist","nvd","bitnami"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/2PFW6Q2LXXWTFRTMTRN4ZGADFRQPKJ3D/","tags":["vendor-advisory","web","x-refsource-fedora","x-transferred"],"sources":["cvelist","nvd","bitnami"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/36GUEPA5TPSC57DZTPYPBL6T7UPQ2FRH/","tags":["vendor-advisory","web","x-refsource-fedora","x-transferred"],"sources":["cvelist","nvd","bitnami"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-21702","tags":["advisory","web"],"sources":["ghsa","bitnami"]},{"url":"https://github.com/grafana/grafana","tags":["package"],"sources":["ghsa"]},{"url":"https://grafana.com/blog/2022/02/08/grafana-7.5.15-and-8.3.5-released-with-moderate-severity-security-fixes","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/2PFW6Q2LXXWTFRTMTRN4ZGADFRQPKJ3D","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/36GUEPA5TPSC57DZTPYPBL6T7UPQ2FRH","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HLAQRRGNSO5MYCPAXGPH2OCSHOGHSQMQ","tags":["web"],"sources":["ghsa"]},{"url":"https://security.netapp.com/advisory/ntap-20220303-0005","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-04-22T15:49:44.646Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-21702","url":"https://www.cve.org/CVERecord?id=CVE-2022-21702","licence":"CVE Terms of Use","modified":"2025-04-22T18:22:39.255Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-xc3p-28hw-q24g","url":"https://github.com/advisories/GHSA-xc3p-28hw-q24g","licence":"CC-BY-4.0","modified":"2024-05-14T22:15:09.000Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-21702","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-21702","licence":"Public domain","modified":"2026-06-17T04:26:47.850Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-GRAFANA-2022-21702","url":"https://osv.dev/vulnerability/BIT-GRAFANA-2022-21702","licence":"Apache-2.0","modified":"2026-09-08T08:47:51.504Z"}],"updatedAt":"2026-11-25T22:58:09.555Z","epss":{"score":0.02384,"percentile":0.84396,"date":"2026-12-02T12:00:21.000Z"}}