CVE-2022-31107

7.1 HIGH

📋 TL;DR

This vulnerability allows an authenticated malicious user to take over another user's Grafana account via OAuth login manipulation. It affects Grafana instances with OAuth authentication enabled where users can log in via external OAuth providers. The attacker needs to know the target's Grafana username and meet specific OAuth configuration conditions.

💻 Affected Systems

Products:
  • Grafana
Versions: 5.3 through 9.0.2, excluding patched versions 9.0.3, 8.5.9, 8.4.10, and 8.3.10
Operating Systems: All
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when OAuth authentication is enabled and configured with specific conditions: malicious user must have OAuth login authorization, their external user ID and email must not be associated with existing Grafana accounts, and they must know the target's Grafana username.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete account takeover of any Grafana user, allowing unauthorized access to sensitive monitoring data, dashboards, and potentially administrative functions.

🟠

Likely Case

Targeted account compromise of specific users, leading to unauthorized data access and potential privilege escalation within the Grafana instance.

🟢

If Mitigated

No impact if OAuth is disabled or all OAuth users have properly linked Grafana accounts with their email addresses.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploitation requires authenticated access to OAuth provider and knowledge of target's Grafana username. The vulnerability is well-documented in security advisories.

🛠️ 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-mx47-6497-3fv2

Restart Required: Yes

Instructions:

1. Identify your Grafana version. 2. Upgrade to the appropriate patched version based on your current version: 9.x to 9.0.3, 8.5.x to 8.5.9, 8.4.x to 8.4.10, or 8.3.x to 8.3.10. 3. Restart Grafana service. 4. Verify the upgrade was successful.

🔧 Temporary Workarounds

Disable OAuth Authentication

all

Temporarily disable OAuth login until patching is possible

Edit grafana.ini configuration file and set [auth.oauth] enabled = false
Restart Grafana service

Ensure OAuth User Account Linking

all

Create Grafana accounts for all OAuth users linked to their email addresses

Use Grafana admin interface to create user accounts with matching email addresses for all OAuth users

🧯 If You Can't Patch

  • Disable OAuth authentication completely
  • Implement strict access controls and monitoring for OAuth login events

🔍 How to Verify

Check if Vulnerable:

Check Grafana version and OAuth configuration. If version is between 5.3 and 9.0.2 (excluding patched versions) and OAuth is enabled, the system is vulnerable.

Check Version:

grafana-server -v or check Grafana web interface About page

Verify Fix Applied:

Verify Grafana version shows 9.0.3, 8.5.9, 8.4.10, or 8.3.10 or higher.

📡 Detection & Monitoring

Log Indicators:

  • Multiple failed login attempts followed by successful login from same OAuth provider
  • User account accessed from unexpected OAuth identity
  • OAuth login events where external user ID changes for existing account

Network Indicators:

  • Unusual OAuth authentication patterns
  • Multiple authentication requests from same OAuth provider in short timeframe

SIEM Query:

source="grafana" AND (event="oauth_login" OR event="user_login") | stats count by user, oauth_provider, src_ip | where count > threshold

🔗 References

📤 Share & Export