Dynamic Testing & Runtime Security

Understanding DAST: Runtime Security Testing

3 min read

Dynamic Application Security Testing (DAST) tests your application while it's running. Unlike SAST, which reads code, DAST interacts with your application like an attacker would.

How DAST Works

┌─────────────┐     HTTP Requests     ┌─────────────────┐
│ DAST Tool   │ ──────────────────▶  │ Running App     │
│ (ZAP, etc)  │                       │ (staging/test)  │
│             │ ◀──────────────────   │                 │
└─────────────┘     HTTP Responses    └─────────────────┘
┌─────────────┐
│  Report:    │
│  - XSS      │
│  - SQLi     │
│  - CSRF     │
└─────────────┘

DAST tools:

  1. Crawl your application to discover endpoints
  2. Inject malicious payloads into inputs
  3. Analyze responses for vulnerability indicators
  4. Report findings with proof-of-concept

DAST vs SAST Comparison

AspectSASTDAST
WhenBuild timeRuntime
InputSource codeRunning application
CoverageAll code pathsOnly accessible paths
False positivesHigherLower
Language dependentYesNo
Finds runtime issuesNoYes
Configuration issuesLimitedYes
Authentication bugsLimitedYes

What DAST Finds

VulnerabilityHow DAST Detects It
SQL InjectionSends ' OR 1=1-- and checks for database errors
XSSInjects <script>alert(1)</script> and checks if executed
CSRFChecks for missing CSRF tokens in forms
Open RedirectsTests redirect parameters with external URLs
Security HeadersChecks for missing CSP, HSTS, X-Frame-Options
Information DisclosureLooks for stack traces, version info in errors

Types of DAST Testing

1. Passive Scanning

Observes traffic without modifying requests:

  • Checks security headers
  • Identifies sensitive data exposure
  • Finds information leakage

2. Active Scanning

Sends attack payloads to find vulnerabilities:

  • SQL injection attempts
  • XSS payload injection
  • Path traversal attacks

3. API Scanning

Tests REST/GraphQL APIs:

  • Authentication bypass
  • Authorization flaws
  • Injection in API parameters

When to Run DAST

Development ─────▶ Staging ─────▶ Production
               ┌─────────────┐
               │ DAST Scan   │
               │ (Nightly or │
               │  per-deploy)│
               └─────────────┘

Best practices:

  • Run against staging, not production (unless passive only)
  • Schedule nightly scans for comprehensive testing
  • Run quick scans on every deployment
  • Use authenticated scans to test protected areas

DAST in CI/CD

# GitHub Actions - DAST after deployment
dast:
  needs: deploy-staging
  runs-on: ubuntu-latest
  steps:
    - name: Wait for deployment
      run: sleep 30

    - name: DAST Scan
      uses: zaproxy/action-baseline@v0.10.0
      with:
        target: ${{ secrets.STAGING_URL }}
        fail_action: true  # Fail pipeline on high findings

DAST Limitations

Be aware of what DAST cannot do:

  • Code-level issues: Can't see vulnerable code patterns
  • Dead code: Can't test unreachable code paths
  • Complex logic: Hard to test multi-step business logic
  • Slow: Full scans take hours vs minutes for SAST
  • Environment setup: Requires running application

Choosing DAST Approach

ScenarioApproach
Quick PR checksBaseline scan (fast, common vulns)
Nightly buildsFull active scan
API testingAPI-specific scan (Nuclei)
ComplianceAuthenticated + unauthenticated

Next, we'll automate OWASP ZAP in your CI/CD pipeline. :::

Quick check: how does this lesson land for you?

Quiz

Module 4: Dynamic Testing & Runtime Security

Take Quiz
FREE WEEKLY NEWSLETTER

Stay on the Nerd Track

One email per week — courses, deep dives, tools, and AI experiments.

No spam. Unsubscribe anytime.