ZAP (formerly OWASP ZAP) is a free, open-source tool for finding vulnerabilities in web applications. This guide takes you from "what is it?" to running automated scans in a CI/CD pipeline, with the exact menu paths, commands and settings I use. It follows the order I'd recommend learning things in.
1. What is ZAP?
- A DAST (Dynamic Application Security Testing) tool: it attacks a running app the way a real attacker would.
- Free, open source and cross-platform (Linux, Windows, macOS). Backed by the ZAP core team and supported by Checkmarx.
- The name is now just "ZAP" (or "ZAP by Checkmarx"). It has not been an OWASP project since August 2023, so "OWASP ZAP" is the old name.
- Needs Java 17 or higher (the macOS installer bundles Java). Runs as a desktop app, from the command line, as a Docker image, or in GitHub Actions.
Main features
| Feature | What it does |
|---|---|
| Intercepting proxy | Sits between your browser and the app so you can inspect and change traffic |
| Spider | Automatically crawls the application to discover pages |
| Passive scan | Only examines requests and responses; no attacks |
| Active scan | Sends attack payloads to find real vulnerabilities |
| Fuzzing | Sends many unexpected values to a parameter to find what scanners miss |
| Reports | HTML, JSON, XML, Markdown, PDF and SARIF, with remediation advice |
| Add-ons | Free Marketplace extensions; you can also write your own |
| Dynamic SSL certificates | A generated root certificate lets ZAP intercept HTTPS |
ZAP vs. SAST and SCA
SAST analyzes your source code and SCA analyzes your libraries. Both look at how the app was built, but neither attacks it. ZAP attacks the running app. Automated tools still can't find everything, so manual testing remains necessary.
The simple use case
- Authenticate to the target (manually through the proxy, or configure ZAP to do it).
- Explore the app: manually through the proxy, with one of ZAP's spiders, or by importing API definitions.
- Passive scan happens automatically while you explore.
- Active scan attacks the discovered pages and parameters.
- Report: review results in ZAP or export HTML/structured data.
2. Installing ZAP
- Install Java 17+ and check with
java -version. - Download the installer from zaproxy.org/download (Windows: the 64-bit
.exe; there is no MSI). - Run the installer and follow the steps.
Alternatives:
docker pull ghcr.io/zaproxy/zaproxy:stable
flatpak install flathub org.zaproxy.ZAP
snap install zaproxy --classic
3. Trusting the ZAP root certificate
Without this, your browser shows certificate warnings and ZAP can't read HTTPS traffic.
- ZAP: Tools → Options → Network → Server Certificates → Save, and pick a folder.
- Firefox: Settings → Privacy & Security → Certificates → View Certificates → Authorities → Import → tick "Trust this CA to identify websites".
- Edge / Chrome on Windows: double-click the file → Install Certificate → Current User → place in Trusted Root Certification Authorities.
- Chrome on Linux: Settings → search "certificates" → Manage certificates → import as a trusted authority.
4. Sending browser traffic through ZAP
Option A: the easy way (Manual Explore)
Quick Start tab → Manual Explore → enter the URL → pick a browser → Launch Browser. ZAP opens a browser that already uses ZAP as its proxy and already trusts its certificate. If the browser isn't found, set the path in Tools → Options → Selenium → Binaries.
Option B: manual proxy
Check the proxy address under Tools → Options → Network → Local Servers/Proxies (default localhost:8080; change the port if 8080 is busy). In Firefox: Settings → Network Settings → Manual proxy → HTTP Proxy 127.0.0.1, Port 8080, and tick "Also use this proxy for HTTPS".
On Windows, Edge and Chrome use the system proxy: Settings → Network & Internet → Proxy → Manual proxy setup. Turn it off after testing, or the whole PC keeps going through ZAP.
FoxyProxy
FoxyProxy is a Firefox extension that stores multiple proxy profiles so you don't edit network settings every time. Install it, then add a profile: title ZAP, IP 127.0.0.1, port 8080. Select it from the toolbar icon and traffic starts showing up in ZAP.
5. A practice target: Mutillidae
If you don't have an app of your own, Mutillidae is vulnerable on purpose. Run it only on a lab machine that can't be reached from outside.
- Install XAMPP (Apache, PHP, MySQL) from apachefriends.org.
- Copy the contents of Mutillidae's
srcfolder intohtdocs\mutillidae. - Start Apache and MySQL, open
http://localhost/mutillidaeand click "setup/reset the DB" once.
6. Intercepting requests
ZAP is a man-in-the-middle proxy: every request and response passes through it, so you can stop, read and modify it first.
- Break on everything: click the green dot (Set break on all requests and responses). Every message is trapped until you click Submit and step to next or Submit and continue.
- Break on specific requests (better): right-click a URL in Sites/History → Break…, or use the Add a custom HTTP breakpoint button.
Breaking on everything is noisy because every image and script stops. A custom breakpoint matches only what you define:
| Field | Meaning |
|---|---|
| Location | URL, Request Header, Request Body, Response Header or Response Body |
| Match | Contains (plain text) or Regex |
| String | The text or regex to find, e.g. login |
| Inverse / Ignore case | Break on non-matches / case-insensitive match |
Example: tamper with a login request. Log in once so the request appears in History → right-click it → Break… → Location URL, Match Contains, String login. Submit the form again, edit a parameter, hidden field or disabled field in the Break tab, then click Submit and continue. This bypasses client-side (JavaScript) validation so you can see what the server really accepts.
7. Finding content: spiders and forced browse
Traditional Spider
Starts from seed URLs, parses HTML, follows every link recursively. Run it from Sites → right-click target → Attack → Spider…, choose the starting point, context, user, and whether to recurse.
Client Spider (and the retired AJAX Spider)
The traditional spider reads HTML only, so single-page apps (React, Angular, Vue) look almost empty to it. Since July 2026 the Client Spider (from the Client Side Integration add-on) is ZAP's recommended crawler for JavaScript-heavy apps. The AJAX Spider is being retired (removed from weekly/nightly releases in August 2026, still on the Marketplace). Use the Client Spider for new work, and run it together with the traditional spider since each finds URLs the other misses.
| Spider | Speed | Best for |
|---|---|---|
| Traditional | Fast | Server-rendered sites |
| Client Spider | Slower (runs a browser) | Modern JavaScript apps |
| AJAX Spider | Slower | Legacy; being retired |
Forced Browse
Brute-forces paths nothing links to (/admin, /backup.zip) using a wordlist. Right-click the site → Attack → Forced Browse, choose a wordlist (Directory List add-ons from the Marketplace) and press play. It sends thousands of requests, so use it only with permission.
Importing API definitions
Spiders can't find REST/SOAP/GraphQL endpoints that no page links to. Import the definition instead (OpenAPI, GraphQL, SOAP/WSDL, Postman, or a plain URL list via the Import menu). From the command line:
zap.sh -cmd -openapiurl https://target.example.com/openapi.json
8. Contexts, scope and modes
A Context groups the URLs of one application, defined by regexes. The Scope is the set of URLs you are testing, and by default nothing is in Scope.
Create one: Sites tab → right-click the target → Include in Context → New Context, then double-click it:
Include in Context: https://target.example.com.*
Exclude from Context: .*logout.*
The regex must match the full URL, hence the trailing .*. Excluding logout keeps scanners from ending your session.
| Mode | What is allowed |
|---|---|
| Safe | No potentially dangerous operations (no spidering, active scan, fuzzing, forced browse, breaking, resending) |
| Protected | Dangerous actions only on URLs in Scope. Recommended default. |
| Standard | Anything on any URL |
| ATTACK | New in-scope URLs are actively scanned as soon as they're discovered |
9. Passive scanning
ZAP passively scans every request and response in a background thread. It never modifies traffic, so it's safe anywhere. Example rules: application errors (HTTP 500), cookies without SameSite or HttpOnly, cross-domain script inclusion, and information disclosure in URLs or HTML comments.
- Tune rules: Tools → Options → Passive Scan Rules (threshold Off/Low/Medium/High).
- Under Passive Scanner you can restrict scanning to in-scope messages, include fuzzer traffic, and cap alerts per rule and body size.
- The eye icon in the footer shows the passive scan queue draining as you browse.
10. Active scanning and scan policies
Active scanning attacks the app with known techniques: SQL injection, XSS, command and code injection, directory browsing, .htaccess leaks and more. It can't find logic flaws such as broken access control, so combine it with manual testing.
Start one: right-click a URL → Attack → Active Scan.
Scan policies
A policy defines which rules run, how many requests are made and how readily issues are flagged. To build a focused one: Analyse → Scan Policy Manager → Add, name it (e.g. "XSS test"), set every category's threshold to Off, then switch only Injection → Cross Site Scripting to Medium. Choose that policy when starting the scan; it finishes much faster.
429 Too Many Requests, and the mix of real and 429 responses produces false alerts (for example a bogus SQL injection).ATTACK mode automates this: switch the toolbar mode to ATTACK and every new in-scope URL is scanned immediately. It sends a huge number of requests and can create, change or delete data, so use it only on test environments.
11. Fuzzing and the Request Editor
Fuzzer
- Right-click a request → Attack → Fuzz… (or
Ctrl+Alt+F). - In Fuzz Locations, highlight the value to replace (e.g. the username) and click Add….
- Add a payload (File wordlist, Strings, Numberzz ranges, Regex, Script). Optionally add processors (URL encode, hash, prefix/suffix).
- Set threads and delay in Options (lower for fragile targets), then Start Fuzzer.
- Sort results by Code or Size to spot responses that differ from the rest.
Manual Request Editor
Select a message and press Ctrl+M (or Tools → Manual Request Editor), edit it, then Send (Alt+Enter). Typical uses:
- Change
id=1toid=2to test for IDOR (broken access control). - Replay a request without the session cookie, or with another user's cookie, to test authorization.
- Change GET to POST/PUT/DELETE to see what the server allows.
12. Authenticated scanning
An unauthenticated scan only sees public pages. For a form-based login with cookies:
- Create a Context for the app.
- Session Properties → Session Management → Cookie-based.
- Log in through ZAP with a test account so the login request is in History.
- Right-click the login request → Flag as Context → Form-based Auth Login Request.
- Select text that only appears when logged in (e.g. "Logout") → right-click → Flag as Context → Logged in Indicator.
- Session Properties → Users: add one user per role you want to test.
- Choose that user in the Spider and Active Scan dialogs.
Other methods exist for JSON logins, HTTP/NTLM, script-based flows and browser-based SSO. Always use dedicated test accounts, never real users.
13. Alerts and reports
Each alert has a Risk (High, Medium, Low, Informational) and a Confidence (False Positive, Low, Medium, High, User Confirmed). Triage high risk with high confidence first, then verify manually. Scanners produce false positives, so check the request, response and evidence. Real examples: a "Spring4Shell" alert on an app with no Java, and an "SQL Injection" alert whose only evidence was a 429 response. Mark these via right-click → Edit Alert… → Confidence: False Positive, or use the Alert Filters add-on for future scans.
Generate a report from Report → Generate Report…. Popular templates:
| Template | Id |
|---|---|
| Modern HTML | modern |
| Traditional HTML | traditional-html |
| Traditional HTML + requests/responses | traditional-html-plus |
| High Level Report | high-level-report |
| Traditional JSON / XML / Markdown / PDF | traditional-json, traditional-xml, traditional-md, traditional-pdf |
| SARIF (code-scanning tools) | sarif-json |
After fixing issues, the Retest add-on re-checks previously reported alerts.
14. Command line, Docker and the API
Command line
zap.sh -version
zap.sh -cmd -addonupdate
zap.sh -newsession /home/user/zap/mysession
zap.sh -cmd -quickurl https://target.example.com -quickout /tmp/zap-report.html -quickprogress
zap.sh -daemon -host 127.0.0.1 -port 8080 -config api.key=CHANGE_ME
-cmd runs a task and exits; -daemon runs headless for API use. Windows uses zap.bat.
Docker scan scripts
| Script | What it does | Use for |
|---|---|---|
zap-baseline.py | Short spider, then passive rules only | Every build; safe on most environments |
zap-full-scan.py | Spider plus full active scan | Staging/test systems you own |
zap-api-scan.py | Imports an OpenAPI/SOAP/GraphQL definition and actively scans it | APIs |
# Baseline (passive) scan, HTML + JSON reports to the current folder
docker run --rm -v $(pwd):/zap/wrk/:rw -t ghcr.io/zaproxy/zaproxy:stable \
zap-baseline.py -t https://staging.example.com -r report.html -J report.json
# Full scan (active attacks: only systems you own)
docker run --rm -v $(pwd):/zap/wrk/:rw -t ghcr.io/zaproxy/zaproxy:stable \
zap-full-scan.py -t https://staging.example.com -r full.html
# API scan from an OpenAPI definition
docker run --rm -v $(pwd):/zap/wrk/:rw -t ghcr.io/zaproxy/zaproxy:stable \
zap-api-scan.py -t https://staging.example.com/openapi.json -f openapi -r api.html
The -v $(pwd):/zap/wrk/:rw mount is required because the scripts read and write files in /zap/wrk. To scan an app on your own machine, use --network host on Linux, or the hostname host.docker.internal on Windows and macOS. The :bare image is minimal and does not include these scripts.
| Option | Meaning |
|---|---|
-t | Target URL (or API definition) |
-r / -J / -x / -w | HTML / JSON / XML / Markdown report |
-c / -g | Use / generate a rule config file (IGNORE, WARN, FAIL per rule) |
-m | Minutes the spider runs (baseline) |
-I | Don't fail the run because of warnings |
-z "options" | Pass ZAP options, e.g. -z "-config key=value" |
Exit codes: 0 success, 1 a FAIL rule triggered, 2 at least one warning, 3 the scan itself failed.
The REST API
KEY=CHANGE_ME; ZAP=http://127.0.0.1:8080; T=https://staging.example.com
curl "$ZAP/JSON/spider/action/scan/?url=$T&apikey=$KEY"
curl "$ZAP/JSON/ascan/action/scan/?url=$T&apikey=$KEY"
curl "$ZAP/JSON/core/view/alerts/?baseurl=$T&apikey=$KEY"
Never disable the API key on a machine others can reach.
15. Automation Framework
The recommended way to automate ZAP: a YAML plan of ordered jobs that lives in version control and can express contexts, authentication and reports that the packaged scans can't.
env:
contexts:
- name: "target"
urls: ["https://staging.example.com"]
includePaths: ["https://staging.example.com.*"]
excludePaths: [".*logout.*"]
parameters:
failOnError: true
progressToStdout: true
jobs:
- type: passiveScan-config
- type: spider
parameters:
context: "target"
maxDuration: 5
- type: passiveScan-wait
parameters:
maxDuration: 5
- type: activeScan
parameters:
context: "target"
maxRuleDurationInMins: 5
- type: report
parameters:
template: "traditional-html"
reportDir: "/zap/wrk"
reportFile: "zap-report"
docker run --rm -v $(pwd):/zap/wrk/:rw ghcr.io/zaproxy/zaproxy:stable \
zap.sh -cmd -autorun /zap/wrk/plan.yaml
Run zap.sh -cmd -autogenmax plan.yaml to see every parameter of every job for your ZAP version. For modern apps, use the spiderClient job.
16. ZAP in GitHub Actions
Run the baseline scan on every pull request (fast, no attacks), API scans against APIs you own, and full active scans on a schedule against staging only.
name: zap-baseline
on: [pull_request]
jobs:
zap:
runs-on: ubuntu-latest
steps:
- name: ZAP baseline scan
run: |
mkdir -p zap-out && chmod a+w zap-out
docker run --rm -v "$PWD/zap-out":/zap/wrk/:rw \
ghcr.io/zaproxy/zaproxy:stable zap-baseline.py \
-t https://staging.example.com -r report.html -J report.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: zap-report
path: zap-out
ZAP also publishes ready-made actions (zaproxy/action-baseline, action-full-scan, action-api-scan); pin each to the latest release tag on its Marketplace page. Use a rules file (-c) to choose which rules fail the build.
17. Add-ons and the HUD
Open the Marketplace with the Manage Add-ons toolbar button. Everything there is free and open source. Add-ons worth knowing: Fuzzer and FuzzDB, Forced Browse with Directory List, OpenAPI / GraphQL / SOAP / Postman Support, Authentication Helper, Client Side Integration, Automation Framework, Replacer, Requester, Retest, Script Console, OAST Support and The HUD (ZAP controls as an overlay inside the browser).
18. Workflow checklist
- Get written permission; use a test environment where possible.
- Start ZAP, persist the session, set Protected mode.
- Create the Context; include the target, exclude logout/delete URLs.
- Configure authentication, session management and users; verify with a logged-in indicator.
- Explore manually, then spider (traditional + Client), import API definitions, forced browse if allowed.
- Review passive alerts, then run an active scan with a suitable policy as each user.
- Fuzz and tamper (breakpoints, Request Editor) on logins, payments and access control.
- Generate the report, fix, then Retest.
19. Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
| ZAP won't start / Java error | Java older than 17 | Install Java 17+, check java -version |
| Certificate warnings | Root cert not trusted | Save it under Server Certificates and import it in the browser |
| No traffic in ZAP | Proxy off or wrong port | Check Local Servers/Proxies and browser/FoxyProxy settings |
| "Browser not found" | ZAP can't locate it | Tools → Options → Selenium → Binaries |
| Scan finds nothing after login | No logged-in indicator, or logout URL was hit | Check Session Properties and exclude logout |
| Can't spider, scan or break | Safe mode, or target outside Scope in Protected mode | Add the target to a Context or change mode |
| Docker report missing | Folder not mounted or not writable | Use -v $(pwd):/zap/wrk/:rw and fix permissions |
Wrapping up
ZAP's real strength is that one tool covers the whole range: a one-click scan for beginners, a manual proxy for deep testing, and a scriptable engine for CI/CD. Start with Manual Explore and passive scanning, add contexts and authentication, and only then move to active scans and automation. And remember: automated scanners won't catch broken access control or business-logic flaws, so keep testing manually.
0 Comments