CVE-2021-39226
📋 TL;DR
This vulnerability in Grafana allows unauthenticated or authenticated users to view and delete the snapshot with the lowest database key via specific API endpoints. When public_mode is enabled, unauthenticated users can also delete snapshots, potentially leading to complete snapshot data loss. All Grafana instances below patched versions are affected.
💻 Affected Systems
- Grafana
📦 What is this software?
Fedora by Fedoraproject
Fedora by Fedoraproject
Grafana by Grafana
Grafana by Grafana
⚠️ Risk & Real-World Impact
Worst Case
Complete loss of all snapshot data through sequential deletion, combined with unauthorized viewing of sensitive dashboard information exposed in snapshots.
Likely Case
Unauthorized deletion of critical snapshots containing monitoring dashboards, configuration data, or business intelligence visualizations.
If Mitigated
Minimal impact if snapshots are disabled or access controls prevent exploitation.
🎯 Exploit Status
Exploitation requires simple HTTP requests to documented endpoints. Public proof-of-concept exists in security advisories.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 7.5.11 or 8.1.6
Vendor Advisory: https://github.com/grafana/grafana/security/advisories/GHSA-69j6-29vr-p3j9
Restart Required: Yes
Instructions:
1. Backup your Grafana configuration and data. 2. Stop Grafana service. 3. Upgrade to Grafana 7.5.11 (for 7.x branch) or 8.1.6 (for 8.x branch). 4. Restart Grafana service. 5. Verify upgrade completed successfully.
🔧 Temporary Workarounds
Block vulnerable endpoints via reverse proxy
allConfigure reverse proxy (nginx, Apache, etc.) to block access to vulnerable API paths
# Example nginx location block
location ~ ^/(api/snapshots|dashboard/snapshot|api/snapshots-delete) {
deny all;
return 403;
}
🧯 If You Can't Patch
- Disable snapshot functionality entirely if not required
- Implement strict network access controls to limit who can reach Grafana API endpoints
🔍 How to Verify
Check if Vulnerable:
Check Grafana version via web interface (Settings → About) or command line. If version is below 7.5.11 (for 7.x) or 8.1.6 (for 8.x), system is vulnerable.
Check Version:
grafana-server -v
Verify Fix Applied:
Confirm Grafana version is 7.5.11 or higher (7.x branch) or 8.1.6 or higher (8.x branch). Test that /api/snapshots/:key endpoints return proper authentication errors.
📡 Detection & Monitoring
Log Indicators:
- HTTP 200/204 responses to /api/snapshots/ or /api/snapshots-delete/ endpoints
- DELETE requests to snapshot endpoints from unexpected sources
- Rapid sequence of snapshot access attempts
Network Indicators:
- Unusual volume of requests to snapshot API paths
- DELETE methods to /api/snapshots-delete/ from unauthenticated sources when public_mode=true
SIEM Query:
source="grafana" AND (uri_path="/api/snapshots/*" OR uri_path="/api/snapshots-delete/*" OR uri_path="/dashboard/snapshot/*")
🔗 References
- http://www.openwall.com/lists/oss-security/2021/10/05/4
- https://github.com/grafana/grafana/commit/2d456a6375855364d098ede379438bf7f0667269
- https://github.com/grafana/grafana/security/advisories/GHSA-69j6-29vr-p3j9
- https://grafana.com/docs/grafana/latest/release-notes/release-notes-7-5-11/
- https://grafana.com/docs/grafana/latest/release-notes/release-notes-8-1-6/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DCKBFUSY6V4VU5AQUYWKISREZX5NLQJT/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/E6ANHRDBXQT6TURLP2THM26ZPDINFBEG/
- https://security.netapp.com/advisory/ntap-20211029-0008/
- http://www.openwall.com/lists/oss-security/2021/10/05/4
- https://github.com/grafana/grafana/commit/2d456a6375855364d098ede379438bf7f0667269
- https://github.com/grafana/grafana/security/advisories/GHSA-69j6-29vr-p3j9
- https://grafana.com/docs/grafana/latest/release-notes/release-notes-7-5-11/
- https://grafana.com/docs/grafana/latest/release-notes/release-notes-8-1-6/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DCKBFUSY6V4VU5AQUYWKISREZX5NLQJT/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/E6ANHRDBXQT6TURLP2THM26ZPDINFBEG/
- https://security.netapp.com/advisory/ntap-20211029-0008/
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2021-39226