We would love to hear your feedback, and are here to help should you encounter any problems. Please contact StackHawk Support .

Table of contents


To troubleshoot hawkscan errors related to networking, disk access or unexplained failures it may be necessary to inspect the hawkscan docker container itself.

Add the --entrypoint=bash option to your docker command to start the hawkscan container without running the usual entrypoint, the shawk command.

docker run -e API_KEY=$HAWK_API_KEY --rm --name hawkscan --entrypoint=bash -v $(pwd):/hawk -it stackhawk/hawkscan 

After running the above command you will be at bash terminal in the hawkscan container as the zap (steve as of hawkscan 4.0.0) user in the /zap (/steve as of hawkscan 4.0.0) directory.

Networking Option

If the scanner is having trouble connecting to an application running on localhost, try adding the --network=host option.

docker run -e API_KEY=$HAWK_API_KEY --rm --name hawkscan --network=host -v $(pwd):/hawk -it stackhawk/hawkscan 

Inspect scan logs

In order to retrieve scan logs, run the command hawk download log {scanId} with the StackHawk CLI or in the bash terminal of the HawkScan Docker container. More details on this can be found in the StackHawk CLI Documentation

Inspect local Docker scan logs

Run the shawk command in the bash terminal to kick off a scan.

$ shawk

When the shawk command completes you can check the log files for errors of interest.

HawkScan 4.0.0 and greater

$ cat /home/steve/.hawk/logs/hawkscan.log /home/steve/.hawk/sessions/*/hawkscan.log

The /home/zap/.hawk/logs/hawkscan.log (/home/steve/.hawk/logs/hawkscan.log as of hawkscan 4.0.0) file contains logs from the startup process and can be useful when troubleshooting connectivity issues to the StackHawk platform and for inspecting the command created for the HSTE scanner process.

The /home/zap/.hawk/sessions/*/hawkscan.log (/home/steve/.hawk/sessions/*/hawkscan.log as of hawkscan 4.0.0) file contains the HSTE scan log. The * is a replacement for the session directory that is created at runtime. The real directory will be the scan UUID ie: d5b30c85-5936-489c-b530-1977e07685b7.

The /hawk volume mount

Sometimes the scanner may not have the correct permissions to access the host volume mount specified with the -v $(pwd):/hawk option.

Check the permissions of the /hawk directory by running…

$ ls -lah /hawk

Read permissions to the /hawk directory will be required for the zap (steve as of hawkscan 4.0.0) user in the hawkscan container.

Disk permissions and access

In some cases running the hawkscan container as the root user is required for hawkscan to access the docker host machines file system. In this case you can run the docker command with the --user=root flag.

docker run -e API_KEY=$HAWK_API_KEY --rm --name hawkscan --user=root -v $(pwd):/hawk -it stackhawk/hawkscan 

Script debugging

To debug your custom scripts you should take advantage of logging your scripts activity with a logger.

import org.apache.log4j.LogManager
val logger = LogManager.getLogger("my-script")

From the hawkscan container bash terminal run the shawk command and look for the log statements from your script.

$ shawk

As a single command…

docker run -e API_KEY=$HAWK_API_KEY --rm --name hawkscan --entrypoint=bash -v $(pwd):/hawk -it stackhawk/hawkscan -c 'shawk; cat zap.out | grep my-script'

HawkScan versions before 4.0.0

$ cat /home/zap/.hawk/sessions/*/hawkscan.log | grep my-script

HawkScan 4.0.0 and greater

$ cat /home/steve/.hawk/sessions/*/hawkscan.log | grep my-script

As a single command…

HawkScan prior to 4.0.0

docker run -e API_KEY=$HAWK_API_KEY --rm --name hawkscan --entrypoint=bash -v $(pwd):/hawk -it stackhawk/hawkscan -c 'shawk; cat /home/zap/.hawk/sessions/*/hawkscan.log | grep my-script'

HawkScan 4.0.0 and greater

docker run -e API_KEY=$HAWK_API_KEY --rm --name hawkscan --entrypoint=bash -v $(pwd):/hawk -it stackhawk/hawkscan -c 'shawk; cat /home/steve/.hawk/sessions/*/hawkscan.log | grep my-script'

Incomplete or Missing URLs Found by Spider

To scan your application effectively, it is important that HawkScan find all the paths being served by your application. By default, HawkScan will first run a web crawler or “spider” to discover all the paths of your application before running active scans. For example you will see output on the terminal that will look something like this:

[INFO] shawk 2019-10-10 17:44:20,868 Spider complete
[INFO] shawk 2019-10-10 17:44:20,875 24 URLs after spiders
Scan status Stock-Default-Policy (http://host.docker.internal:3000) [4%]

If you do not see URLs and paths that you expect your application to serve, you may need to modify your stackhawk.yml to include form authentication or an api specification. See the app.authentication, app.openApiConf, app.graphQLConf, and app.soapConf configuration help for more detail.


Problem: localhost scans fail, returning the following error:

Error: Unable to scan localhost on ports 0..1023. Please use a permitted port 1024..65535 to proceed.

Solution: HawkScan reports this error when a kernel port (0..1023) is set to a scan against localhost.

HawkScan runs in an unprivileged container which provides permissions for the userland context only. This requires scans against localhost to use a permitted ephemeral port (eg. 1024-65535).

Please refer to the Docker User Guide for more information.

Still Stuck? contact StackHawk Support

. We’d love to help you out.