Browse Source

first commit

master
rain0r 4 years ago
commit
5cc66868a2
  1. 37
      .classpath
  2. 1
      .gitignore
  3. 23
      .project
  4. 6
      .settings/org.eclipse.core.resources.prefs
  5. 2
      .settings/org.eclipse.jdt.core.prefs
  6. 4
      .settings/org.eclipse.m2e.core.prefs
  7. 1
      doIt.bat
  8. BIN
      lib/sonar-zap-plugin-1.0.0-SNAPSHOT-jar-with-dependencies.jar
  9. 0
      logs/errors.log
  10. 0
      logs/miscenarios.log
  11. 139
      pom - Kopie.xml
  12. 144
      pom.xml
  13. 13
      src/main/java/com/mgm/zapapi/zapapiplayground/App.java
  14. 216
      src/main/java/com/mgm/zapapi/zapapiplayground/SimpleScanner.java
  15. 1115
      src/main/resources/bodgeit.report-1.xml
  16. 838
      src/main/resources/bodgeit.report.xml
  17. 31
      src/main/resources/log4j2.xml
  18. 4
      src/main/resources/zap.properties
  19. 38
      src/test/java/com/mgm/zapapi/zapapiplayground/AppTest.java
  20. 226
      src/test/java/com/mgm/zapapi/zapapiplayground/ReportParserTest.java
  21. 42
      src/test/java/com/mgm/zapapi/zapapiplayground/SimpleZapTest.java
  22. 1602
      src/test/resources/bodgeit.report-1.xml
  23. 843
      src/test/resources/bodgeit.report.xml
  24. 1135937
      zapapiplayground-errors.log
  25. 1136015
      zapapiplayground.log

37
.classpath

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/sonar-zap-plugin-1.0.0-SNAPSHOT-jar-with-dependencies.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

1
.gitignore

@ -0,0 +1 @@
/target/

23
.project

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>regress-bodgeit-vanilla</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

6
.settings/org.eclipse.core.resources.prefs

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

2
.settings/org.eclipse.jdt.core.prefs

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning

4
.settings/org.eclipse.m2e.core.prefs

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

1
doIt.bat

@ -0,0 +1 @@
mvn clean -DskipTests=true findbugs:check findbugs:findbugs compile site install

BIN
lib/sonar-zap-plugin-1.0.0-SNAPSHOT-jar-with-dependencies.jar

0
logs/errors.log

0
logs/miscenarios.log

139
pom - Kopie.xml

@ -0,0 +1,139 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mgm.zapapi</groupId>
<artifactId>zapapiplayground</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>zapapiplayground</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.version>5.1</sonar.version>
<sonar.pluginClass>org.sonar.zaproxy.ZapPlugin</sonar.pluginClass>
<sonar.pluginName>ZAP</sonar.pluginName>
<findbugs.maven.plugin>3.0.4</findbugs.maven.plugin>
<!-- <additionalparam>-Xdoclint:none</additionalparam> -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyy-MM-dd-HH-mm-SS</maven.build.timestamp.format>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.zaproxy</groupId>
<artifactId>zap-clientapi</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>sonar.zap-plugin</groupId>
<artifactId>sonar</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/sonar-zap-plugin-1.0.0-SNAPSHOT-jar-with-dependencies.jar</systemPath>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.staxmate</groupId>
<artifactId>staxmate</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.maven.plugin}</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<!-- or whatever version you use -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.maven.plugin}</version>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
<xmlOutput>true</xmlOutput>
<htmlOutput>true</htmlOutput>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<failOnError>${findbugs-failOnError}</failOnError>
<effort>Max</effort><!-- Min, Default, Max -->
<threshold>Low</threshold><!-- High, Default, Low, Ignore -->
<xmlOutput>true</xmlOutput>
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
<!-- <excludeFilterFile>${basedir}/../findbugs-exclude.xml</excludeFilterFile> -->
</configuration>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.maven.plugin}</version>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

144
pom.xml

@ -0,0 +1,144 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mgm.zapapi</groupId>
<artifactId>zapapiplayground</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>zapapiplayground</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.version>5.1</sonar.version>
<sonar.pluginClass>org.sonar.zaproxy.ZapPlugin</sonar.pluginClass>
<sonar.pluginName>ZAP</sonar.pluginName>
<findbugs.maven.plugin>3.0.4</findbugs.maven.plugin>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyy-MM-dd-HH-mm-SS</maven.build.timestamp.format>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-junit</artifactId>
<version>2.0.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.zaproxy</groupId>
<artifactId>zap-clientapi</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>sonar.zap-plugin</groupId>
<artifactId>sonar</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/sonar-zap-plugin-1.0.0-SNAPSHOT-jar-with-dependencies.jar</systemPath>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.staxmate</groupId>
<artifactId>staxmate</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.maven.plugin}</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<!-- or whatever version you use -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.maven.plugin}</version>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
<xmlOutput>true</xmlOutput>
<htmlOutput>true</htmlOutput>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<failOnError>${findbugs-failOnError}</failOnError>
<effort>Default</effort><!-- Min, Default, Max -->
<threshold>Default</threshold><!-- High, Default, Low, Ignore -->
<xmlOutput>true</xmlOutput>
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
</configuration>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.maven.plugin}</version>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

