Skip to content
CSRF Write-up Intermediate

CVE-2022-21703 in a nutshell ¶

Grafana's HTTP API accepted cross-origin state-changing requests because it relied on the SameSite cookie attribute and weak content-type validation. An attacker could trick a logged-in Grafana Admin into inviting the attacker as an Organization Admin by hosting a page on a same-site origin.

Julien Cretel Follow

Published on jub0bs.com

This post is a writeup about CVE-2022-21703, which is the result of a collaborative effort between bug-bounty hunter abrahack and me. If you use or intend to use Grafana, you should at least read the following section.

Julien Cretel, on jub0bs.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely an overreliance on the SameSite cookie attribute, weak content-type validation using a substring match, and incorrect assumptions about CORS.

Impact

An attacker could trick a high-privilege Grafana user into granting the attacker Organization Admin rights; instances with relaxed SameSite settings or frame embedding are at greater risk, and Safari users are exposed when SameSite is disabled.

What the attacker needed

Victim logged in as Grafana Admin; attacker page on a same-site origin; victim visits the attacker page

The fix

Grafana was fixed in v7.5.15 and v8.3.5, and the author recommends validating the content type properly rather than with a substring match.

How it was found

  1. Run a local Grafana Enterprise instance in Docker.
  2. Log in as the Grafana Admin and open the organisation users page.
  3. Serve a malicious page from a same-site origin on a different port.
  4. Visit the malicious page as the victim and observe the forged invite request succeeds.
  5. Revisit the organisation users page to confirm a new pending invite exists.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you log in to a website, your browser stores a cookie that proves who you are. A malicious page can make your browser send requests to that website, and if the cookie goes along, the site thinks the request came from you. Here the site only checked the cookie's SameSite setting and a loose content-type check, so a page on a related subdomain could quietly add a new admin account.

What is CSRF?

Another site makes a signed-in user's browser perform an action they did not intend.

More from Grafana Labs

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.