CVE-2022-31107
Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.
NVD · uneditedGrafana is an open-source platform for monitoring and observability. In versions 5.3 until 9.0.3, 8.5.9, 8.4.10, and 8.3.10, it is possible for a malicious user who has authorization to log into a Grafana instance via a configured OAuth IdP which provides a login name to take over the account of another user in that Grafana instance. This can occur when the malicious user is authorized to log in to Grafana via OAuth, the malicious user's external user id is not already associated with an account in Grafana, the malicious user's email address is not already associated with an account in Grafana, and the malicious user knows the Grafana username of the target user. If these conditions are met, the malicious user can set their username in the OAuth provider to that of the target user, then go through the OAuth flow to log in to Grafana. Due to the way that external and internal user accounts are linked together during login, if the conditions above are all met then the malicious user will be able to log in to the target user's Grafana account. Versions 9.0.3, 8.5.9, 8.4.10, and 8.3.10 contain a patch for this issue. As a workaround, concerned users can disable OAuth login to their Grafana instance, or ensure that all users authorized to log in via OAuth have a corresponding user account in Grafana linked to their email address.
Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.
dbcve analysis · high confidenceGrafana versions 5.3 through 9.0.3, 8.5.9, 8.4.10, and 8.3.10 contain an OAuth account takeover vulnerability. When OAuth is configured, a malicious user with valid OAuth credentials can hijack another user's account by setting their OAuth provider username to match the target Grafana username, provided their external user ID and email are not already linked to any Grafana account. This works because the login flow incorrectly links external OAuth users to existing internal accounts based solely on username matching.
Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.
Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.
NVD · CPE data>= 5.3.0, < 8.3.10>= 8.4.0, < 8.4.10>= 8.5.0, < 8.5.9>= 9.0.0, < 9.0.3all versionsCVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.
From the vector- Attack vector
- Network
- Complexity
- High
- Privileges
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.
dbcve checksWork through these to decide whether this CVE applies to you.
-
Identify installed Grafana versionRun 'grafana-server --version' or check the Grafana logs at startup, or inspect the grafana-server binary metadataAffected if The version falls within 5.3.0 to 8.3.9, 8.4.0 to 8.4.9, 8.5.0 to 8.5.8, or 9.0.0 to 9.0.2
-
Verify OAuth provider configurationInspect the grafana.ini configuration file (commonly in /etc/grafana/ or /usr/local/etc/grafana/) and look for sections under [auth] such as [auth.oauth] or provider-specific sections like [auth.google], [auth.github], etc.Affected if OAuth providers are configured and enabled under any [auth.<provider>] section
-
Confirm no email linking enforcement existsIn the OAuth provider configuration section, check if the 'connect_attributes' or 'email_attribute_path' settings explicitly link users by email rather than allowing username-only matchingAffected if No strict email linkage is configured and the OAuth provider allows username matching to map to existing Grafana accounts
-
Check for existing vulnerable user linksQuery the Grafana database (user_auth or user_auth_token tables) or examine the OAuth login logs to identify accounts linked via OAuth where the external user ID and email are not already linkedAffected if OAuth-linked accounts exist that were created through username matching without email verification
You are affected if you run a vulnerable Grafana version (5.3.0 through 8.3.9, 8.4.0 through 8.4.9, 8.5.0 through 8.5.8, or 9.0.0 through 9.0.2) with OAuth authentication enabled and without enforced email-based account linking.
Generated from the published advisory. Verify against your own configuration.
Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.
dbcve · scoped8.3.108.4.108.5.9
Upgrade Grafana to version 9.0.3, 8.5.9, 8.4.10, or 8.3.10. Alternatively, disable OAuth login or ensure all authorized OAuth users have corresponding Grafana accounts already linked to their email addresses.
Grafana 9.0.3 or later (or 8.5.9/8.4.10/8.3.10 depending on your current major.minor branch)
- 1. Identify current Grafana version by running `grafana-cli --version` or checking the Grafana UI (click Help > About)
- 2. Based on current version, upgrade to the appropriate patched version:
- - If running 8.3.x: upgrade to 8.3.10 or later
- - If running 8.4.x: upgrade to 8.4.10 or later
- - If running 8.5.x: upgrade to 8.5.9 or later
- - If running 9.0.x: upgrade to 9.0.3 or later
- 3. For E Series Performance Analyzer (all versions): There is no patch available; migrate to an alternative solution or implement strict network access controls
- 4. After upgrade, verify OAuth configuration and test login flow
Generated from the published advisory — verify against the referenced sources before acting.
- Consultation3.0 h
- Implementation4.0 h
- Testing2.0 h
- Review / QA1.0 h
An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $2,880.
Scan for this in your stack
Free · runs locallyCheck whether your project pulls in CVE-2022-31107 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.
References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.
Primary sourcesPractitioner notes
ContributedPeer-ranked notes from engineers who’ve handled CVE-2022-31107 in production — separate from our analysis above.
The advisory tells you what broke. It rarely tells you what actually worked. If you’ve dealt with this one, that detail is what the next engineer is searching for.
- The version that genuinely resolved it — not the one the vendor claimed
- A config change or rule that shut the vector down
- A gotcha in the upgrade path that cost you an afternoon
No notes yet
Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.
A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.
- Verified mitigations, workarounds, and config changes
- Version or environment caveats, and links to real fixes
- No weaponised exploit code, or anything meant to cause harm
- No spam, self-promotion, credentials, or personal data