13
src/main/java/com/mgm/zapapi/zapapiplayground/App.java

@ -0,0 +1,13 @@
package com.mgm.zapapi.zapapiplayground;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

216
src/main/java/com/mgm/zapapi/zapapiplayground/SimpleScanner.java

@ -0,0 +1,216 @@
package com.mgm.zapapi.zapapiplayground;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.zaproxy.clientapi.core.ApiResponse;
import org.zaproxy.clientapi.core.ApiResponseElement;
import org.zaproxy.clientapi.core.ClientApi;
import org.zaproxy.clientapi.core.ClientApiException;
/**
* A simple example showing how to use the API to spider and active scan a site
* and then retrieve and print out the alerts.
* <p>
* ZAP must be running on the specified host and port for this script to work
*/
public class SimpleScanner {
private String zapAddress = null;
private int zapPort;
private String zapApiKey = null;
private String zapTarget = null;
private final String defaultZapAddress = "localhost";
private final String defaultZapPort = "8090";
private final String defaultApiKey = null;
private final String defaultZapTarget = "http://localhost:33006/bodgeit/";
private ClientApi clientApi = null;
private ApiResponse apiResponse = null;
private String scanId = null;
private int progress = 0;
private static final Logger logger = LogManager.getLogger(SimpleScanner.class);
public SimpleScanner(String zapAddress, int zapPort, String zapApiKey, String zapTarget) throws IOException {
setZapAddress(zapAddress);
setZapPort(zapPort);
setZapApiKey(zapApiKey);
setZapAddress(zapTarget);
setClientApi(new ClientApi(zapAddress, zapPort));
}
public SimpleScanner() throws IOException {
try (InputStream inputStream = SimpleScanner.class.getResourceAsStream("/zap.properties")) {
final Properties props = new Properties();
props.load(inputStream);
setZapAddress(props.getProperty("zap.address", defaultZapAddress));
setZapPort(Integer.parseInt(props.getProperty("zap.port", defaultZapPort)));
setZapApiKey(props.getProperty("zap.apikey", defaultApiKey));
setZapTarget(props.getProperty("zap.target", defaultZapTarget));
setClientApi(new ClientApi(getZapAddress(), getZapPort()));
}
}
private final void spider() {
// Start spidering the target
logger.debug("Spider : " + getZapTarget());
// The scan now returns a scan id to support concurrent scanning
setScanId(((ApiResponseElement) getApiResponse()).getValue());
// Poll the status until it completes
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
logger.error(e.getMessage(), e);
}
try {
setProgress(
Integer.parseInt(((ApiResponseElement) getClientApi().spider.status(getScanId())).getValue()));
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
logger.debug("Spider progress : " + getProgress() + "%");
if (getProgress() >= 100) {
break;
}
}
logger.debug("Spider complete");
// Give the passive scanner a chance to complete
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
logger.error(e.getMessage(), e);
}
}
private final void activeScan() {
logger.debug("Active scan : " + getZapTarget());
try {
setApiResponse(
getClientApi().ascan.scan(getZapApiKey(), getZapTarget(), "True", "False", null, null, null));
} catch (ClientApiException e1) {
logger.error("zap.address: " + getZapAddress());
logger.error("zap.port: " + getZapPort());
logger.error("zap.apikey: " + getZapApiKey());
logger.error("zap.target: " + getZapTarget());
logger.error(e1.getMessage(), e1);
}
// The scan now returns a scan id to support concurrent scanning
setScanId(((ApiResponseElement) getApiResponse()).getValue());
// Poll the status until it completes
while (true) {
try {
setProgress(
Integer.parseInt(((ApiResponseElement) getClientApi().ascan.status(getScanId())).getValue()));
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
if (getProgress() >= 100) {
break;
}
}
logger.debug("Active Scan complete");
}
private final byte[] alerts() {
try {
return getClientApi().core.xmlreport(getZapApiKey());
} catch (ClientApiException e) {
logger.error(e.getMessage(), e);
}
return null;
}
public final byte[] run() throws ClientApiException {
final String apiKey = getZapApiKey();
final String apiTarget = getZapTarget();
setApiResponse(getClientApi().spider.scan(apiKey, apiTarget, null, null, null, null));
spider();
activeScan();
final byte[] alerts = alerts();
return alerts;
}
public static void main(String[] args) {
try {
final SimpleScanner simpleExample = new SimpleScanner();
simpleExample.run();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
public final String getZapAddress() {
return zapAddress;
}
public final void setZapAddress(String zapAddress) {
this.zapAddress = zapAddress;
}
public final int getZapPort() {
return zapPort;
}
public final void setZapPort(int zapPort) {
this.zapPort = zapPort;
}
public final String getZapApiKey() {
return zapApiKey;
}
public final void setZapApiKey(String zapApiKey) {
this.zapApiKey = zapApiKey;
}
public final String getZapTarget() {
return zapTarget;
}
public final void setZapTarget(String zapTarget) {
this.zapTarget = zapTarget;
}
public final ClientApi getClientApi() {
return clientApi;
}
public final void setClientApi(ClientApi clientApi) {
this.clientApi = clientApi;
}
public final ApiResponse getApiResponse() {
return apiResponse;
}
public final void setApiResponse(ApiResponse apiResponse) {
this.apiResponse = apiResponse;
}
public final String getScanId() {
return scanId;
}
public final void setScanId(String scanId) {
this.scanId = scanId;
}
public final int getProgress() {
return progress;
}
public final void setProgress(int progress) {
this.progress = progress;
}
}

1115
src/main/resources/bodgeit.report-1.xml
File diff suppressed because it is too large
View File

838
src/main/resources/bodgeit.report.xml

@ -0,0 +1,838 @@
<?xml version="1.0"?><OWASPZAPReport version="2.5.0" generated="Mo, 30 Jan 2017 12:25:41">
<site name="http://localhost:8080" host="localhost" port="8080" ssl="false"><alerts><alertitem>
<pluginid>10016</pluginid>
<alert>Web Browser XSS Protection Not Enabled</alert>
<name>Web Browser XSS Protection Not Enabled</name>
<riskcode>1</riskcode>
<confidence>2</confidence>
<riskdesc>Low (Medium)</riskdesc>
<desc>&lt;p&gt;Web Browser XSS Protection is not enabled, or is disabled by the configuration of the &apos;X-XSS-Protection&apos; HTTP response header on the web server&lt;/p&gt;</desc>
<instances>
<instance>
<uri>http://localhost:8080/bodgeit/</uri>
</instance>
<instance>
<uri>http://localhost:8080/robots.txt</uri>
</instance>
<instance>
<uri>http://localhost:8080/sitemap.xml</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/home.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/about.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/contact.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/login.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/search.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=6</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=5</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=3</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=2</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=7</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=4</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=1</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=28</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=5</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=17</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=24</uri>
</instance>
</instances>
<count>54</count>
<solution>&lt;p&gt;Ensure that the web browser&apos;s XSS filter is enabled, by setting the X-XSS-Protection HTTP response header to &apos;1&apos;.&lt;/p&gt;</solution>
<otherinfo>&lt;p&gt;The X-XSS-Protection HTTP response header allows the web server to enable or disable the web browser&apos;s XSS protection mechanism. The following values would attempt to enable it: &lt;/p&gt;&lt;p&gt;X-XSS-Protection: 1; mode=block&lt;/p&gt;&lt;p&gt;X-XSS-Protection: 1; report=http://www.example.com/xss&lt;/p&gt;&lt;p&gt;The following values would disable it:&lt;/p&gt;&lt;p&gt;X-XSS-Protection: 0&lt;/p&gt;&lt;p&gt;The X-XSS-Protection HTTP response header is currently supported on Internet Explorer, Chrome and Safari (WebKit).&lt;/p&gt;&lt;p&gt;Note that this alert is only raised if the response body could potentially contain an XSS payload (with a text-based content type, with a non-zero length).&lt;/p&gt;</otherinfo>
<reference>&lt;p&gt;https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet&lt;/p&gt;&lt;p&gt;https://blog.veracode.com/2014/03/guidelines-for-setting-security-headers/&lt;/p&gt;</reference>
<cweid>933</cweid>
<wascid>14</wascid>
</alertitem>
<alertitem>
<pluginid>10021</pluginid>
<alert>X-Content-Type-Options Header Missing</alert>
<name>X-Content-Type-Options Header Missing</name>
<riskcode>1</riskcode>
<confidence>2</confidence>
<riskdesc>Low (Medium)</riskdesc>
<desc>&lt;p&gt;The Anti-MIME-Sniffing header X-Content-Type-Options was not set to &apos;nosniff&apos;. This allows older versions of Internet Explorer and Chrome to perform MIME-sniffing on the response body, potentially causing the response body to be interpreted and displayed as a content type other than the declared content type. Current (early 2014) and legacy versions of Firefox will use the declared content type (if one is set), rather than performing MIME-sniffing.&lt;/p&gt;</desc>
<instances>
<instance>
<uri>http://localhost:8080/bodgeit/</uri>
</instance>
<instance>
<uri>http://localhost:8080/robots.txt</uri>
</instance>
<instance>
<uri>http://localhost:8080/sitemap.xml</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/home.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/about.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/contact.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/login.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/search.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=6</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=5</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=3</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=2</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=7</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=4</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=1</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=28</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=5</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=17</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=24</uri>
</instance>
</instances>
<count>54</count>
<solution>&lt;p&gt;Ensure that the application/web server sets the Content-Type header appropriately, and that it sets the X-Content-Type-Options header to &apos;nosniff&apos; for all web pages.&lt;/p&gt;&lt;p&gt;If possible, ensure that the end user uses a standards-compliant and modern web browser that does not perform MIME-sniffing at all, or that can be directed by the web application/web server to not perform MIME-sniffing.&lt;/p&gt;</solution>
<otherinfo>&lt;p&gt;This issue still applies to error type pages (401, 403, 500, etc) as those pages are often still affected by injection issues, in which case there is still concern for browsers sniffing pages away from their actual content type.&lt;/p&gt;&lt;p&gt;At &quot;High&quot; threshold this scanner will not alert on client or server error responses.&lt;/p&gt;</otherinfo>
<reference>&lt;p&gt;http://msdn.microsoft.com/en-us/library/ie/gg622941%28v=vs.85%29.aspx&lt;/p&gt;&lt;p&gt;https://www.owasp.org/index.php/List_of_useful_HTTP_headers&lt;/p&gt;</reference>
<cweid>16</cweid>
<wascid>15</wascid>
</alertitem>
<alertitem>
<pluginid>10020</pluginid>
<alert>X-Frame-Options Header Not Set</alert>
<name>X-Frame-Options Header Not Set</name>
<riskcode>2</riskcode>
<confidence>2</confidence>
<riskdesc>Medium (Medium)</riskdesc>
<desc>&lt;p&gt;X-Frame-Options header is not included in the HTTP response to protect against &apos;ClickJacking&apos; attacks.&lt;/p&gt;</desc>
<instances>
<instance>
<uri>http://localhost:8080/bodgeit/</uri>
</instance>
<instance>
<uri>http://localhost:8080/robots.txt</uri>
</instance>
<instance>
<uri>http://localhost:8080/sitemap.xml</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/home.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/about.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/contact.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/login.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/search.jsp</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=6</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=5</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=3</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=2</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=7</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=4</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?typeid=1</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=28</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=5</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=17</uri>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/product.jsp?prodid=24</uri>
</instance>
</instances>
<count>54</count>
<solution>&lt;p&gt;Most modern Web browsers support the X-Frame-Options HTTP header. Ensure it&apos;s set on all web pages returned by your site (if you expect the page to be framed only by pages on your server (e.g. it&apos;s part of a FRAMESET) then you&apos;ll want to use SAMEORIGIN, otherwise if you never expect the page to be framed, you should use DENY. ALLOW-FROM allows specific websites to frame the web page in supported web browsers).&lt;/p&gt;</solution>
<otherinfo>&lt;p&gt;At &quot;High&quot; threshold this scanner will not alert on client or server error responses.&lt;/p&gt;</otherinfo>
<reference>&lt;p&gt;http://blogs.msdn.com/b/ieinternals/archive/2010/03/30/combating-clickjacking-with-x-frame-options.aspx&lt;/p&gt;</reference>
<cweid>16</cweid>
<wascid>15</wascid>
</alertitem>
<alertitem>
<pluginid>10012</pluginid>
<alert>Password Autocomplete in Browser</alert>
<name>Password Autocomplete in Browser</name>
<riskcode>1</riskcode>
<confidence>2</confidence>
<riskdesc>Low (Medium)</riskdesc>
<desc>&lt;p&gt;The AUTOCOMPLETE attribute is not disabled on an HTML FORM/INPUT element containing password type input. Passwords may be stored in browsers and retrieved.&lt;/p&gt;</desc>
<instances>
<instance>
<uri>http://localhost:8080/bodgeit/login.jsp</uri>
<param>input</param>
<evidence>&lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;password&quot;/&gt;</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/register.jsp</uri>
<param>input</param>
<evidence>&lt;input id=&quot;password1&quot; name=&quot;password1&quot; type=&quot;password&quot;&gt;</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/register.jsp</uri>
<param>input</param>
<evidence>&lt;input id=&quot;password2&quot; name=&quot;password2&quot; type=&quot;password&quot;&gt;</evidence>
</instance>
</instances>
<count>3</count>
<solution>&lt;p&gt;Turn off the AUTOCOMPLETE attribute in forms or individual input elements containing password inputs by using AUTOCOMPLETE=&apos;OFF&apos;.&lt;/p&gt;</solution>
<reference>&lt;p&gt;http://www.w3schools.com/tags/att_input_autocomplete.asp&lt;/p&gt;&lt;p&gt;https://msdn.microsoft.com/en-us/library/ms533486%28v=vs.85%29.aspx&lt;/p&gt;</reference>
<cweid>525</cweid>
<wascid>15</wascid>
</alertitem>
<alertitem>
<pluginid>10010</pluginid>
<alert>Cookie No HttpOnly Flag</alert>
<name>Cookie No HttpOnly Flag</name>
<riskcode>1</riskcode>
<confidence>2</confidence>
<riskdesc>Low (Medium)</riskdesc>
<desc>&lt;p&gt;A cookie has been set without the HttpOnly flag, which means that the cookie can be accessed by JavaScript. If a malicious script can be run on this page then the cookie will be accessible and can be transmitted to another site. If this is a session cookie then session hijacking may be possible.&lt;/p&gt;</desc>
<instances>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23439</param>
<evidence>b_id=23439</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23440</param>
<evidence>b_id=23440</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23441</param>
<evidence>b_id=23441</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23442</param>
<evidence>b_id=23442</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23444</param>
<evidence>b_id=23444</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23443</param>
<evidence>b_id=23443</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23446</param>
<evidence>b_id=23446</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23445</param>
<evidence>b_id=23445</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23448</param>
<evidence>b_id=23448</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23447</param>
<evidence>b_id=23447</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23449</param>
<evidence>b_id=23449</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23450</param>
<evidence>b_id=23450</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23452</param>
<evidence>b_id=23452</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23451</param>
<evidence>b_id=23451</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23453</param>
<evidence>b_id=23453</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23454</param>
<evidence>b_id=23454</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23456</param>
<evidence>b_id=23456</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23455</param>
<evidence>b_id=23455</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23457</param>
<evidence>b_id=23457</evidence>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>b_id=23458</param>
<evidence>b_id=23458</evidence>
</instance>
</instances>
<count>61</count>
<solution>&lt;p&gt;Ensure that the HttpOnly flag is set for all cookies.&lt;/p&gt;</solution>
<reference>&lt;p&gt;http://www.owasp.org/index.php/HttpOnly&lt;/p&gt;</reference>
<cweid>16</cweid>
<wascid>13</wascid>
</alertitem>
<alertitem>
<pluginid>40012</pluginid>
<alert>Cross Site Scripting (Reflected)</alert>
<name>Cross Site Scripting (Reflected)</name>
<riskcode>3</riskcode>
<confidence>2</confidence>
<riskdesc>High (Medium)</riskdesc>
<desc>&lt;p&gt;Cross-site Scripting (XSS) is an attack technique that involves echoing attacker-supplied code into a user&apos;s browser instance. A browser instance can be a standard web browser client, or a browser object embedded in a software product such as the browser within WinAmp, an RSS reader, or an email client. The code itself is usually written in HTML/JavaScript, but may also extend to VBScript, ActiveX, Java, Flash, or any other browser-supported technology.&lt;/p&gt;&lt;p&gt;When an attacker gets a user&apos;s browser to execute his/her code, the code will run within the security context (or zone) of the hosting web site. With this level of privilege, the code has the ability to read, modify and transmit any sensitive data accessible by the browser. A Cross-site Scripted user could have his/her account hijacked (cookie theft), their browser redirected to another location, or possibly shown fraudulent content delivered by the web site they are visiting. Cross-site Scripting attacks essentially compromise the trust relationship between a user and the web site. Applications utilizing browser object instances which load content from the file system may execute code under the local machine zone allowing for system compromise.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;There are three types of Cross-site Scripting attacks: non-persistent, persistent and DOM-based.&lt;/p&gt;&lt;p&gt;Non-persistent attacks and DOM-based attacks require a user to either visit a specially crafted link laced with malicious code, or visit a malicious web page containing a web form, which when posted to the vulnerable site, will mount the attack. Using a malicious form will oftentimes take place when the vulnerable resource only accepts HTTP POST requests. In such a case, the form can be submitted automatically, without the victim&apos;s knowledge (e.g. by using JavaScript). Upon clicking on the malicious link or submitting the malicious form, the XSS payload will get echoed back and will get interpreted by the user&apos;s browser and execute. Another technique to send almost arbitrary requests (GET and POST) is by using an embedded client, such as Adobe Flash.&lt;/p&gt;&lt;p&gt;Persistent attacks occur when the malicious code is submitted to a web site where it&apos;s stored for a period of time. Examples of an attacker&apos;s favorite targets often include message board posts, web mail messages, and web chat software. The unsuspecting user is not required to interact with any additional site/link (e.g. an attacker site or a malicious link sent via email), just simply view the web page containing the code.&lt;/p&gt;</desc>
<instances>
<instance>
<uri>http://localhost:8080/bodgeit/search.jsp?q=%3C%2Ffont%3E%3Cscript%3Ealert%281%29%3B%3C%2Fscript%3E%3Cfont%3E</uri>
<param>q</param>
<attack>&lt;/font&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;font&gt;</attack>
<evidence>&lt;/font&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;font&gt;</evidence>
</instance>
</instances>
<count>1</count>
<solution>&lt;p&gt;Phase: Architecture and Design&lt;/p&gt;&lt;p&gt;Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.&lt;/p&gt;&lt;p&gt;Examples of libraries and frameworks that make it easier to generate properly encoded output include Microsoft&apos;s Anti-XSS library, the OWASP ESAPI Encoding module, and Apache Wicket.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Phases: Implementation; Architecture and Design&lt;/p&gt;&lt;p&gt;Understand the context in which your data will be used and the encoding that will be expected. This is especially important when transmitting data between different components, or when generating outputs that can contain multiple encodings at the same time, such as web pages or multi-part mail messages. Study all expected communication protocols and data representations to determine the required encoding strategies.&lt;/p&gt;&lt;p&gt;For any data that will be output to another web page, especially any data that was received from external inputs, use the appropriate encoding on all non-alphanumeric characters.&lt;/p&gt;&lt;p&gt;Consult the XSS Prevention Cheat Sheet for more details on the types of encoding and escaping that are needed.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Phase: Architecture and Design&lt;/p&gt;&lt;p&gt;For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Phase: Implementation&lt;/p&gt;&lt;p&gt;For every web page that is generated, use and specify a character encoding such as ISO-8859-1 or UTF-8. When an encoding is not specified, the web browser may choose a different encoding by guessing which encoding is actually being used by the web page. This can cause the web browser to treat certain sequences as special, opening up the client to subtle XSS attacks. See CWE-116 for more mitigations related to encoding/escaping.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;To help mitigate XSS attacks against the user&apos;s session cookie, set the session cookie to be HttpOnly. In browsers that support the HttpOnly feature (such as more recent versions of Internet Explorer and Firefox), this attribute can prevent the user&apos;s session cookie from being accessible to malicious client-side scripts that use document.cookie. This is not a complete solution, since HttpOnly is not supported by all browsers. More importantly, XMLHTTPRequest and other powerful browser technologies provide read access to HTTP headers, including the Set-Cookie header in which the HttpOnly flag is set.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Assume all input is malicious. Use an &quot;accept known good&quot; input validation strategy, i.e., use a whitelist of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. Do not rely exclusively on looking for malicious or malformed inputs (i.e., do not rely on a blacklist). However, blacklists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, &quot;boat&quot; may be syntactically valid because it only contains alphanumeric characters, but it is not valid if you are expecting colors such as &quot;red&quot; or &quot;blue.&quot;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Ensure that you perform input validation at well-defined interfaces within the application. This will help protect the application even if a component is reused or moved elsewhere.&lt;/p&gt;</solution>
<reference>&lt;p&gt;http://projects.webappsec.org/Cross-Site-Scripting&lt;/p&gt;&lt;p&gt;http://cwe.mitre.org/data/definitions/79.html&lt;/p&gt;</reference>
<cweid>79</cweid>
<wascid>8</wascid>
</alertitem>
<alertitem>
<pluginid>40018</pluginid>
<alert>SQL Injection</alert>
<name>SQL Injection</name>
<riskcode>3</riskcode>
<confidence>2</confidence>
<riskdesc>High (Medium)</riskdesc>
<desc>&lt;p&gt;SQL injection may be possible.&lt;/p&gt;</desc>
<instances>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>productid</param>
<attack>25-2</attack>
</instance>
</instances>
<count>1</count>
<solution>&lt;p&gt;Do not trust client side input, even if there is client side validation in place. &lt;/p&gt;&lt;p&gt;In general, type check all data on the server side.&lt;/p&gt;&lt;p&gt;If the application uses JDBC, use PreparedStatement or CallableStatement, with parameters passed by &apos;?&apos;&lt;/p&gt;&lt;p&gt;If the application uses ASP, use ADO Command Objects with strong type checking and parameterized queries.&lt;/p&gt;&lt;p&gt;If database Stored Procedures can be used, use them.&lt;/p&gt;&lt;p&gt;Do *not* concatenate strings into queries in the stored procedure, or use &apos;exec&apos;, &apos;exec immediate&apos;, or equivalent functionality!&lt;/p&gt;&lt;p&gt;Do not create dynamic SQL queries using simple string concatenation.&lt;/p&gt;&lt;p&gt;Escape all data received from the client.&lt;/p&gt;&lt;p&gt;Apply a &apos;whitelist&apos; of allowed characters, or a &apos;blacklist&apos; of disallowed characters in user input.&lt;/p&gt;&lt;p&gt;Apply the principle of least privilege by using the least privileged database user possible.&lt;/p&gt;&lt;p&gt;In particular, avoid using the &apos;sa&apos; or &apos;db-owner&apos; database users. This does not eliminate SQL injection, but minimizes its impact.&lt;/p&gt;&lt;p&gt;Grant the minimum database access that is necessary for the application.&lt;/p&gt;</solution>
<otherinfo>&lt;p&gt;The original page results were successfully replicated using the expression [25-2] as the parameter value&lt;/p&gt;&lt;p&gt;The parameter value being modified was NOT stripped from the HTML output for the purposes of the comparison&lt;/p&gt;</otherinfo>
<reference>&lt;p&gt;https://www.owasp.org/index.php/Top_10_2010-A1&lt;/p&gt;&lt;p&gt;https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet&lt;/p&gt;</reference>
<cweid>89</cweid>
<wascid>19</wascid>
</alertitem>
<alertitem>
<pluginid>30001</pluginid>
<alert>Puffer&#252;berlauf</alert>
<name>Puffer&#252;berlauf</name>
<riskcode>2</riskcode>
<confidence>2</confidence>
<riskdesc>Medium (Medium)</riskdesc>
<desc>&lt;p&gt;Buffer overflow errors are characterized by the overwriting of memory spaces of the background web process, which should have never been modified intentionally or unintentionally. Overwriting values of the IP (Instruction Pointer), BP (Base Pointer) and other registers causes exceptions, segmentation faults, and other process errors to occur. Usually these errors end execution of the application in an unexpected way. &lt;/p&gt;</desc>
<instances>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/product.jsp?prodid=23
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_5</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2132
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_28</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_17</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_24</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_30</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_25</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_11</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_21</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_15</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_10</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_26</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_32</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_13</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_18</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_29</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_9</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2132
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_12</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_27</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_16</param>
<attack>POST http://localhost:8080/bodgeit/basket.jsp HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 2133
Referer: http://localhost:8080/bodgeit/basket.jsp
Host: localhost:8080
</attack>
</instance>
</instances>
<count>33</count>
<solution>&lt;p&gt;Schreiben sie das Hintergrundprogramm neu mit der richtigen &#220;berpr&#252;fung des R&#252;ckgabewertes. Danach m&#252;ssen sie das Hintergrundprogramm neu kompilieren.&lt;/p&gt;</solution>
<otherinfo>&lt;p&gt;Potenzieller Puffer&#252;berlauf. Das Skript hat die Verbindung geschlossen und hast einen 500 internen Server-Fehler gemeldet&lt;/p&gt;</otherinfo>
<reference>&lt;p&gt;https://www.owasp.org/index.php/Buffer_overflow_attack&lt;/p&gt;</reference>
<cweid>120</cweid>
<wascid>7</wascid>
</alertitem>
<alertitem>
<pluginid>30002</pluginid>
<alert>Format String Error</alert>
<name>Format String Error</name>
<riskcode>2</riskcode>
<confidence>2</confidence>
<riskdesc>Medium (Medium)</riskdesc>
<desc>&lt;p&gt;A Format String error occurs when the submitted data of an input string is evaluated as a command by the application. &lt;/p&gt;</desc>
<instances>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_28</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_5</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_17</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_24</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_25</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_30</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_11</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_21</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_10</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_15</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_26</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_32</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_13</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_18</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_29</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_9</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_12</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_27</param>
<attack>ZAP</attack>
</instance>
<instance>
<uri>http://localhost:8080/bodgeit/basket.jsp</uri>
<param>quantity_16</param>
<attack>ZAP</attack>
</instance>
</instances>
<count>33</count>
<solution>&lt;p&gt;Rewrite the background program using proper deletion of bad character strings. This will require a recompile of the background executable.&lt;/p&gt;</solution>
<otherinfo>&lt;p&gt;Potential Format String Error. The script closed the connection on a /%s&lt;/p&gt;</otherinfo>
<reference>&lt;p&gt;https://www.owasp.org/index.php/Format_string_attack&lt;/p&gt;</reference>
<cweid>134</cweid>
<wascid>6</wascid>
</alertitem>
</alerts></site></OWASPZAPReport>

31
src/main/resources/log4j2.xml

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG" shutdownHook="disable">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss} %-5level %c{2}: %msg%n" />
</Console>
<RollingFile name="RollingFile" fileName="zapapiplayground.log"
filePattern="$${date:yyyy-MM}/zapapiplayground-%d{yyyy-MM-dd-HH}-%i.log.gz"
append="false">
<PatternLayout pattern="%d{HH:mm:ss} %p %c{1.} %m%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="300 MB" />
</Policies>
<DefaultRolloverStrategy max="1000"
compressionLevel="9">
</DefaultRolloverStrategy>
</RollingFile>
<File name="ErrorFile" fileName="zapapiplayground-errors.log" immediateFlush="false"
append="false">
<PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss} %-5level %logger{36}: %msg%n" />
</File>
</Appenders>
<Loggers>
<Root>
<AppenderRef ref="Console" level="debug" />
<AppenderRef ref="RollingFile" level="debug" />
<AppenderRef ref="ErrorFile" level="error" />
</Root>
</Loggers>
</Configuration>

4
src/main/resources/zap.properties

@ -0,0 +1,4 @@
zap.address=localhost
zap.port=8080
zap.apikey=
zap.target=http://localhost:33006/bodgeit-vanilla/

38
src/test/java/com/mgm/zapapi/zapapiplayground/AppTest.java

@ -0,0 +1,38 @@
package com.mgm.zapapi.zapapiplayground;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}

