CVE-2021-37860: Cross-site Scripting in Mattermost
Summary
CVE-2021-37860: Cross-site Scripting in Mattermost. Affects github.com/mattermost/mattermost-server/v5 versions < 5.39.0. Fixed in 5.39.0. How to fix ↓
Also tracked for
The same CVE-2021-37860 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Mattermost is an open-source messaging platform that enables secure team collaboration. It is written in Go and is widely used for communication and collaboration within organizations. The vulnerability, identified as CVE-2021-37860, affects Mattermost versions 5.38 and earlier. This vulnerability arises due to insufficient sanitization of clipboard contents, allowing a user-assisted attacker to inject arbitrary web script in product deployments that explicitly disable the default Content Security Policy (CSP).
Vulnerability Detail
The vulnerability in Mattermost allows an attacker to execute cross-site scripting (XSS) attacks. By manipulating the clipboard contents, an attacker can inject malicious web scripts into the application. This can lead to various security risks, such as session hijacking, data theft, and unauthorized actions on behalf of the user. The vulnerability has a CVSS score of 6.1, indicating a moderate severity level.
How To Fix
Latest published version: v5.39.3 as of 23 Oct 2026
go get github.com/mattermost/mattermost-server/v5@v5.39.3
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
5.39.0
This is the first release that contains the fix.
go get github.com/mattermost/mattermost-server/v5@v5.39.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to the latest version is not immediately feasible, a temporary workaround is to enable the default Content Security Policy (CSP) in the Mattermost deployment. By enabling the CSP, the vulnerability can be mitigated by restricting the execution of arbitrary web scripts. The following code snippet demonstrates how to enable the default CSP:
# Set Content Security Policy
Content-Security-Policy: default-src 'self';
Implementing this workaround will provide an additional layer of protection until the upgrade can be performed.
Conclusion
In conclusion, the CVE-2021-37860 vulnerability in Mattermost exposes the application to cross-site scripting (XSS) attacks. Upgrading to the latest version of Mattermost or enabling the default Content Security Policy (CSP) can mitigate this vulnerability. It is crucial to take immediate action to ensure the security of the application and protect against potential exploitation. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for github.com/mattermost/mattermost-server/v5 →
FAQ
The vulnerability allows an attacker to execute cross-site scripting (XSS) attacks, potentially leading to session hijacking, data theft, and unauthorized actions on behalf of the user.
Mattermost versions 5.38 and earlier are affected by this vulnerability.
To fix this vulnerability, it is recommended to upgrade to Mattermost version 5.39.0 or later.
Yes, a temporary workaround is to enable the default Content Security Policy (CSP) in the Mattermost deployment.
The vulnerability has a CVSS score of 6.1, indicating a moderate severity level.
Related vulnerabilities
Recent vulnerabilities recorded for github.com/mattermost/mattermost-server/v5.