Security context
MediumGHSA-w5v7-q2j4-fvpf CVE-2015-1812CWE-79Published May 17, 2022

Jenkins Cross-site Scripting vulnerability

Research this vulnerability

Research is free — Hunters explains how the bug works, the root-cause code pattern, how the fix addresses it, and how to test whether a target is affected, in chat. Investigate & write exploit is a paid run — the engine reads the advisory and fix commits, then builds and validates a working proof-of-concept exploit with reproduction steps.

Affected versions

0 → fixed in 1.596.21.600 → fixed in 1.606

Details

Cross-site scripting (XSS) vulnerability in Jenkins before 1.606 and LTS before 1.596.2 allows remote attackers to inject arbitrary web script or HTML via unspecified vectors, a different vulnerability than CVE-2015-1813.

The fix

[FIXED SECURITY-171]

Kohsuke Kawaguchi· Mar 7, 2015, 06:28 PM+101feb2703adb
core/src/main/java/hudson/util/FormValidation.java+1 1
@@ -196,7 +196,7 @@ private static FormValidation _error(Kind kind, Throwable e, String message) {
" <a href='#' class='showDetails'>"
+ Messages.FormValidation_Error_Details()
+ "</a><pre style='display:none'>"
- + Functions.printThrowable(e) +
+ + Util.escape(Functions.printThrowable(e)) +
"</pre>",kind
);
}
core/src/test/java/hudson/util/FormValidationTest.java | 9 +++++++++
1 file changed, 9 insertions(+)
core/src/test/java/hudson/util/FormValidationTest.java+9 0
@@ -23,6 +23,10 @@
*/
package hudson.util;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+
import junit.framework.TestCase;
/**
@@ -51,4 +55,9 @@ public void testValidateRequired_Empty() {
public void testMessage() {
assertEquals("test msg", FormValidation.errorWithMarkup("test msg").getMessage());
}
+
+ public void testFormValidationException() {
+ FormValidation fv = FormValidation.error(new Exception("<html"), "Message<html");
+ assertThat(fv.renderHtml(), not(containsString("<html")));
+ }
}

[SECURITY-171] test

=?UTF-8?q?Oliver=20Gond=C5=BEa?=· Mar 7, 2015, 07:32 PM+90f880d8d2cd
core/src/test/java/hudson/util/FormValidationTest.java+9 0
@@ -23,6 +23,10 @@
*/
package hudson.util;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+
import junit.framework.TestCase;
/**
@@ -51,4 +55,9 @@ public void testValidateRequired_Empty() {
public void testMessage() {
assertEquals("test msg", FormValidation.errorWithMarkup("test msg").getMessage());
}
+
+ public void testFormValidationException() {
+ FormValidation fv = FormValidation.error(new Exception("<html"), "Message<html");
+ assertThat(fv.renderHtml(), not(containsString("<html")));
+ }
}

[FIXED SECURITY-171]

Kohsuke Kawaguchi· Mar 7, 2015, 06:28 PM+11feb2703adb
core/src/main/java/hudson/util/FormValidation.java+1 1
@@ -196,7 +196,7 @@ private static FormValidation _error(Kind kind, Throwable e, String message) {
" <a href='#' class='showDetails'>"
+ Messages.FormValidation_Error_Details()
+ "</a><pre style='display:none'>"
- + Functions.printThrowable(e) +
+ + Util.escape(Functions.printThrowable(e)) +
"</pre>",kind
);
}

References