CVE-2021-39226: Github.com/grafana/grafana Authentication Bypass Vulnerability

HIGH
Advisory Identifier: GHSA-69j6-29vr-p3j9
CVSS 7.3
CWE-287 CWE-862
Published
Advisory Summary

CVE-2021-39226 is a HIGH (CVSS 7.3) authentication bypass vulnerability (CWE-287: Improper Authentication) affecting Github.com/grafana/grafana libraries in the Go ecosystem. The issue involves authentication bypass for viewing and deletions of snapshots. Remediation is available by upgrading affected packages to version 7.5.11, 8.1.6.

CVE-2021-39226 at a Glance

CVE Identifier CVE-2021-39226
GHSA Identifier GHSA-69j6-29vr-p3j9
Severity HIGH
CVSS v3.1 Base Score 7.3
CWE Classification CWE-287: Improper Authentication
Affected Product Github.com/grafana/grafana
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L/E:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2021-39226

To remediate this vulnerability, upgrade all affected Github.com/grafana/grafana dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/grafana/grafana fixed: 7.5.11
Upgrade github.com/grafana/grafana to 7.5.11
github.com/grafana/grafana fixed: 8.1.6
Upgrade github.com/grafana/grafana to 8.1.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/grafana/grafana

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-39226, inspect your project dependencies for Github.com/grafana/grafana:

inspect dependencies for github.com/grafana/grafana

