CVE-2021-21610: XSS
A flaw was found in jenkins. A cross-site scripting (XSS) vulnerability is possible due to the lack of restrictions in URL rendering in the formatted previews of markup passed as a query parameter if the configured markup formatter does not prohibit unsafe elements in the markup. The highest threat from this vulnerability is to data confidentiality and integrity.
Other sources
Jenkins 2.274 and earlier, LTS 2.263.1 and earlier does not implement any restrictions for the URL rendering a formatted preview of markup passed as a query parameter, resulting in a reflected cross-site scripting (XSS) vulnerability if the configured markup formatter does not prohibit unsafe elements (JavaScript) in markup.
Jenkins allows administrators to choose the markup formatter to use for descriptions of jobs, builds, views, etc. displayed in Jenkins. When editing such a description, users can choose to have Jenkins render a formatted preview of the description they entered.
Jenkins 2.274 and earlier, LTS 2.263.1 and earlier does not implement any restrictions for the URL rendering the formatted preview of markup passed as a query parameter. This results in a reflected cross-site scripting (XSS) vulnerability if the configured markup formatter does not prohibit unsafe elements (JavaScript) in markup, like Anything Goes Formatter Plugin.
Jenkins 2.275, LTS 2.263.2 requires that preview URLs are accessed using POST and sets Content-Security-Policy headers that prevent execution of unsafe elements when the URL is accessed directly.
In case of problems with this change, these protections can be disabled by setting the Java system properties hudson.markup.MarkupFormatter.previewsAllowGET to true and/or hudson.markup.MarkupFormatter.previewsSetCSP to false. Doing either is discouraged.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/jenkinsto a version that resolves this vulnerability.Fixed in 0:2.263.3.1612433584-1.el7 - Upgrade
Upgrade
redhat/conmonto a version that resolves this vulnerability.Fixed in 2:2.0.21-1.rhaos4.5.el7 - Upgrade
Upgrade
redhat/jenkinsto a version that resolves this vulnerability.Fixed in 0:2.263.3.1612434332-1.el7 - Upgrade
Upgrade
redhat/machine-config-daemonto a version that resolves this vulnerability.Fixed in 0:4.5.0-202102050524.p0.git.2594.ff3b8c0.el8 - Upgrade
Upgrade
redhat/openshiftto a version that resolves this vulnerability.Fixed in 0:4.5.0-202102050524.p0.git.0.9229406.el7 - Upgrade
Upgrade
redhat/openshift-ansibleto a version that resolves this vulnerability.Fixed in 0:4.5.0-202102031005.p0.git.0.c6839a2.el7 - Upgrade
Upgrade
redhat/openshift-clientsto a version that resolves this vulnerability.Fixed in 0:4.5.0-202102051529.p0.git.3612.61b096a.el8 - Upgrade
Upgrade
redhat/runcto a version that resolves this vulnerability.Fixed in 0:1.0.0-72.rhaos4.5.giteadfc6b.el8 - Upgrade
Upgrade
redhat/jenkinsto a version that resolves this vulnerability.Fixed in 0:2.263.3.1612434510-1.el8 - Upgrade
Upgrade
maven/org.jenkins-ci.main:jenkins-coreto a version that resolves this vulnerability.Fixed in 2.275 - Upgrade
Upgrade
maven/org.jenkins-ci.main:jenkins-coreto a version that resolves this vulnerability.Fixed in 2.263.2 - Upgrade
Upgrade
redhat/jenkinsto a version that resolves this vulnerability.Fixed in 2.275 - Upgrade
Upgrade
redhat/jenkins LTSto a version that resolves this vulnerability.Fixed in 2.263.2 - Upgrade
Upgrade
jenkinsto a version that resolves this vulnerability.Fixed in 2.275 - Upgrade
Upgrade
jenkinsto a version that resolves this vulnerability.Fixed in 2.263.2 - Configuration
Set hudson.markup.MarkupFormatter.previewsAllowGET to false to avoid allowing GET-based access to formatted preview URLs.
Jenkins (Java system properties) hudson.markup.MarkupFormatter.previewsAllowGET = false - Configuration
Ensure hudson.markup.MarkupFormatter.previewsSetCSP is true so Jenkins sets Content-Security-Policy headers that prevent execution of unsafe elements when preview URLs are accessed directly.
Jenkins (Java system properties) hudson.markup.MarkupFormatter.previewsSetCSP = true - Compensating control
Avoid using the Anything Goes Formatter Plugin (anything-goes-formatter) as the markup formatter, since the XSS can occur if the configured markup formatter does not prohibit unsafe (JavaScript) elements in markup.
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is the severity of CVE-2021-21610?
The severity of CVE-2021-21610 is high.
How does CVE-2021-21610 affect Jenkins?
CVE-2021-21610 is a cross-site scripting (XSS) vulnerability in Jenkins that allows for potential attacks due to the lack of restrictions in URL rendering.
Which versions of Jenkins are affected by CVE-2021-21610?
Jenkins versions 2.274 and earlier LTS 2.263.1 and earlier are affected by CVE-2021-21610.
How can I fix CVE-2021-21610?
To fix CVE-2021-21610, update Jenkins to version 2.275 or Jenkins LTS to version 2.263.2.
Where can I find more information about CVE-2021-21610?
You can find more information about CVE-2021-21610 on the Red Hat website.