Skip to content

Lesson 10 of 12 · 20m

DAST: Attacking the Running App

SAST reads the recipe; DAST tastes the soup — it finds what only exists because the app runs, if you can get it authenticated and pointed at the right target.

Static analysis will never tell you that your session cookie lacks Secure, that /api/admin/users answers without auth because someone disabled middleware for a demo, or that a reflected XSS only exists when three services assemble the page. Dynamic testing finds what exists because the app runs — and it needs a running app to do it. No amount of semgrep ci covers that surface.

What DAST is and isn't

A DAST scanner is a robot attacker pointed at a URL. OWASP ZAP is the general-purpose pick; Nuclei runs templated checks — one YAML per known CVE or misconfig — against whatever you aim it at. It spiders the site, pokes parameters, injects probes, and reports what the server did. It needs no source and speaks every language, which also means it knows nothing about intent. Expect it to find:

  • Missing or misconfigured headers, cookies, and TLS settings (Secure/HttpOnly/SameSite, Content-Security-Policy, HSTS).
  • Reflected and stored XSS and injection that survives to the response.
  • Auth and session misconfiguration — if the scanner can get logged in.
  • Known-CVE exposures via Nuclei templates: nuclei -u https://staging.acme.internal -tags cve,misconfig.

It won't find business-logic flaws, and coverage is only as deep as the crawl — an endpoint the spider never discovers is a page it never tests. For a JS-heavy SPA, ZAP's ajaxSpider crawls with a real browser; the classic spider reads HTML and misses routes that only exist after React renders.

Baseline versus full scan

# baseline: passive checks + light probing — minutes, safe to schedule
docker run -v "$(pwd):/zap/wrk" -t ghcr.io/zaproxy/zaproxy:stable \
  zap-baseline.py -t https://staging.acme.internal -r zap-baseline.html

# full scan: active attacks — hours, staging only
docker run -v "$(pwd):/zap/wrk" -t ghcr.io/zaproxy/zaproxy:stable \
  zap-full-scan.py -t https://staging.acme.internal -r zap-full.html

The distinction matters. A baseline is polite enough to run nightly against staging. A full active scan creates garbage rows, fires every alert channel you own, and trips WAFs — run it deliberately, in an environment built for it, never against production without an ops agreement. For repeatable setups, ZAP's Automation Framework (zap.sh -cmd -autorun zap.yaml) pins the spider, context, auth, and scan policy in one file.

Authentication is the whole ballgame

An unauthenticated DAST run against a logged-in app scans exactly the login page. Real coverage needs a context: a recorded login flow or scripted auth — form auth with a logged-in regex for verification, or a token header — plus session handling that survives expiry mid-scan. For APIs, skip the crawler entirely and hand ZAP the OpenAPI spec: zap-api-scan.py -t openapi.yaml -f openapi. Suddenly it knows every endpoint, every parameter name, every expected shape — coverage a spider can't reach.

Where it fits in the pipeline

Nightly or weekly against stable staging or ephemeral review environments — not a PR gate. It's too slow, too flaky, and too prone to re-finding the same thing. Output lands in the same findings queue as everything else, triaged like findings rather than treated as build failures.

The dedup problem

DAST's ugliest operational habit is re-finding the same reflected XSS every week and filing it again. Fingerprint findings by endpoint + parameter + alert type before they reach the queue, and treat "new since last run" as the report — the rest is trend data. ZAP's automation framework dedupes alert instances internally, but you still want the queue-side rule or the same finding becomes a weekly ritual.

Field notes

  • Flakiness kills credibility: seed deterministic test data, mark destructive endpoints out of scope, handle auth expiry in config. A scan that fails silently reports nothing, and nobody notices.
  • Filter Nuclei templates to your stack (-tags); running all of them gets you a CVE dump, not signal.
  • DAST on production is a different discipline — passive only, rate-limited, agreed with ops. Don't learn that the hard way.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.