OWASP ZAP: automated looking, human judgment

ZAP is a free proxy and scanner. The value is the list of leads it produces, not the score it prints.

Lesson 4 of 26 · 11 min read · practice only with authorization

Diagram

From an alert to a pile you can defend

Follow the path. One example at a time.

Step 1 of 4

Passive

Watch traffic you were going to generate anyway, inside the lab.

Illustration: Passive
# Passive
# Watch traffic you were going to generate anyway, inside
# the lab.

The example on the open step is one illustration, or the fix you can paste into an application you own.

What ZAP adds

ZAP can proxy a browser the way Burp does, and it can crawl a site and send a battery of checks. The crawl builds a map. The passive checks watch traffic you already generated and comment on headers, cookies, and obvious information leaks. Active checks send their own requests, which means they are a scope decision of their own.

Use passive review freely on traffic you were going to generate anyway inside the lab. Turn active scanning on only for hosts named in the scope, at a rate the owner can survive, and never against a login you were not given for that purpose.

How to treat an alert

An alert has a name, a risk guess, a URL, and a description. Confirm it. Many alerts are true and unimportant, such as a missing header on a static brochure. Some are false, because the scanner guessed. A few are the actual bug. Your job is to sort those three piles and write about the third.

Risk labels are a starting sort, not a severity. Severity in the report comes from what the owner loses if the alert is real and reachable, which you only know after you have read the application.

From alert to fix

For each confirmed alert, keep the URL, the request that showed it, the response with secrets removed, and the control. Missing cookie flags, verbose errors, and outdated libraries are common and worth fixing. They are also not a substitute for the authorization tests a scanner is bad at.

ZAP is a good default in a lab because it is free and scriptable in a pipeline. A pipeline scan of every pull request, with someone who reads the new alerts, beats a heroic scan the week before launch.

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

A medium alert matches a session cookie you can see has no HttpOnly. What is it?

Go deeper

Specific techniques, exercises, and glossary cards for this topic.

  1. 01How web applications work: requests, sessions, and where trust is decidedA browser request from DNS to database and back, the parts of an HTTP exchange a tester reads first, and the server-side decisions that most web vulnerabilities come down to. Includes the diagram and a defensive fix.
  2. 02Cross-site scripting: reflected, stored, and DOM-based, and the defenses that stackHow untrusted text becomes script in another user’s browser, how to tell reflected, stored, and DOM-based XSS apart in a review, and why output encoding, a strict CSP, and HttpOnly cookies work together. Includes the diagram and a defensive fix.
  3. 03SQL injection: how it happens, how testers confirm it, and the fix that holdsHow concatenated queries let input change SQL, the error, boolean, time, and out-of-band behaviors testers look for in an authorized test, what scanners like sqlmap report, and parameterization plus least privilege as the fix. Includes the diagram and a defensive fix.

Exercises

  1. 01Evidence deskRead a query review and a server-side fetch that were already collected. Name the failure and the fix.
  2. 02Output encoding sandboxOne display name lands in page text, an attribute, an inline script, and a link. Pick the encoder each place needs and test it with probe values.
  3. 03Parameterized vs concatenated queriesBuild the same product search three ways and watch the token view: concatenation lets input change the query, bound parameters and allowlists keep it a value.
  4. 04Terminal mission: A search box that returned the users tableThe shop’s search API logged a run of quotes, ORDER BY probes, and UNION SELECTs. Identify the parameter, the table that was dumped, and the size of the response that leaked it.

Glossary

  1. 01SQL injectionUntrusted input changes a database query, exposing or altering records the caller should not reach.
  2. 02Cross-site scriptingA page treats attacker-controlled text as code in someone else's browser, which can steal sessions or rewrite the UI.