Skip to content
Pwnversity
DSO-SASTintermediate · 6 min · upd. 2026-10

SAST / DAST

OWASP ASVS

SAST and DAST are the two families of automated application security testing: the first analyzes the code from the inside (white box), the second attacks the running app from the outside (black box). They complement each other: neither alone finds everything, and both have blind spots worth knowing.

Manually reviewing all code on every PR doesn’t scale. These tools automate the search for known flaw classes and integrate them into the pipeline, so a bug shows up on the radar in minutes rather than at the annual pentest. The goal isn’t to replace the pentester or threat modeling, but to take the mechanical work off their plate.

SAST analyzes source code (or bytecode) without running it. It builds an AST, a control-flow and data-flow graph, and traces the path from an untrusted input (source) to a dangerous operation (sink).

  • Finds well: injections (SQLi, command injection), reflected/stored XSS, path traversal, weak crypto usage, insecure deserialization, hardcoded secrets.
  • Finds poorly: authorization flaws, business logic, IDOR — anything that depends on the meaning of the data, not its flow.
  • Key problem: false positives. A noisy SAST flagging hundreds of irrelevant findings makes the team ignore it. The metric that matters is signal, not count.

Example rule (Semgrep) detecting a concatenated query in Python:

rules:
- id: python-sql-string-concat
languages: [python]
message: "Possible SQLi: query built by concatenation"
severity: ERROR
patterns:
- pattern: $CURSOR.execute("..." + $X)

CI integration (GitHub Actions) with Semgrep:

name: sast
on: [pull_request]
jobs:
semgrep:
runs-on: ubuntu-latest
container: semgrep/semgrep
steps:
- uses: actions/checkout@v4
- run: semgrep ci --config auto

DAST doesn’t see the code: it sends requests against the deployed app and observes the responses, just like an attacker. It crawls the application, injects payloads, and detects anomalous behavior.

  • Finds well: insecure configurations, missing headers, XSS, injections observable in the response, session problems, exposed endpoints.
  • Finds poorly: whatever the crawler doesn’t reach (complex flows, unconfigured authenticated states), and the root cause (it tells you there’s XSS, not which line).
  • Needs a test environment: never run it against production without explicit authorization and a prepared environment.

ZAP in baseline mode inside the pipeline, against an ephemeral environment:

Ventana de terminal
docker run -t ghcr.io/zaproxy/zaproxy:stable \
zap-baseline.py -t https://staging.example.internal -r zap-report.html

Where the modern variants fit:

  • IAST (Interactive AST): instruments the running app during functional tests. It combines code visibility (like SAST) with execution context (like DAST), with fewer false positives.
  • API-schema DAST (OpenAPI/Swagger): improves coverage of APIs a crawler won’t discover.
flowchart LR
    SRC["Source code"] -->|SAST| F1["Code findings"]
    SRC --> BUILD["Build"]
    BUILD --> DEPLOY["Ephemeral environment"]
    DEPLOY -->|DAST| F2["Runtime findings"]
    DEPLOY -->|IAST instrumented| F3["Context-aware findings"]
    F1 --> TRIAGE["Triage and dedup"]
    F2 --> TRIAGE
    F3 --> TRIAGE
    TRIAGE --> GATE{"Gate?"}
    GATE -->|critical| BLOCK["Block PR"]
    GATE -->|rest| REPORT["Report"]

Tools tell you what they find; the OWASP ASVS (Application Security Verification Standard) defines what should be verified. Use it as a requirements catalog: level 1 (basic, automatically verifiable), level 2 (most apps), level 3 (high risk). Mapping findings to ASVS turns a bug list into a coverage measure.

  • Known blind spots: if a target passes SAST/DAST, the attacker focuses on what these tools don’t see — authorization, business logic, IDOR, race conditions.
  • Disabled rules: teams that silence noisy rules end up disabling the ones that matter too; reviewing the SAST config reveals what they stopped looking at.
  • Crawler coverage: DAST only sees what it reaches. Unlinked endpoints, hidden parameters, and misconfigured authenticated flows go untested.
  • Prioritize signal over noise: start with high-confidence rules, raise coverage when the team trusts the results.
  • Triage and dedup: centralize findings (a DefectDojo or similar) so you don’t report the same thing ten times.
  • Gradual gates: inform first, block only exploitable critical (see Secure SDLC).
  • Layer controls: SAST on the PR, DAST against staging, manual pentest for logic. And secrets scanning and SCA as separate controls.
  • SAST integrated on every PR with high-signal rules.
  • DAST against an ephemeral staging environment, never production without authorization.
  • API coverage with an OpenAPI schema for DAST.
  • Centralized triage and deduplication of findings.
  • Gates starting informational; block only exploitable critical.
  • Findings mapped to ASVS levels.
  • Silenced rules reviewed periodically.
  • Manual pentest covering authorization and business logic.