How to Use OWASP ZAP to Test a Web App Safely
Learn to scope ZAP, collect real application traffic, distinguish passive from active scans, validate alerts, and retest fixes without exceeding authorization.
How to Use OWASP ZAP to Test a Web App Safely
OWASP ZAP (Zed Attack Proxy) is an open-source web application testing tool that observes HTTP and HTTPS traffic between a browser and an app, then checks known patterns for potential security issues. Start by restricting the test to an authorized environment and URL scope. Proxy real user flows through ZAP and review passive findings first. Active scanning sends attack requests to the target, so use it only in an authorized nonproduction environment after assessing scope and impact.
This guide reflects ZAP 2.17.0 and official documentation checked on 2026-11-23. Menus and add-ons may change. ZAP is not a security guarantee or a replacement for a full penetration test.
How ZAP examines an app
ZAP works as an intercepting proxy. When a browser or functional test connects through it, ZAP records requests and responses, builds a site view, and analyzes messages. The Getting Started guide recommends exploring the app through a proxied browser or automated regression tests.
| Method | What it does | Key consideration |
|---|---|---|
| Passive scan | Analyzes HTTP or WebSocket messages sent through ZAP without injecting attack payloads. | It cannot cover flows that were never exercised. |
| Active scan | Sends known attack requests to selected URLs and input points and compares responses. | It may cause load, data changes, or account lockouts; never run it without authorization. |
Passive does not mean complete or risk-free. The standard Spider follows links in HTML, but JavaScript-heavy apps and authenticated pages may need browser exploration, the AJAX Spider, or test scripts. Discovering a URL does not prove that every feature was tested. Spider documentation
Define scope and safeguards first
A Context groups URLs belonging to a web app; Scope marks what ZAP should test. Context regular expressions must match the entire URL. Review app and API hosts, required subdomains, third-party login or analytics domains, and state-changing paths such as payment, deletion, or invitation flows. Contexts
Safe mode prohibits potentially dangerous operations. Protected mode permits them only for URLs in scope, and ZAP recommends it to avoid attacking unintended sites. A mistaken scope can still include the wrong target, so confirm both the authorized URL list and mode before scanning. Modes
Prepare approved URLs, test dates, accounts and request rates; a staging environment separated from production; role-specific test accounts; excluded third-party hosts and state-changing actions; and a recovery contact. Remove customer data and unnecessary privileges from test accounts. Stop if load or errors rise unexpectedly.
Collect traffic and validate alerts
Install the latest supported stable ZAP release. Version 2.17.0 was the latest stable release when checked on 2026-11-23. [Releases](https://www.zaproxy.org/docs/desktop/releases/)
Start a session, create a Context for each app, review include/exclude patterns, and select Protected mode.
Launch the Quick Start browser or connect an isolated test browser through ZAP. Install the ZAP certificate only on a test device that needs HTTPS interception, then remove it afterward.
Exercise login, logout, key features, forms, and API calls with separate accounts for different roles. ZAP supports manual, form, JSON, HTTP/NTLM, and script-based authentication; verify session maintenance and reauthentication. [Authentication methods](https://www.zaproxy.org/docs/desktop/start/features/authmethods/)
After the passive scan queue drains, inspect Alerts: URL, rule, Risk, Confidence, Evidence, parameter, request, and response. Reproduce the behavior and compare with a normal case.
An alert is a potential issue, not a confirmed vulnerability. Risk is relative severity; Confidence is confidence in the detection. Check whether the evidence matches actual request and response behavior, then record the result as a finding, false positive, or unable to verify. Alert fields
Choose active scans and CI jobs carefully
Active scanning attacks the target. Use an authorized staging copy, confirm Scope, Protected mode, scan policy, accounts, and recovery steps, and start with a narrow policy and low request volume. Stop if data changes, accounts lock, latency rises, or errors appear. Automated scans find only some issues; access-control and business-logic flaws still need human testing. Active scan and scan policies.
The Docker Baseline Scan is a lighter CI starting point: it spiders for a limited time and reports passive alerts without active scanning. This command is a syntax example; the reserved .invalid host is not a real target. Replace it only with an authorized staging URL and review the run conditions:
docker run --rm -t ghcr.io/zaproxy/zaproxy:stable zap-baseline.py -t https://staging.example.invalid -m 2Baseline still sends requests, so authorization and load matter. Full Scan spiders and then performs active scans, and its crawl may have no time limit by default. Packaged Docker scans can expose an unauthenticated local ZAP API; do not publish that port to untrusted networks. Baseline, Full Scan, and Docker guide.
For repeatable pipelines or complex authentication, define an Automation Framework YAML plan. Validate job order, authentication, crawl, passive-scan wait, active policy, reports, and exit conditions on a small staging app first. Automation Framework.
Turn alerts into fixes
Record reproducibility, affected data and users, evidence, owner, and retest method for each finding. Reports and session files may contain cookies or tokens, so limit access and retention. Few alerts do not prove safety: authenticated pages, undiscovered URLs, disabled rules, untested APIs, and business logic can be missed. Report version, target, duration, roles, paths explored, scan policies, exclusions, false positives, unverified areas, and remediation status. Retest fixes under the same conditions and run related regression checks.
Sources
[Getting Started](https://www.zaproxy.org/docs/desktop/start/), [Contexts](https://www.zaproxy.org/docs/desktop/start/features/contexts/), [Modes](https://www.zaproxy.org/docs/desktop/start/features/modes/)
[Spider](https://www.zaproxy.org/docs/desktop/addons/spider/), [Authentication](https://www.zaproxy.org/docs/desktop/start/features/authmethods/)
[Passive scan](https://www.zaproxy.org/docs/desktop/start/features/pscan/), [Alerts](https://www.zaproxy.org/docs/desktop/start/features/alerts/)
[Active scan](https://www.zaproxy.org/docs/desktop/start/features/ascan/), [Baseline](https://www.zaproxy.org/docs/docker/baseline-scan/), [Full Scan](https://www.zaproxy.org/docs/docker/full-scan/)
[Automation Framework](https://www.zaproxy.org/docs/automate/automation-framework/), [Releases](https://www.zaproxy.org/docs/desktop/releases/)