Application Security

Dynamic Application Security Testing: A Practitioner's Guide to DAST Done Right

DAST finds what source code analysis cannot. Here is how to set it up, tune it, and actually get value from it in a modern CI/CD pipeline.

Shadab Khan
Application Security Lead
7 min read

Dynamic Application Security Testing attacks your running application the same way a real adversary would — from the outside, with no knowledge of the source code. It sends malicious payloads, observes responses, and flags confirmed vulnerabilities. In theory, this is the most realistic form of automated security testing. In practice, getting DAST to work well requires more effort than most teams expect.

The difference between a DAST scan that finds real vulnerabilities and one that produces garbage comes down to configuration. Authentication, crawling, input handling, and scope management all need deliberate attention.

What DAST Actually Does

A DAST scan follows a predictable sequence:

  1. Crawling/Spidering. The scanner maps the application's attack surface by following links, submitting forms, and recording endpoints.
  2. Attack. For each discovered endpoint and parameter, the scanner sends payloads designed to trigger specific vulnerability classes — SQL injection, XSS, command injection, path traversal, and dozens more.
  3. Analysis. The scanner examines responses for evidence of successful exploitation — error messages, reflected payloads, timing differences, or behavioral changes.

The quality of each phase determines the quality of the overall scan.

The Crawling Problem

Crawling is where most DAST scans go wrong. If the scanner cannot discover an endpoint, it cannot test it. Modern web applications make crawling difficult in several ways.

Single-page applications. Traditional crawlers follow HTML links and submit HTML forms. SPAs load a JavaScript shell and render everything client-side. A crawler that does not execute JavaScript will see an empty page.

Modern DAST tools use headless browsers (typically Chromium) to render SPAs. This helps but does not solve the problem completely. Dynamic content loaded based on user interactions, infinite scroll, and client-side routing still challenge automated crawlers.

API endpoints without a UI. REST and GraphQL APIs have no HTML to crawl. You need to feed the scanner an API specification (OpenAPI/Swagger for REST, schema introspection for GraphQL) to tell it what endpoints exist.

Complex authentication flows. Many applications use multi-step authentication, MFA, OAuth redirects, or CAPTCHA challenges. If the scanner cannot authenticate, it only tests the login page and public content.

State-dependent navigation. Some pages only appear after specific workflows — creating an order, completing a wizard, reaching a particular account state. Automated crawlers rarely handle these gracefully.

Setting Up Authentication

Authenticated scanning is non-negotiable for any application with user accounts. Without it, you are testing less than 10 percent of a typical application's attack surface.

Session-based authentication. Record a login sequence (URL, credentials, form fields) and configure the scanner to replay it. Set session validation by specifying a URL and pattern that indicates an active session (e.g., the presence of a "Logout" link on a dashboard page). When the scanner detects the session has expired, it re-authenticates.

Token-based authentication. For JWT or API key authentication, configure the scanner to include the token in request headers. For JWTs with short expiration, set up a token refresh mechanism.

OAuth flows. These are the most painful to automate. Some DAST tools support OAuth natively. Others require you to obtain a token outside the scanner and inject it. If your OAuth flow involves browser redirects and consent screens, you may need to script the token acquisition.

Multi-role scanning. Run separate scans for each user role. An admin scan will discover endpoints invisible to regular users. A regular user scan tests access control — can a normal user reach admin endpoints?

Tuning for Signal Over Noise

DAST tools have lower false positive rates than SAST, but they are not zero. Tuning reduces noise and improves scan efficiency.

Scope management. Restrict the scan to your application. Without scope limits, the scanner will follow links to external sites, CDNs, and third-party services. This wastes time and might get your IP blocked.

Excluded parameters. Some parameters trigger destructive actions — delete operations, password resets, account deactivation. Exclude these from active testing or test them in a dedicated environment with disposable data.

Scan policies. Disable checks that do not apply. Testing a REST API? Disable DOM-based XSS checks. Running against a static content site? Disable SQL injection checks. Focused scans run faster and produce less noise.

Rate limiting. Production-like environments often have rate limits. Configure the scanner's request rate to stay below these limits. A scanner that gets rate-limited will produce incomplete results and might trigger security alerts.

Integrating DAST into CI/CD

The traditional approach to DAST — quarterly scans by a security team — does not keep up with modern release cadences. Teams shipping daily need DAST in the pipeline.

Full scans on staging. After deploying to a staging environment, trigger a comprehensive DAST scan. This runs in parallel with other testing (functional, performance) and reports results before promotion to production.

Incremental scans on PR environments. Some teams deploy feature branches to ephemeral environments and run targeted DAST scans against changed endpoints. This is fast but requires infrastructure to identify which endpoints changed.

Baseline management. Like SAST, DAST benefits from a baseline. Track known findings and only alert on new ones. This prevents the same known issues from blocking every deployment.

Failure thresholds. Define what constitutes a blocking finding. A confirmed SQL injection should block deployment. An informational finding about a missing security header probably should not.

Common DAST Findings and What They Mean

SQL Injection (confirmed). The scanner successfully injected SQL syntax and observed a change in application behavior. This is almost always a true positive and needs immediate remediation.

Reflected XSS. The scanner's payload appeared unescaped in the response. Verify the context — is the reflection in HTML body, attribute, or JavaScript? Each requires different remediation.

Missing security headers. Findings like missing Content-Security-Policy or X-Frame-Options are informational, not exploitable on their own. Prioritize them but do not treat them as emergencies.

SSL/TLS issues. Weak cipher suites, expired certificates, or missing HSTS headers. These are infrastructure issues, not application code bugs. Route them to the operations team.

Information disclosure. Stack traces, version numbers, or debug information in error responses. Easy to fix, often overlooked, and they give attackers a head start.

DAST Limitations You Cannot Ignore

DAST will never find business logic vulnerabilities. It does not understand that a user should not be able to apply a discount code twice or that a negative quantity in an order should be rejected. These require human-driven testing or specialized tools.

DAST also struggles with second-order vulnerabilities — where a payload is stored in one request and triggered in a different context. Stored XSS that only fires when an admin views a report, for example, requires the scanner to navigate a specific sequence of actions.

Finally, DAST is slow compared to SAST. A comprehensive scan of a large application can take hours. This is not a tool you run on every commit.

How Safeguard.sh Helps

Safeguard.sh complements DAST by providing the supply chain context that dynamic scanners miss. While DAST tests your application's behavior, Safeguard.sh tracks the components that make up your application — dependencies, container images, and their known vulnerabilities. Together, you get a view of risk that spans from how your application behaves under attack to what known-vulnerable components it is built on. Safeguard.sh's policy gates can incorporate DAST results alongside dependency and SBOM data, giving your release process a single, unified security checkpoint.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.