CVE-2021-41174
XSS vulnerability allowing arbitrary JavaScript execution
Check your servers for CVE-2021-41174
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2021-41174 affects grafana, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
Grafana is an open-source platform for monitoring and observability. In affected versions if an attacker is able to convince a victim to visit a URL referencing a vulnerable page, arbitrary JavaScript content may be executed within the context of the victim's browser. The user visiting the malicious link must be unauthenticated and the link must be for a page that contains the login button in the menu bar. The url has to be crafted to exploit AngularJS rendering and contain the interpolation binding for AngularJS expressions. AngularJS uses double curly braces for interpolation binding: {{ }} ex: {{constructor.constructor(‘alert(1)’)()}}. When the user follows the link and the page renders, the login button will contain the original link with a query parameter to force a redirect to the login page. The URL is not validated and the AngularJS rendering engine will execute the JavaScript expression contained in the URL. Users are advised to upgrade as soon as possible. If for some reason you cannot upgrade, you can use a reverse proxy or similar to block access to block the literal string {{ in the path.
Severity (CVSS)
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- high: an attack depends on conditions outside the control of the attacker, such as a race
- Privileges required
- none: the attacker does not need an account
- User interaction
- required: a user has to do something, such as open a link or a file
- Scope
- changed: the damage reaches other components, such as the host of a container or other users
- Impact
- confidentiality low, integrity high, availability none: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 85.4%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 99.7% of all scored CVEs. Scores of 1 Dec 2026.
Weakness
- CWE-79 Improper Neutralization of Input During Web Page Generation
Affected products
As the CNA lists them.
Is my server affected?
Find the installed version of grafana and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i grafana
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2021-41174 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2021-41174RHEL, Rocky, Alma, Fedora
rpm -q grafana
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2021-41174Alpine
apk list --installed | grep -i grafanaWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2021-41174
trivy image --scanners vuln IMAGE | grep CVE-2021-41174
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
- https://github.com/grafana/grafana/security/advisories/GHSA-3j9m-hcv9-rpj8 github.com
- https://security.netapp.com/advisory/ntap-20211125-0003/ security.netapp.com
Other references
- https://github.com/grafana/grafana/commit/31b78d51c693d828720a5b285107a50e6024c912 github.com
- https://github.com/grafana/grafana/commit/3cb5214fa45eb5a571fd70d6c6edf0d729983f82 github.com
- https://github.com/grafana/grafana/commit/fb85ed691290d211a5baa44d9a641ab137f0de88 github.com
Source: the record CVE-2021-41174 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse