CVE-2021-39226 Grafana Authentication Bypass

Exploited in the wild Critical 9.8 Published Updated

Attackers can bypass authentication to view and delete Grafana snapshots, leading to data exposure and loss.

Exploited in the wild
Since 25 Aug 2022
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-39226?

CVE-2021-39226 is a critical authentication bypass vulnerability in Fedoraproject Fedora, published on 5 Oct 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

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

Weakness: CWE-862, CWE-287

Which versions are affected by CVE-2021-39226?

5 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 versions7.5.11
github.com/grafana/grafana GoAll versions7.5.11
github.com/grafana/grafana GoFrom 8.0.08.1.6
github.com/grafana/grafana GoFrom 8.0.08.1.6
grafana BitnamiAll versions7.5.11, 8.1.6
Linux distribution packages (32)
grafana Red Hat:enterprise_linux:8::appstreamAll versions0:7.3.6-3.el8_4
grafana-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:7.3.6-3.el8_4
grafana Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-azure-monitor Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-cloudwatch Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-debuginfo Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-elasticsearch Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-graphite Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-influxdb Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-loki Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-mssql Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-mysql Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-opentsdb Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-postgres Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-prometheus Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana-stackdriver Red Hat:rhel_eus:8.1::appstreamAll versions0:6.2.2-7.el8_1
grafana Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-azure-monitor Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-cloudwatch Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-debuginfo Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-elasticsearch Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-graphite Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-influxdb Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-loki Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-mssql Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-mysql Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-opentsdb Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-postgres Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-prometheus Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana-stackdriver Red Hat:rhel_eus:8.2::appstreamAll versions0:6.3.6-3.el8_2
grafana Rocky Linux:8All versions0:7.3.6-3.el8_4
grafana openSUSE:TumbleweedAll versions7.5.11-3.1

Products include Fedoraproject Fedora, Grafana Grafana.

How do I fix CVE-2021-39226?

Upgrade github.com/grafana/grafana to a fixed version for your release line: 7.5.11 or 8.1.6. US federal agencies must fix it by 15 Sep 2022.

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

Is CVE-2021-39226 being exploited?

Yes. Attackers have exploited CVE-2021-39226 in the wild since at least 25 Aug 2022.

Public exploit code: 1 Nuclei template.

All Fedoraproject Fedora vulnerabilities

Sources

Also known as BIT-grafana-2021-39226, GHSA-69j6-29vr-p3j9, RHSA-2021:3769, RHSA-2021:3770, RHSA-2021:3771, RLSA-2021:3771 and 2 more.

Is CVE-2021-39226 in your software?

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

Check your SBOMs for free