CVE-2022-31107 Grafana account takeover via OAuth vulnerability

High 7.1 Published Updated

Attackers can take over other users' accounts by manipulating OAuth login names if specific account linking conditions are met.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-31107?

CVE-2022-31107 is a high-severity authentication bypass vulnerability in Grafana Grafana, published on 15 Jul 2022. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

Grafana 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.

Weakness: CWE-863

Which versions are affected by CVE-2022-31107?

10 open source packages ship an affected version, including github.com/grafana/grafana and grafana. It affects 2 products.

PackageAffectedFixed in
github.com/grafana/grafana GoAll versionsNone
github.com/grafana/grafana GoFrom 5.3.0-beta18.3.10
github.com/grafana/grafana GoFrom 5.3.0-beta18.3.10
github.com/grafana/grafana GoFrom 8.4.08.4.10
github.com/grafana/grafana GoFrom 8.4.08.4.10
github.com/grafana/grafana GoFrom 8.5.08.5.9
4 more packages
github.com/grafana/grafana GoFrom 8.5.08.5.9
github.com/grafana/grafana GoFrom 9.0.09.0.3
github.com/grafana/grafana GoFrom 9.0.09.0.3
grafana BitnamiFrom 5.3.08.3.10, 8.4.10, 8.5.9, 9.0.3
Linux distribution packages (30)
grafana AlmaLinux:8All versions7.5.11-3.el8_6
grafana AlmaLinux:9All versions7.5.11-5.el9_0
grafana Red Hat:enterprise_linux:8::appstreamAll versions0:7.5.11-3.el8_6
grafana-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:7.5.11-3.el8_6
grafana Red Hat:enterprise_linux:9::appstreamAll versions0:7.5.11-5.el9_0
grafana-debuginfo Red Hat:enterprise_linux:9::appstreamAll versions0:7.5.11-5.el9_0
grafana Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-azure-monitor Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-cloudwatch Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-debuginfo Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-elasticsearch Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-graphite Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-influxdb Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-loki Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-mssql Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-mysql Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-opentsdb Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-postgres Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-prometheus Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana-stackdriver Red Hat:rhel_e4s:8.1::appstreamAll versions0:6.2.2-9.el8_1
grafana Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-5.el8_2
grafana-azure-monitor Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-5.el8_2
grafana-cloudwatch Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-5.el8_2
grafana-debuginfo Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-5.el8_2
grafana-elasticsearch Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-5.el8_2
grafana-graphite Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-5.el8_2
grafana-influxdb Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-5.el8_2
grafana-loki Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-5.el8_2
grafana-mssql Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-5.el8_2
grafana-mysql Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-5.el8_2

Products include Grafana Grafana, Netapp E-Series Performance Analyzer.

How do I fix CVE-2022-31107?

Upgrade github.com/grafana/grafana to a fixed version for your release line: 8.3.10, 8.4.10, 8.5.9 or 9.0.3.

Upgrade, and rotate credentials and sessions that may have been exposed. More about Authentication bypass.

Is CVE-2022-31107 being exploited?

There is no known exploitation of CVE-2022-31107 in the wild and no public exploit code.

All Grafana Grafana vulnerabilities

Sources

Also known as ALSA-2022:5716, ALSA-2022:5717, BIT-grafana-2022-31107, GHSA-mx47-6497-3fv2, GO-2024-2852, MINI-3hm7-3m35-8856 and 25 more.

Is CVE-2022-31107 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free