Skip to content

Commit 915d097

Browse files
committed
Fix two things:
1) URL Decode all getHeader() values since it doesn't do that by default, unlike getParameter() and all the other common sources. 2) Change the XSS test cases using headers to use the referer header, rather than a custom header. We feel an attacker could only affect the referer header. An attacker would have to use an existing XSS vuln to affect a custom header. These introduce minor changes in many different test cases.
1 parent 5ffc28d commit 915d097

File tree

524 files changed

+1812
-626
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

524 files changed

+1812
-626
lines changed

runBenchmark_wContrast.bat

100755100644
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
@ECHO OFF
2-
IF EXIST tools\Contrast\contrast.jar (
3-
IF EXIST tools\Contrast\working (
4-
DEL /F /Q tools\Contrast\contrast.log
1+
@ECHO OFF
2+
IF EXIST tools\Contrast\contrast.jar (
3+
IF EXIST tools\Contrast\working (
4+
DEL \F \Q tools\Contrast\contrast.log
55

6-
RMDIR /S /Q tools\Contrast\cache
6+
RMDIR \S tools\Contrast\cache
77

8-
ECHO ""
8+
ECHO ""
99

10-
ECHO "Previous Contrast results have been removed"
10+
ECHO Previous Contrast results have been removed
1111

12-
ECHO ""
13-
)
14-
CALL mvn clean package cargo:run -Pdeploywcontrast
12+
ECHO ""
13+
)
14+
CALL mvn clean package cargo:run -Pdeploywcontrast
1515

16-
ECHO "Copying Contrast reports to results directory"
16+
ECHO Copying Contrast reports to results directory
1717

1818
COPY tools\Contrast\working\contrast.log results\Benchmark_1.2beta-Contrast.log
19-
20-
) ELSE (
21-
ECHO "Contrast is a commercial product, so you need a licensed version of Contrast in order to run it on the Benchmark. If you have access to Contrast, download the Contrast Agent for Java (contrast.jar) from the Team Server and put it into the /tools/Contrast folder, and then rerun this script."
22-
)
19+
20+
) ELSE (
21+
ECHO Contrast is a commercial product, so you need a licensed version of Contrast in order to run it on the Benchmark. If you have access to Contrast, download the Contrast Agent for Java (contrast.jar) from the Team Server and put it into the /tools/Contrast folder, and then rerun this script.
22+
)

runBenchmark_wContrast.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ if [ -f tools/Contrast/contrast.jar ]; then
2020

2121
else
2222

23-
echo "Given that Contrast is a commercial product, you have to have a licensed version of Contrast in order to run it on the Benchmark. If you have access to Contrast, download the Contrast Agent (contrast.jar) from the Team Server and put it into the /tools/Contrast folder, and then rerun this script."
23+
echo "Contrast is a commercial product, so you need a licensed version of Contrast in order to run it on the Benchmark. If you have access to Contrast, download the Contrast Agent for Java (contrast.jar) from the Team Server and put it into the /tools/Contrast folder, and then rerun this script."
2424

2525
fi

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00005.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
4444

4545
String param = request.getHeader("vector");
4646
if (param == null) param = "";
47-
47+
param = java.net.URLDecoder.decode(param, "UTF-8");
4848

4949
// Code based on example from:
5050
// http://examples.javacodegeeks.com/core-java/crypto/encrypt-decrypt-file-stream-with-des/

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00006.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
4444

4545
String param = request.getHeader("vector");
4646
if (param == null) param = "";
47-
47+
param = java.net.URLDecoder.decode(param, "UTF-8");
4848

4949
java.util.List<String> argList = new java.util.ArrayList<String>();
5050

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00007.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
4444

4545
String param = request.getHeader("vector");
4646
if (param == null) param = "";
47+
param = java.net.URLDecoder.decode(param, "UTF-8");
4748

4849

4950
String cmd = org.owasp.benchmark.helpers.Utils.getInsecureOSCommandString(this.getClass().getClassLoader());

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00008.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
4444

4545
String param = request.getHeader("vector");
4646
if (param == null) param = "";
47-
47+
param = java.net.URLDecoder.decode(param, "UTF-8");
4848

4949
String sql = "{call " + param + "}";
5050

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00011.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
4747
if (headers.hasMoreElements()) {
4848
param = headers.nextElement(); // just grab first element
4949
}
50+
param = java.net.URLDecoder.decode(param, "UTF-8");
5051

5152

5253
java.io.File fileTarget = new java.io.File(param, "/Test.txt");

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00012.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
4747
if (headers.hasMoreElements()) {
4848
param = headers.nextElement(); // just grab first element
4949
}
50+
param = java.net.URLDecoder.decode(param, "UTF-8");
5051

5152

5253
org.owasp.benchmark.helpers.LDAPManager ads = new org.owasp.benchmark.helpers.LDAPManager();

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00013.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
4343

4444

4545
String param = "";
46-
java.util.Enumeration<String> headers = request.getHeaders("vector");
46+
java.util.Enumeration<String> headers = request.getHeaders("referer");
4747
if (headers.hasMoreElements()) {
4848
param = headers.nextElement(); // just grab first element
4949
}
50-
50+
param = java.net.URLDecoder.decode(param, "UTF-8");
5151

5252
Object[] obj = { "a", "b" };
5353
response.getWriter().format(java.util.Locale.US,param,obj);

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00014.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
4343

4444

4545
String param = "";
46-
java.util.Enumeration<String> headers = request.getHeaders("vector");
46+
java.util.Enumeration<String> headers = request.getHeaders("referer");
4747
if (headers.hasMoreElements()) {
4848
param = headers.nextElement(); // just grab first element
4949
}
50-
50+
param = java.net.URLDecoder.decode(param, "UTF-8");
5151

5252
Object[] obj = { "a", "b" };
5353
response.getWriter().format(param,obj);

0 commit comments

Comments
 (0)