CVE-2022-39324: Github.com/grafana/grafana Grafana Spoofing OriginalUrl Of Snapshots Vulnerability

MODERATE
Advisory Identifier: GHSA-4724-7jwc-3fpw
CVSS 6.7
CWE-79
Published
Advisory Summary

CVE-2022-39324 is a MODERATE (CVSS 6.7) grafana spoofing originalurl of snapshots vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Github.com/grafana/grafana libraries in the Go ecosystem. The issue involves grafana spoofing originalurl of snapshots. Remediation is available by upgrading affected packages to version 9.2.8, 8.5.16.

CVE-2022-39324 at a Glance

CVE Identifier CVE-2022-39324
GHSA Identifier GHSA-4724-7jwc-3fpw
Severity MODERATE
CVSS v3.1 Base Score 6.7
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Github.com/grafana/grafana
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:L).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability Low (A:L)

How to Fix CVE-2022-39324

To remediate this vulnerability, upgrade all affected Github.com/grafana/grafana dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/grafana/grafana fixed: 9.2.8
Upgrade github.com/grafana/grafana to 9.2.8
github.com/grafana/grafana fixed: 8.5.16
Upgrade github.com/grafana/grafana to 8.5.16
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/grafana/grafana

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-39324, inspect your project dependencies for Github.com/grafana/grafana:

inspect dependencies for github.com/grafana/grafana

Analyze the terminal output to locate any version of Github.com/grafana/grafana in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.2.8), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Github.com/grafana/grafana, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

To create a snapshot (and insert an arbitrary URL) the built-in role Viewer is sufficient. When a dashboard is shared as a local snapshot, the following three fields are offered in the web UI for a user to fill out: • Snapshotname • Expire • Timeout(seconds) After the user confirms creation of the snapshot (i.e. clicks the ”Local Snapshot” button) an HTTP POST request is sent to the Grafana server. The HTTP request contains additional parameters that are not visible in the web UI. The parameter originalUrl is not visible in the web UI, but sent in the HTTP POST request. The value of the originalUrl parameter is automatically generated. The purpose of the presented originalUrl parameter is to provide a user that views the snapshot the possibility to click on the button in the Grafana web UI and be presented with the dashboard that the snapshot was made out of. The value of the originalUrl parameter can be arbitrarily chosen by a malicious user that creates the snapshot (Note: by editing the query thanks to a web proxy like Burp) When another user opens the URL of the snapshot, they will be presented with the regular web interface delivered by the trusted Grafana server. The issue here is that the ”Open original dashboard” button no longer points to the to the real original dashboard but to the attacker’s (injected) URL.

CVE-2022-39324 Affected Github.com/grafana/grafana Versions

2 component(s)
Fixed Versions:
9.2.88.5.16
Product / Package Ecosystem Affected Versions Fixed Version
github.com/grafana/grafana
Go
≥ 9.0.0
< 9.2.8
9.2.8
github.com/grafana/grafana
Go
< 8.5.16
8.5.16

References

Frequently Asked Questions

What is CVE-2022-39324?
CVE-2022-39324 is a security vulnerability in Github.com/grafana/grafana involving Grafana Spoofing originalUrl of snapshots under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Github.com/grafana/grafana versions are affected?
Affected versions include releases prior to 9.2.8, 8.5.16 across affected packages: github.com/grafana/grafana.
What version fixes CVE-2022-39324?
Upgrading to 9.2.8, 8.5.16 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/grafana/grafana affected?
Yes, github.com/grafana/grafana is affected in releases prior to 9.2.8, 8.5.16. Upgrade your dependency to 9.2.8, 8.5.16 or later.
What is the CVSS score of CVE-2022-39324?
CVE-2022-39324 has a CVSS v3.1 base score of 6.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:L.
What CWE is associated with CVE-2022-39324?
CVE-2022-39324 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Go dependencies for CVE-2022-39324?
Run the dependency tree command: 'inspect dependencies for github.com/grafana/grafana'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4724-7jwc-3fpw",
  "modified" : "2024-07-08T20:59:51Z",
  "published" : "2024-05-14T22:29:26Z",
  "aliases" : [ "CVE-2022-39324" ],
  "summary" : "Grafana Spoofing originalUrl of snapshots",
  "details" : "To create a snapshot (and insert an arbitrary URL) the built-in role Viewer is sufficient.\nWhen a dashboard is shared as a local snapshot, the following three fields are offered in the web UI for a user to fill out:\n• Snapshotname\n• Expire\n• Timeout(seconds)\nAfter the user confirms creation of the snapshot (i.e. clicks the ”Local Snapshot” button) an HTTP POST request is sent to the Grafana server. The HTTP request contains additional parameters that are not visible in the web UI. The parameter originalUrl is not visible in the web UI, but sent in the HTTP POST request.\n\nThe value of the originalUrl parameter is automatically generated. The purpose of the presented originalUrl parameter is to provide a user that views the snapshot the possibility to click on the button in the Grafana web UI and be presented with the dashboard that the snapshot was made out of.\n\nThe value of the originalUrl parameter can be arbitrarily chosen by a malicious user that creates the snapshot (Note: by editing the query thanks to a web proxy like Burp)\nWhen another user opens the URL of the snapshot, they will be presented with the regular web interface delivered by the trusted Grafana server. The issue here is that the ”Open original dashboard” button no longer points to the to the real original dashboard but to the attacker’s (injected) URL.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:H/SI:H/SA:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/grafana/grafana"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "9.0.0"
      }, {
        "fixed" : "9.2.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/grafana/grafana"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "8.5.16"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/grafana/grafana/security/advisories/GHSA-4724-7jwc-3fpw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-39324"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/grafana/grafana/pull/60232"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/grafana/grafana/pull/60256"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/grafana/grafana/commit/239888f22983010576bb3a9135a7294e88c0c74a"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/grafana/grafana/commit/d7dcea71ea763780dc286792a0afd560bff2985c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/grafana/grafana"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-14T22:29:26Z",
    "nvd_published_at" : "2023-01-27T23:15:00Z"
  }
}