Support
Invicti Shark (IAST and SCA)

Deploying Invicti Shark (IAST) for Node.js – Docker

This document is for:
Invicti Enterprise On-Demand, Invicti Enterprise On-Premises

Invicti 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.

  • Node.js is an open-source server environment designed to build scalable network applications, as it is capable of handling a vast number of simultaneous connections with high throughput. Depending on the specific frameworks and libraries, debugging a Node.js application can be tricky though.
  • You can take advantage of Invicti’s unique DAST-induced IAST approach to get an inside view into how security checks and test payloads are processed within these environments. These additional insights will let you isolate the location and root cause of security defects quickly.

For further information, Invicti adds IAST support for Node.js.

The most principled way of deploying Invicti Shark in a Docker scenario is to simply layer the Shark modifications onto your already existing container definition. 

The following example demonstrates how you can deploy the Shark together with your web application.

Step 1. Downloading the Shark sensor

For this example, we will assume that the URL for your target is http://invictiexample.com:60000.

  1. Log in to Invicti Enterprise.
  2. From the main menu, select Scans > New Scan.
  3. Choose a Target URL.
  4. From the Scan Settings, select Shark (IAST and SCA).
  5. From the Shark Settings, select Enable Shark.
  6. From the Server Platform drop-down, select Nodejs, then Save As.

Invicti downloads the following .tar file: Shark(IAST and SCA).tar

Change the name of the TAR file into this: SharkNodeJs.tar

Step 2. Defining the web application image

The following file structure defines the simple web application.

/testnodejs-docker/

/testnodejs-docker/Dockerfile

/testnodejs-docker/src/app.js

/testnodejs-docker/src/package.json

  1. Create your /testnodejs-docker/Dockerfile file to read as follows:
FROM node:12

COPY src/ .
RUN npm install

#setup and install Invicti Shark
COPY SharkNodeJs.tar /shark/node-shark.tar
RUN chmod +x /shark/node-shark.tar
# launch the app with Invicti Shark
CMD [ "npx", "/shark/node-shark.tar", "app.js" ]
  1. Create your /testnodejs-docker/src/app.js file to read as follows:
const app = require('express')();
const port = 60000;

app.get('/', function (req, res) {
  res.send(
  '<html><body>' +
  '<h1>Shark(IAST) Example for Node.JS</h1>' +
  '<br>' +
  'Hello World! - Main Page' +
  '<br>' +
  '<a href="/page1">Go to Page 1</a>' +
  '</body></html>'
  );
});
app.get('/page1', function (req, res) {
  res.send(
  '<html><body>' +
  '<h1>Shark(IAST) Example for Node.JS</h1>' +
  '<br>' +
  'Hello World! - Page 1' +
  '<br>' +
  '<a href="/">Go to Main Page</a>' +
  '</body></html>'
  );
});
app.listen(port, function(err){
  if (err) console.log(err);
  console.log("Server listening on port: ", port);
});
  1. Create your /testnodejs-docker/src/package.json file to read as follows:
{
  "name": "testnodejs-docker",
  "version": "1.0.0",
  "dependencies": {
    "express": "*"
  }
}

Step 3. Building and running the docker image

Build and run your image with:

cd /testnodejs-docker
docker build -t testnodejs-docker .
docker run -d -p 60000:60000 --name mytestnodejs testnodejs-docker

Step 4. Testing and scanning your web application

Point your browser to your web application – in this example http://invictiexample.com:60000 to confirm it is running as intended.

Run a scan on your URL. The scan summary displays whether Invicti Shark is used for the scan.

Invicti Help Center

Our Support team is ready to provide you with technical help.

Go to Help Center This will redirect you to the ticketing system.