Tutorial: DAST app scans using Zed Attack Proxy
Scan a web app using ZAP
Zed Attack Proxy (ZAP) is a free, open-source penetration tool for testing web applications. ZAP runs as a "man-in-the-middle proxy" between the tester's browser and the web app. You can use ZAP to run penetration testing to simulate a malicious external attack and use the results to protect your app from unauthorized access and denial-of-service attacks.
In this tutorial, you'll set up a simple pipeline with a Zap step that scans the app and ingests the results into STO.
Set up your app instance
If you don't have your web app running yet, you can go through this tutorial by scanning an instance of the Google Gruyere app.
To create an instance of this app for scanning, go to Start Gruyere.
Set up your pipeline
Do the following:
Select Security Testing Orchestration (left menu, top) > Pipelines > Create a Pipeline. Enter a name and click Start.
In the new pipeline, select Add stage > Security.
Set up your stage as follows:
Enter a Stage Name.
Unselect Clone Codebase.
Go to Infrastructure and select Cloud, Linux, and AMD64 for the infrastructure, OS, and architecture.
You can also use a Kubernetes or Docker build infrastructure, but these require additional work to set up. For more information, go to Supported Infrastructure documentation.
Add the Zap step
Harness provides a set of customized steps that make it easy to set up popular scanners such as ZAP.
In Execution, add a Zap step.
Configure the step as follows:
Name =
dast_scan_my_web_appScan Mode = Orchestration
Set the following fields based on the app you're scanning.
For example, suppose you're scanning version 8.1.2 of
https://myorg.org:9090/welcome. You could then set the fields like this:Target Name =
myorg.org/welcomeTarget Variant =
8.1.2Instance Domain =
myorg.org/welcomeInstance Protocol = https
Instance Port =
9090
If you're scanning a Google Gruyere instance, set the fields like this:
Target Name =
https://google-gruyere.appspot.com/Target Variant = MY_APP_INSTANCE_ID
Instance Domain =
https://google-gruyere.appspot.com/MY_APP_INSTANCE_IDInstance Protocol = https
Fail on Severity = Critical
Add a Zap step and set the following fields based on the web app you want to scan. For example, suppose you're scanning version 8.1.2 of https://myorg.org/welcome:9090. You could then set the fields like this:
type:Zapname:A name for the step.identifier:A unique step ID.spec :mode :orchestrationconfig: default # | standard | attack | quicktarget :name : https://myorg.org/welcometype : instancevariant : 8.1.2port : 9090
advanced :log :level : info
fail_on_severity: critical
Here's a YAML example for scanning a Google Gruyere instance:
Run the pipeline and check your results
Run the pipeline and then wait for the execution to finish.
Select Vulnerabilities tab and examine any issues detected by your scan.
Specify the baseline
Select Test Targets (left menu).
Select the baseline you want for your target.
YAML pipeline example
Here's an example of the pipeline you created in this tutorial. If you copy this example, replace the placeholder values with appropriate values for your project, organization, and app instance ID.
Last updated
Was this helpful?