Contact Support


Deploying Netsparker Shark agent for Java - Docker Spring Boot

Netsparker Shark enables you to carry out interactive security testing (IAST) in your web application in order to confirm more vulnerabilities and further minimize false positives. For Netsparker Shark to operate, you need to download an agent and deploy it on your server. Please note that this agent is generated uniquely for each target website for security reasons.

This topic explains how to deploy Shark together with your Spring Boot web application into a Docker container.

The Java Shark requires:
  • Deploying aspectjweaver.jar into your web server - provides the integration required for the Shark to work with your application
  • Deploying the Netsparker Java Shark into your web server - this is unique for each target and can be downloaded by using the Download Java Shark button
  • Configuring your web server to use Load Time Weaving (AspectJWeaver)
This document assumes:
  • You will be using version 1.9.5 (latest at time of writing) of AspectJWeaver.
  • You are logged into the docker host as root, and all files for this web application will be kept in the folder "/root/myspringapp/"

Deploying Netsparker Shark in Java - Docker Spring Boot consists of 5 steps:

Before, going into details, you need to run the following command on the docker host to prepare the folder for the deployment: mkdir /root/myspringapp/

1. Deploying AspectJWeaver for your container

  • Open terminal
  • Run the following commands to download and deploy AspectJWeaver:
    • cd /root/myspringapp/
    • wget -c
    • mv aspectjweaver-1.9.5.jar aspectjweaver.jar

2. Deploying Netsparker Shark for your container

  • Create a target website in Netsparker for the exact URL of your new web application (for example )
  • Download the Netsparker Shark for Java for your web application target
  • Copy the Netsparker Shark (Shark.jar) to the docker host into folder /root/myspringapp/

3. Preparing Spring Boot

  • Build your application called, for this example, myspringapp.jar
  • Copy the JAR file for your web application myspringapp.jar to the docker host folder /root/myspringapp/

4. Create Dockerfile

  • Run the following command to create and edit your Dockerfile: nano /root/myspringapp/Dockerfile
  • Edit the contents of your Dockerfile to show the following:
FROM openjdk:8-jdk-alpine
COPY Shark.jar Shark.jar
COPY aspectjweaver.jar aspectjweaver.jar
COPY myspringapp.jar myspringapp.jar
CMD java -javaagent:aspectjweaver.jar -Dacusensor.debug.log=ON -Dloader.path=Shark.jar -cp myspringapp.jar  org.springframework.boot.loader.PropertiesLauncher
  • Save the Dockerfile and exit the nano editor

5. Build your Docker Image and Start a Container

  • Run the following commands on the docker host:
  • cd /root/myspringapp/
  • docker build -t myspringapp:test
  • docker run --publish 8080:8080 --detach --name myspringapp myspringapp:test

Now, you are ready to scan your new Spring Boot web application with Netsparker.


Highly accurate, fast & easy-to-use Web Application Security Scanner

Get a demo