CVE-2022-31097

7.3 HIGH

📋 TL;DR

Grafana versions 8.x and 9.x before specific patched releases are vulnerable to stored cross-site scripting (XSS) in the Unified Alerting feature. An attacker can exploit this to escalate privileges from editor to admin by tricking an authenticated admin into clicking a malicious link. This affects all Grafana deployments using vulnerable versions with Unified Alerting enabled.

💻 Affected Systems

Products:
  • Grafana
Versions: 8.x branch before 8.5.9, 8.4.10, 8.3.10; 9.x branch before 9.0.3
Operating Systems: All platforms running Grafana
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects deployments with Unified Alerting feature enabled (default in affected versions). Legacy alerting is not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

An attacker gains full administrative control over the Grafana instance, allowing them to view/modify all dashboards, data sources, user accounts, and potentially access underlying systems.

🟠

Likely Case

Privilege escalation from editor to admin role, enabling unauthorized configuration changes and data access.

🟢

If Mitigated

Limited impact with proper network segmentation, admin user awareness training, and least privilege principles.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Requires authenticated editor access and social engineering to trick an admin user. No public exploit code available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 9.0.3, 8.5.9, 8.4.10, or 8.3.10

Vendor Advisory: https://github.com/grafana/grafana/security/advisories/GHSA-vw7q-p2qg-4m5f

Restart Required: Yes

Instructions:

1. Backup Grafana configuration and data. 2. Stop Grafana service. 3. Upgrade to patched version using package manager or manual installation. 4. Restart Grafana service. 5. Verify version and functionality.

🔧 Temporary Workarounds

Disable Unified Alerting

all

Switch to legacy alerting system which is not vulnerable

Set alerting.enabled = false in grafana.ini configuration file

Disable Alerting Entirely

all

Completely disable alerting features

Set unified_alerting.enabled = false and alerting.enabled = false in grafana.ini

🧯 If You Can't Patch

  • Implement strict network access controls to limit Grafana admin interface exposure
  • Educate admin users about phishing risks and implement multi-factor authentication

🔍 How to Verify

Check if Vulnerable:

Check Grafana version via web interface (Settings → About) or command line. If version is 8.x < 8.5.9/8.4.10/8.3.10 or 9.x < 9.0.3, system is vulnerable.

Check Version:

grafana-server -v

Verify Fix Applied:

Confirm version is 9.0.3, 8.5.9, 8.4.10, or 8.3.10. Test Unified Alerting functionality remains operational.

📡 Detection & Monitoring

Log Indicators:

  • Unusual alert rule modifications
  • Admin privilege escalation events
  • Suspicious XSS payloads in alert configurations

Network Indicators:

  • Unexpected outbound connections from Grafana server
  • Unusual admin interface access patterns

SIEM Query:

source="grafana" AND (event="alert_rule_modified" OR event="user_role_changed")

🔗 References

📤 Share & Export