Skip to content
Open dashboard (opens in a new tab)

Scans

Scan applications on private networks

NightVision can scan an application that the internet cannot reach: a service on your laptop, a container on a CI worker, a pod in a Kubernetes cluster, a host in a data center. You run the NightVision CLI on a machine that can reach the application, and the CLI carries the scan’s traffic to it.

There is nothing to deploy. No agent, no inbound firewall rule, no VPN to NightVision. The CLI makes outbound connections only, and they last only as long as the scan.

The scanners run in the NightVision cloud. The Smart Proxy is the link between them and the CLI on your network.

A diagram of a private scan in five steps. On your laptop, the NightVision CLI asks the NightVision app for a scan. The app starts the scanners in the NightVision cloud. The scanners send their requests to the Smart Proxy, the Smart Proxy passes them to the CLI, and the CLI sends them to the application on localhost port 8080.
A private scan: the scanners reach your application through the Smart Proxy and the CLI.
  1. You run nightvision scan. The CLI asks NightVision to start a scan.
  2. NightVision starts the scanners.
  3. The scanners send their requests to the Smart Proxy.
  4. The Smart Proxy passes them down the connection the CLI opened.
  5. The CLI sends each request to the application and returns the response the same way.

The browser that signs in and crawls, and the checks that attack, all run in the NightVision cloud. Only their HTTP traffic passes through your machine. Results appear in the dashboard like any other scan.

What this means in practice:

  • The CLI must be able to reach the application. It checks before the scan starts and stops with an error if it cannot.
  • The CLI must be able to reach NightVision over outbound HTTPS. See Network access for the hosts to allow.
  • Keep the CLI running until the scan finishes. If the machine sleeps or the job is killed, the scanners lose their path to the application.

Public or private: how NightVision decides

Section titled “Public or private: how NightVision decides”

When you add an application, NightVision tests whether its URL answers from the internet. If it does not, the application is private. The New application dialog marks such a URL May be private, and the application’s page shows “private” beside its type.

The CLI makes the same test each time it starts a scan:

  • The URL answers from the internet: the scan runs straight from the NightVision cloud.
  • It does not: the scan runs through the Smart Proxy.

To send a scan through the Smart Proxy even though the URL is public, add --force-private-scan. Use it when the public address sits behind a WAF or an IP allowlist and you want the traffic to come from your own network instead:

Terminal window
nightvision scan customer-portal --force-private-scan

In the CLI an application is called a target.

  1. Install the CLI on a machine that can reach the application, and sign in:

    Terminal window
    nightvision login

    In a pipeline, set a NIGHTVISION_TOKEN instead. See API tokens.

  2. Create the application, if it does not exist yet:

    Terminal window
    nightvision target create local-app http://localhost:3000 --type WEB
  3. Scan it:

    Terminal window
    nightvision scan local-app

Add --auth with the name of an authentication to scan signed in. See Authentication.

You can set a private scan up in the dashboard and let it write the command.

  1. Select New scan and choose the application.
  2. Set the authentication, duration and checks as usual.
  3. Under Where it runs, CLI helper (private network) is already selected for a private application, and NightVision Cloud is disabled. For a public application, select CLI helper (private network) yourself.
  4. Select Generate command.
  5. Copy the command and run it on a machine that can reach the application. There is a macOS and Linux version and a Windows PowerShell version.
  6. Select I started the scan to go to Scans and watch it.
The panel titled Run this scan from the NightVision CLI. It says to paste the command on a machine that can reach customer-portal, offers macOS and Linux and Windows PowerShell tabs, and shows a nightvision scan command with a project id and a 60 minute duration. Below are the buttons I started the scan and Back to setup.
The CLI helper turns your scan setup into a command.

Rescan works the same way. On a private application it opens Run this scan from the CLI with the command for the same application, project and authentication.

The dialog titled Run this scan from the CLI. It says this looks like a private application, so NightVision may not reach it directly, and shows a nightvision scan command with a project id and an authentication name. A note says to make sure your environment has network access to the application.
Rescan on a private application gives you the CLI command.

What is different for a private application

Section titled “What is different for a private application”
  • No schedules. A schedule runs from the NightVision cloud, which cannot reach the application. Run private scans on a timer from your own pipeline or scheduler instead. See Scan from a pipeline.
  • No leaked credential check. It runs only on NightVision Cloud. See Leaked credential check.
  • The command carries the setup. The CLI helper puts your authentication, duration, exclusions and switched-off checks into the command. Choices about single custom Nuclei templates are not part of it. From the CLI, skip a template with --disable-nuclei-templates. See Custom Nuclei templates.

Everything else is the same: recorded logins, API specs, findings, Coverage, exports.

Run it wherever the application’s address resolves and connects.

Your pipeline builds the application, starts it in a container on the worker, and scans it at localhost before it is deployed anywhere.

A diagram of a private scan from a CI worker. The NightVision CLI and a web application in a container on localhost port 3000 both run on the worker. The CLI requests the scan, the scanners in the NightVision cloud send requests through the Smart Proxy to the CLI, and the CLI sends them to the container.
Scanning a container on the CI worker that built it.
Terminal window
nightvision target create local-app http://localhost:3000 --type WEB
nightvision scan local-app

The pipeline guides have complete examples for GitHub Actions, GitLab, Azure DevOps, Bitbucket and Jenkins.

Run the CLI in a pod or a job inside the cluster, where the service’s cluster DNS name resolves. This example scans a service called orders in the prod namespace, at its cluster DNS name orders.prod.svc.

A diagram of a private scan inside a Kubernetes cluster. The NightVision CLI and a REST API service at orders.prod.svc port 443 both run in the cluster. The scanners in the NightVision cloud reach the service through the Smart Proxy and the CLI.
Scanning a service from inside its Kubernetes cluster.
Terminal window
nightvision target create orders-api https://orders.prod.svc:443 --type API --spec-file openapi.yaml
nightvision scan orders-api

Run the CLI on any host on the internal network that can connect to the API.

A diagram of a private scan in a data center. The NightVision CLI and a REST API at vuln.api.internal port 8080 are both in the data center. The scanners in the NightVision cloud reach the API through the Smart Proxy and the CLI.
Scanning an internal API from a host in the same data center.
Terminal window
nightvision target create vuln-api http://vuln.api.internal:8080 --type API --spec-file openapi.yaml
nightvision scan vuln-api

--type API with --spec-file creates an API application from its OpenAPI spec. Use --type WEB for a web application. See API specs.

An application the internet can reach needs no CLI and no Smart Proxy. Start the scan from the dashboard, the CLI or the API, and the scanners connect to it directly.

A diagram of a public scan in three steps. You request a scan from a browser or the CLI, the NightVision app starts the scanners in the NightVision cloud, and the scanners scan the application on the public internet directly.
A public application is scanned straight from the NightVision cloud.

If a public application sits behind a firewall or a WAF that blocks the scanners, either allow NightVision’s addresses or scan through the Smart Proxy with --force-private-scan. See the FAQ and Troubleshooting scans.