CVE DatabaseCVE-2021-39226
한국어 권고문 →
CVE-2021-392267.3/HIGHCISA KEVCWE-287CWE-862

Grafana Unauthenticated Snapshot Data Exposure and Deletion Vulnerability (CVE-2021-39226)

⚡ Jump to Patch
Affected Vendors
grafana
Affected Components
grafana
Published Date
2021-10-05
CVSS v3.1
7.3
HIGH
EPSS (30d)
99.9%
FIRST.org
CISA KEV
Exploited

Executive & SecOps Summary

SECOPS ASSESSMENT
Affected Scope

Grafana versions prior to 8.1.6 and 7.5.11

Impact

Unauthenticated attackers can view or delete the snapshot with the lowest database key via specific API paths, potentially leading to complete snapshot data harvesting and loss.

Mitigation

Immediately upgrade Grafana to patched versions (8.1.6, 7.5.11, or higher) or block access to the vulnerable API paths using a reverse proxy.

Affected Products & Version Scope

Grafana versions 7.x (prior to 7.5.11) and 8.x (prior to 8.1.6)

Remediation & Live Workaround Commands

PATCH & WORKAROUND

1. Official Patch & Version Upgrade Commands

Upgrade your Grafana instances to the patched versions (8.1.6 or 7.5.11 and above) immediately.

bash
# Upgrade Grafana on Debian/Ubuntu-based systems
sudo apt-get update
sudo apt-get --only-upgrade install grafana

# Upgrade Grafana on RedHat/CentOS-based systems
sudo yum update grafana

# For Docker deployments, pull and run the secure image version
docker pull grafana/grafana:8.1.6
docker stop grafana-container
docker run -d --name grafana-container -p 3000:3000 grafana/grafana:8.1.6

2. Temporary Workaround & Hardening Configuration

If an immediate upgrade is not feasible, use a reverse proxy to block external access to the vulnerable literal paths. These endpoints have no normal function and can be disabled without side effects.

nginx
# Nginx configuration to block vulnerable endpoints (/etc/nginx/conf.d/grafana-block.conf)
server {
    listen 80;
    server_name grafana.yourdomain.com;

    # Block access to vulnerable snapshot endpoints
    location ~* ^/(api/snapshots|api/snapshots-delete|dashboard/snapshot)/ {
        return 403 'Access Denied: CVE-2021-39226 Mitigation Active';
    }

    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

3. Log Audit & IoC Verification Commands

Inspect Grafana and reverse proxy access logs to identify potential exploitation attempts.

bash
# Search Grafana logs for snapshot endpoint access
grep -E '/api/snapshots|/dashboard/snapshot' /var/log/grafana/grafana.log

# Identify IP addresses making repeated requests to the vulnerable paths
awk '/\/(api\/snapshots|dashboard\/snapshot)/ {print $1, $6, $7, $9}' /var/log/nginx/access.log | sort | uniq -c
Interactive SecOps Remediation Checklist
0/4 (0%)
Recommended Security Control & Mitigation Partner
Cloudflare Enterprise & Pro WAF
Immediately upgrade Grafana to version 8.1.6 or 7.5.11, or restrict access to snapshot endpoints via a reverse proxy.

Block Exploits Instantly with Managed Virtual Patching Rules

Can't patch production immediately? Deploy managed WAF rules at the edge to intercept RCE, SQLi, and deserialization payloads before they hit your origin server.

3-min setup · Automated Zero-Day Managed Rules
Practice Exploiting & Patching This Web Vulnerability in an Interactive Lab
Launch Hands-On Security Lab

Technical Root Cause & Exploitation Mechanics

1. Vulnerability Overview & Root Cause

This vulnerability (CVE-2021-39226) is an authentication bypass (CWE-287) and missing authorization (CWE-862) flaw in Grafana, an open-source data visualization platform. The root cause lies in the improper handling of requests to literal snapshot paths (/dashboard/snapshot/:key and /api/snapshots/:key). Due to a design flaw, when these endpoints are accessed, Grafana fails to validate authentication and authorization properly, defaulting to returning the snapshot with the lowest database key.

2. Exploitation Mechanics & Attack Scenario

An attacker can exploit this vulnerability without any prior privileges by directly targeting the vulnerable endpoints:

  • Snapshot Viewing: An unauthenticated attacker sends a request to /dashboard/snapshot/:key or /api/snapshots/:key. The application responds with the snapshot data associated with the lowest active database key (e.g., ID 1).
  • Snapshot Deletion: If the public_mode configuration is set to true, unauthenticated users can delete the snapshot with the lowest database key via /api/snapshots-delete/:deleteKey. Even if public_mode is false, any authenticated user with low privileges can delete the snapshot using the same path.
  • Data Destruction Loop: By repeatedly viewing and deleting the lowest-keyed snapshots, an attacker can systematically walk through all snapshot data in the database, resulting in complete data exfiltration and permanent data loss.

3. Infrastructure & Business Impact

This vulnerability is listed in the CISA KEV (Known Exploited Vulnerabilities) catalog and has an EPSS score of 0.9993, indicating active and widespread exploitation in the wild. Dashboards and snapshots often contain highly sensitive operational metrics, system configurations, internal network topologies, and query results. Exposure of this data leads to severe information disclosure, while unauthorized deletion disrupts monitoring capabilities and compromises operational integrity.

Official Vendor Advisories & References

NVD Original English Description

Grafana is an open source data visualization platform. In affected versions 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. This issue has been resolved in versions 8.1.6 and 7.5.11. 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, and /api/snapshots/:key. They have no normal function and can be disabled without side effects.

Frequently Asked SecOps Questions (CVE-2021-39226)

FAQ

Q1. How critical is CVE-2021-39226 and is it actively exploited in the wild?

CVE-2021-39226 is rated CVSS 7.3 (HIGH) with a 30-day EPSS exploitation probability of 99.9%. It is listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, requiring immediate emergency remediation.

Q2. Which vendors and products are affected by CVE-2021-39226?

Primary impacted vendors include grafana across grafana. Scope summary: Grafana versions 7.x (prior to 7.5.11) and 8.x (prior to 8.1.6)

Q3. What temporary mitigations or workarounds exist for CVE-2021-39226 before patching?

[Mitigation] Immediately upgrade Grafana to patched versions (8.1.6, 7.5.11, or higher) or block access to the vulnerable API paths using a reverse proxy. Follow the CLI remediation commands and interactive SecOps checklist on this page to restrict exposure prior to your maintenance window.

SECOPS WORKBENCH INTEGRATION

Generate an Internal Engineering Notice or CISO Report for CVE-2021-39226

Instantly format this advisory into an executive CISO summary or engineering patch ticket.

Generate Report →

🔗 Related Advisories in Similar Stack (grafana)

View Category →
SecOps Advisory Dispatch & RSS Feed

Subscribe to Daily Vulnerability Briefings & KEV Alerts

Concise morning briefings for SecOps, DevSecOps, and SRE teams covering newly exploited CVEs and mitigation priorities.

Slack / Teams / RSS Feed:
PatchKO
CVE-2021-39226 Grafana Unauthenticated Snapshot Data Exposure and Deletion Vulnerability (CVE-2021-39226) (CVSS 7.3) - Patch & Workaround | CVE Pulse