Analyze the terminal output to locate any version of Github.com/grafana/grafana in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.5.11), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In Github.com/grafana/grafana, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Today we are releasing Grafana 7.5.11, and 8.1.6. These patch releases include an important security fix for an issue that affects all Grafana versions from 2.0.1. [Grafana Cloud](https://grafana.com/cloud) instances have already been patched and an audit did not find any usage of this attack vector. [Grafana Enterprise](https://grafana.com/products/enterprise) customers were provided with updated binaries under embargo. 8.1.5 contained a single fix for bar chart panels. We believe that users can expedite deployment by moving from 8.1.4 to 8.1.6 directly. ## CVE-2021-39226 Snapshot authentication bypass ### Summary CVSS Score: 9.8 Critical CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H We received a security report to [security@grafana.com](mailto:security@grafana.com) on 2021-09-15 about a vulnerability in Grafana regarding the snapshot feature. It was later identified as affecting Grafana versions from 2.0.1 to 8.1.6. [CVE-2021-39226](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-39226) has been assigned to this vulnerability. ### Impact Unauthenticated and authenticated users are able to view the snapshot with the lowest database key by accessing the literal paths: * `/dashboard/snapshot/:key`, or * `/api/snapshots/:key` If the snapshot "public_mode" configuration setting is set to true (vs default of false), unauthenticated users are able to delete the snapshot with the lowest database key by accessing the literal path: * `/api/snapshots-delete/:deleteKey` Regardless of the snapshot "public_mode" setting, authenticated users are able to delete the snapshot with the lowest database key by accessing the literal paths: * `/api/snapshots/:key`, or * `/api/snapshots-delete/:deleteKey` The combination of deletion and viewing enables a complete walk through all snapshot data while resulting in complete snapshot data loss. ### Attack audit While we can not guarantee that the below will identify all attacks, if you do find something with the below, you should consider doing a full assessment. #### Through reverse proxy/load balancer logs To determine if your Grafana installation has been exploited for this vulnerability, search through your reverse proxy/load balancer access logs for instances where the path is `/dashboard/snapshot/:key`, `/api/snapshots/:key` or `/api/snapshots-delete/:deleteKey`, and the response status code was 200 (OK). For example, if you’re using the Kubernetes ingress-nginx controller and sending logs to Loki, use a LogQL query like `{job="nginx-ingress-controller"} |= "\"status\": 200" |= "\"uri\": \"/api/snapshots/:key\""`. #### Through the Grafana Enterprise audit feature If you enabled “Log web requests” in your configuration with `router_logging = true`, look for `"requestUri":"/api/snapshots-delete/”`,`“requestUri":"/api/snapshots/:key"`, or `"type":"snapshot"` in combination with `"action":"delete"`. ### Patched versions Release 8.1.6: - [Download Grafana 8.1.6](https://grafana.com/grafana/download/8.1.6) - [Release notes](https://grafana.com/docs/grafana/latest/release-notes/release-notes-8-1-6/) Release 7.5.11: - [Download Grafana 7.5.11](https://grafana.com/grafana/download/7.5.11) - [Release notes](https://grafana.com/docs/grafana/latest/release-notes/release-notes-7-5-11/) ### Solutions and mitigations Download and install the appropriate patch for your version of Grafana. [Grafana Cloud](https://grafana.com/cloud) instances have already been patched, and [Grafana Enterprise](https://grafana.com/products/enterprise) customers were provided with updated binaries under embargo. ### Workaround If for some reason you cannot upgrade: You can use a reverse proxy or similar to block access to the literal paths * `/api/snapshots/:key` * `/api/snapshots-delete/:deleteKey` * `/dashboard/snapshot/:key` * `/api/snapshots/:key` They have no normal function and can be disabled without side effects. ### Timeline and postmortem Here is a detailed timeline starting from when we originally learned of the issue. All times in UTC. * 2021-09-15 14:49: Tuan Tran theblackturtle0901@gmail.com sends initial report about viewing snapshots without authentication * 2021-09-15 15:56: Initial reproduction * 2021-09-15 17:10: MEDIUM severity declared * 2021-09-15 18:58: Workaround deployed on Grafana Cloud * 2021-09-15 19:15: `/api/snapshots/:key` found to be vulnerable as well * 2021-09-15 19:30: `/api/snapshots/:key` blocked on Grafana Cloud * 2021-09-16 09:31: `/api/snapshots-delete/:deleteKey` found to be vulnerable as well, blocked on Grafana Cloud. From this point forward, Cloud is not affected any more. * 2021-09-16 09:35: HIGH severity declared * 2021-09-16 11:19: Realization that combination of deletion and viewing allows enumeration and permanent DoS * 2021-09-16 11:19: CRITICAL declared * 2021-09-17 10:53: Determination that no weekend work is needed. While issue is CRITICAL, scope is very limited * 2021-09-17 14:26: Audit of Grafana Cloud concluded, no evidence of exploitation * 2021-09-23: Grafana Cloud instances updated * 2021-09-28 12:00: Grafana Enterprise images released to customers under embargo * 2021-10-05 17:00: Public release ## Reporting security issues If you think you have found a security vulnerability, please send a report to [security@grafana.com](mailto:security@grafana.com). This address can be used for all of Grafana Labs's open source and commercial products (including but not limited to Grafana, Tempo, Loki, Amixr, k6, Tanka, and Grafana Cloud, Grafana Enterprise, and grafana.com). We only accept vulnerability reports at this address. We would prefer that you encrypt your message to us using our PGP key. The key fingerprint is: F988 7BEA 027A 049F AE8E 5CAA D125 8932 BE24 C5CA The key is available from [keys.gnupg.net](http://keys.gnupg.net/pks/lookup?op=get&fingerprint=on&search=0xD1258932BE24C5CA) by searching for [security@grafana](http://keys.gnupg.net/pks/lookup?search=security@grafana&fingerprint=on&op=index. ## Security announcements We maintain a category on the community site named [Security Announcements](https://community.grafana.com/c/security-announcements), where we will post a summary, remediation, and mitigation details for any patch containing security fixes. You can also subscribe to email updates to this category if you have a grafana.com account and sign in to the community site, or via updates from our [Security Announcements RSS feed](https://community.grafana.com/c/security-announcements.rss). ## Acknowledgement We would like to thank [Tran Viet Tuan](https://github.com/theblackturtle) for responsibly disclosing the initially discovered vulnerability to us.

CVE-2021-39226 Affected Github.com/grafana/grafana Versions

2 component(s)
Fixed Versions:
7.5.118.1.6
Product / Package Ecosystem Affected Versions Fixed Version
github.com/grafana/grafana
Go
< 7.5.11
7.5.11
github.com/grafana/grafana
Go
≥ 8.0.0
< 8.1.6
8.1.6

References

GitHub Advisory / Wiki ADVISORY
https://github.com/grafana/grafana/security/advisories/GHSA-69j6-29vr-p3j9
NVD — CVE-2021-39226 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-39226
Security Fix Commit FIX COMMIT
https://github.com/grafana/grafana/commit/2d456a6375855364d098ede379438bf7f0667269
Github.com/grafana/grafana Source Repository REPOSITORY
https://github.com/grafana/grafana
grafana.com/docs/grafana/latest... WEB
https://grafana.com/docs/grafana/latest/release-notes/release-notes-7-5-11
grafana.com/docs/grafana/latest... WEB
https://grafana.com/docs/grafana/latest/release-notes/release-notes-8-1-6
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DCKBFUSY6V4VU5AQUYWKISREZX5NLQJT
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/E6ANHRDBXQT6TURLP2THM26ZPDINFBEG
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DCKBFUSY6V4VU5AQUYWKISREZX5NLQJT
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/E6ANHRDBXQT6TURLP2THM26ZPDINFBEG
Github.com/grafana/grafana Security Information SECURITY
https://security.netapp.com/advisory/ntap-20211029-0008
www.cisa.gov/known-exploited-vul... WEB
https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2021-39226
Github.com/grafana/grafana Security Information SECURITY
http://www.openwall.com/lists/oss-security/2021/10/05/4

Frequently Asked Questions

What is CVE-2021-39226?
CVE-2021-39226 is a security vulnerability in Github.com/grafana/grafana involving Authentication bypass for viewing and deletions of snapshots under CWE-287: Improper Authentication.
Which Github.com/grafana/grafana versions are affected?
Affected versions include releases prior to 7.5.11, 8.1.6 across affected packages: github.com/grafana/grafana.
What version fixes CVE-2021-39226?
Upgrading to 7.5.11, 8.1.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/grafana/grafana affected?
Yes, github.com/grafana/grafana is affected in releases prior to 7.5.11, 8.1.6. Upgrade your dependency to 7.5.11, 8.1.6 or later.
What is the CVSS score of CVE-2021-39226?
CVE-2021-39226 has a CVSS v3.1 base score of 7.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L/E:H.
What CWE is associated with CVE-2021-39226?
CVE-2021-39226 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check Go dependencies for CVE-2021-39226?
Run the dependency tree command: 'inspect dependencies for github.com/grafana/grafana'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-69j6-29vr-p3j9",
  "modified" : "2025-10-22T19:08:03Z",
  "published" : "2021-10-05T20:24:02Z",
  "aliases" : [ "CVE-2021-39226" ],
  "summary" : "Authentication bypass for viewing and deletions of snapshots",
  "details" : "Today we are releasing Grafana 7.5.11, and 8.1.6. These patch releases include an important security fix for an issue that affects all Grafana versions from 2.0.1.\n\n[Grafana Cloud](https://grafana.com/cloud) instances have already been patched and an audit did not find any usage of this attack vector. [Grafana Enterprise](https://grafana.com/products/enterprise) customers were provided with updated binaries under embargo.\n\n8.1.5 contained a single fix for bar chart panels. We believe that users can expedite deployment by moving from 8.1.4 to 8.1.6 directly.\n\n## CVE-2021-39226 Snapshot authentication bypass\n\n### Summary\n\nCVSS Score: 9.8 Critical\nCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H\n\nWe received a security report to [security@grafana.com](mailto:security@grafana.com) on 2021-09-15 about a vulnerability in Grafana regarding the snapshot feature. It was later identified as affecting Grafana versions from 2.0.1 to 8.1.6. [CVE-2021-39226](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-39226) has been assigned to this vulnerability.\n\n### Impact\nUnauthenticated and authenticated users are able to view the snapshot with the lowest database key by accessing the literal paths:\n\n* `/dashboard/snapshot/:key`, or\n* `/api/snapshots/:key`\n\nIf the snapshot \"public_mode\" configuration setting is set to true (vs default of false), unauthenticated users are able to delete the snapshot with the lowest database key by accessing the literal path:\n\n* `/api/snapshots-delete/:deleteKey`\n\nRegardless of the snapshot \"public_mode\" setting, authenticated users are able to delete the snapshot with the lowest database key by accessing the literal paths:\n\n* `/api/snapshots/:key`, or\n* `/api/snapshots-delete/:deleteKey`\n\nThe combination of deletion and viewing enables a complete walk through all snapshot data while resulting in complete snapshot data loss.\n\n### Attack audit\n\nWhile we can not guarantee that the below will identify all attacks, if you do find something with the below, you should consider doing a full assessment.\n\n#### Through reverse proxy/load balancer logs\n\nTo determine if your Grafana installation has been exploited for this vulnerability, search through your reverse proxy/load balancer access logs for instances where the path is `/dashboard/snapshot/:key`, `/api/snapshots/:key` or `/api/snapshots-delete/:deleteKey`, and the response status code was 200 (OK).\nFor example, if you’re using the Kubernetes ingress-nginx controller and sending logs to Loki, use a LogQL query like `{job=\"nginx-ingress-controller\"} |= \"\\\"status\\\": 200\" |= \"\\\"uri\\\": \\\"/api/snapshots/:key\\\"\"`.\n\n#### Through the Grafana Enterprise audit feature\n\nIf you enabled “Log web requests” in your configuration with `router_logging = true`, look for\n`\"requestUri\":\"/api/snapshots-delete/”`,`“requestUri\":\"/api/snapshots/:key\"`, or `\"type\":\"snapshot\"` in combination with `\"action\":\"delete\"`.\n\n### Patched versions\n\nRelease 8.1.6: \n\n- [Download Grafana 8.1.6](https://grafana.com/grafana/download/8.1.6)\n- [Release notes](https://grafana.com/docs/grafana/latest/release-notes/release-notes-8-1-6/)\n\nRelease 7.5.11: \n\n- [Download Grafana 7.5.11](https://grafana.com/grafana/download/7.5.11)\n- [Release notes](https://grafana.com/docs/grafana/latest/release-notes/release-notes-7-5-11/)\n\n### Solutions and mitigations\n\nDownload and install the appropriate patch for your version of Grafana.\n\n[Grafana Cloud](https://grafana.com/cloud) instances have already been patched, and [Grafana Enterprise](https://grafana.com/products/enterprise) customers were provided with updated binaries under embargo.\n\n### Workaround\n\nIf for some reason you cannot upgrade:\n\nYou can use a reverse proxy or similar to block access to the literal paths\n* `/api/snapshots/:key`\n* `/api/snapshots-delete/:deleteKey`\n* `/dashboard/snapshot/:key`\n* `/api/snapshots/:key`\n\nThey have no normal function and can be disabled without side effects.\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* 2021-09-15 14:49: Tuan Tran theblackturtle0901@gmail.com sends initial report about viewing snapshots without authentication\n* 2021-09-15 15:56: Initial reproduction\n* 2021-09-15 17:10: MEDIUM severity declared\n* 2021-09-15 18:58: Workaround deployed on Grafana Cloud\n* 2021-09-15 19:15: `/api/snapshots/:key` found to be vulnerable as well\n* 2021-09-15 19:30: `/api/snapshots/:key` blocked on Grafana Cloud\n* 2021-09-16 09:31: `/api/snapshots-delete/:deleteKey` found to be vulnerable as well, blocked on Grafana Cloud. From this point forward, Cloud is not affected any more.\n* 2021-09-16 09:35: HIGH severity declared\n* 2021-09-16 11:19: Realization that combination of deletion and viewing allows enumeration and permanent DoS\n* 2021-09-16 11:19: CRITICAL declared\n* 2021-09-17 10:53: Determination that no weekend work is needed. While issue is CRITICAL, scope is very limited\n* 2021-09-17 14:26: Audit of Grafana Cloud concluded, no evidence of exploitation\n* 2021-09-23: Grafana Cloud instances updated\n* 2021-09-28 12:00: Grafana Enterprise images released to customers under embargo\n* 2021-10-05 17:00: Public release\n\n## Reporting security issues\n\nIf you think you have found a security vulnerability, please send a report to [security@grafana.com](mailto:security@grafana.com). This address can be used for all of\nGrafana Labs's open source and commercial products (including but not limited to Grafana, Tempo, Loki, Amixr, k6, Tanka, and  Grafana Cloud, Grafana Enterprise, and grafana.com). We only accept vulnerability reports at this address. We would prefer that you encrypt your message to us 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 [keys.gnupg.net](http://keys.gnupg.net/pks/lookup?op=get&fingerprint=on&search=0xD1258932BE24C5CA) by searching for [security@grafana](http://keys.gnupg.net/pks/lookup?search=security@grafana&fingerprint=on&op=index.\n\n## Security announcements\n\nWe maintain a category on the community site named [Security Announcements](https://community.grafana.com/c/security-announcements),\nwhere we will post a summary, remediation, and mitigation details for any patch containing security fixes. You can also subscribe to email updates to this category if you have a grafana.com account and sign in to the community site, or via updates from our [Security Announcements RSS feed](https://community.grafana.com/c/security-announcements.rss).\n\n## Acknowledgement\n\nWe would like to thank [Tran Viet Tuan](https://github.com/theblackturtle) for responsibly disclosing the initially discovered vulnerability to us.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L/E:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/grafana/grafana"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.5.11"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/grafana/grafana"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0"
      }, {
        "fixed" : "8.1.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/grafana/grafana/security/advisories/GHSA-69j6-29vr-p3j9"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-39226"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/grafana/grafana/commit/2d456a6375855364d098ede379438bf7f0667269"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/grafana/grafana"
  }, {
    "type" : "WEB",
    "url" : "https://grafana.com/docs/grafana/latest/release-notes/release-notes-7-5-11"
  }, {
    "type" : "WEB",
    "url" : "https://grafana.com/docs/grafana/latest/release-notes/release-notes-8-1-6"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DCKBFUSY6V4VU5AQUYWKISREZX5NLQJT"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/E6ANHRDBXQT6TURLP2THM26ZPDINFBEG"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DCKBFUSY6V4VU5AQUYWKISREZX5NLQJT"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/E6ANHRDBXQT6TURLP2THM26ZPDINFBEG"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20211029-0008"
  }, {
    "type" : "WEB",
    "url" : "https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2021-39226"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2021/10/05/4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287", "CWE-862" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-10-05T18:49:35Z",
    "nvd_published_at" : "2021-10-05T18:15:00Z"
  }
}