226
src/test/java/com/mgm/zapapi/zapapiplayground/ReportParserTest.java

@ -0,0 +1,226 @@
/*
* ZAP Plugin for SonarQube
* Copyright (C) 2015 Steve Springett
* steve.springett@owasp.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
package com.mgm.zapapi.zapapiplayground;
import static org.hamcrest.Matchers.equalTo;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Collection;
import java.util.Iterator;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import org.sonar.zaproxy.parser.ReportParser;
import org.sonar.zaproxy.parser.element.AlertItem;
import org.sonar.zaproxy.parser.element.Site;
import org.sonar.zaproxy.parser.element.ZapReport;
public class ReportParserTest {
@Rule
public final ErrorCollector collector = new ErrorCollector();
@Test
public void checkLiveSystem() throws Exception {
final SimpleScanner simpleExample = new SimpleScanner();
final byte[] rawAlerts = simpleExample.run();
final InputStream inputStream = new ByteArrayInputStream(rawAlerts);
parseReport(inputStream);
}
private void parseReport(InputStream inputStream) throws Exception {
final ReportParser parser = new ReportParser();
final ZapReport zapReport = parser.parse(inputStream);
collector.checkThat(zapReport.getVersionZAP(), equalTo("2.5.0"));
final Site site = zapReport.getSite();
final Collection<AlertItem> alerts = site.getAlerts();
collector.checkThat((alerts.size()), equalTo(13));
for (final Iterator<AlertItem> iter = alerts.iterator(); iter.hasNext();) {
final AlertItem element = iter.next();
switch (element.getPluginid()) {
case 10010:
cookieNoHttpOnlyFlag(element);
break;
case 10012:
passwordAutocompleteInBrowser(element);
break;
case 10016:
webBrowserXssProtectionNotEnabled(element);
break;
case 10020:
xFrameOptionsHeaderNotSet(element);
break;
case 10021:
xContentTypeOptionsHeaderMissing(element);
break;
case 10026:
httpParameterOverride(element);
break;
case 10202:
absenceOfAntiCsrfTokens(element);
break;
case 20012:
antiCsrfTokensScanner(element);
break;
case 30002:
formatStringError(element);
break;
case 30003:
integerOverflowError(element);
break;
case 30001:
bufferOverflow(element);
break;
case 40012:
crossSiteScriptingReflected(element);
break;
case 40018:
sqlInjection(element);
break;
case 40026:
crossSiteScriptingDomBased(element);
break;
default:
throw new Exception("Unexcpected alert");
}
}
}
private final void crossSiteScriptingDomBased(AlertItem element) {
collector.checkThat((element.getRiskcode()), equalTo(3));
collector.checkThat((element.getConfidence()), equalTo(2));
collector.checkThat((element.getCount()), equalTo(2));
collector.checkThat((element.getCweid()), equalTo(79));
collector.checkThat((element.getWascid()), equalTo(8));
}
private final void integerOverflowError(AlertItem element) {
collector.checkThat((element.getRiskcode()), equalTo(2));
collector.checkThat((element.getConfidence()), equalTo(2));
collector.checkThat((element.getCount()), equalTo(42));
collector.checkThat((element.getCweid()), equalTo(190));
collector.checkThat((element.getWascid()), equalTo(3));
}
private final void antiCsrfTokensScanner(AlertItem element) {
collector.checkThat((element.getRiskcode()), equalTo(3));
collector.checkThat((element.getConfidence()), equalTo(2));
collector.checkThat((element.getCount()), equalTo(6));
collector.checkThat((element.getCweid()), equalTo(352));
collector.checkThat((element.getWascid()), equalTo(9));
}
private final void absenceOfAntiCsrfTokens(AlertItem element) {
collector.checkThat((element.getRiskcode()), equalTo(1));
collector.checkThat((element.getConfidence()), equalTo(2));
collector