CVE-2021-39226

9.8 CRITICAL

📋 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

Products:
  • Grafana
Versions: All versions below 7.5.11 and 8.1.6
Operating Systems: All platforms running Grafana
Default Config Vulnerable: ✅ No
Notes: Default public_mode setting is false, limiting unauthenticated deletion but not viewing. Authenticated exploitation works regardless of public_mode.

📦 What is this software?

⚠️ 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.

🌐 Internet-Facing: HIGH - Unauthenticated exploitation possible when public_mode is enabled, and endpoints are accessible from internet.
🏢 Internal Only: HIGH - Authenticated users can exploit regardless of public_mode setting, posing insider threat risk.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

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

all

Configure 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

📤 Share & Export