Blog

SAST and DAST: how they work and what each one misses

How SAST, DAST, SCA and IAST analyze an application, which flaws each finds, which it misses, and how to add them to the pipeline without slowing delivery.

A magnifying glass over a circuit board, enlarging a chip

SAST and DAST are often presented as alternatives, as if your company had to pick one. It does not: the two look at an application from opposite sides and find different flaws. Knowing how each one works helps you set expectations for a tool, decide where it goes in the development pipeline, and see what still needs manual testing.

How SAST works

SAST (Static Application Security Testing) analyzes source code, bytecode or binaries without running the application. The engine turns the code into an internal representation (syntax tree, control flow graph, call graph) and looks for dangerous paths. A core technique is data flow analysis, especially taint analysis: the engine marks as “tainted” everything that comes from outside (HTTP parameters, headers, uploaded files, queue messages) and follows that data through the code to a sensitive point, the sink. If the data reaches a SQL query, an operating system command or an HTML response without passing through a recognized validation or escaping function, the engine flags it.

That is how SAST tends to find classes such as SQL injection (CWE-89), command injection (CWE-78), cross-site scripting (CWE-79) and path traversal (CWE-22). Other rules flag insecure deserialization, weak cryptographic algorithms and secrets written into the code. Accuracy depends on the tool, the language and how the rules are tuned.

SAST has known limits. It does not know how the application will be configured in production, usually cannot see what happens in another service called over HTTP, and can lose accuracy in frameworks heavy on dependency injection or reflection. It also produces false positives: when the engine does not recognize a sanitizing function your team wrote, it flags a flaw that does not exist. That is why tuning the rules matters as much as the tool.

How DAST works

DAST (Dynamic Application Security Testing) tests the running application from the outside, without access to the code. The tool first maps the surface: it crawls the pages, reads the OpenAPI specification when there is one, and records every form, parameter and endpoint. Then it sends modified requests and watches the responses: a database error after a quote, a deliberate delay in the response, a script reflected in the page, a missing security header, a session cookie without the Secure flag.

DAST finds what only appears once the application is assembled: server configuration, HTTP headers, TLS, detailed error messages, session problems and injection flaws that respond to the test. It works with any server-side language, because it tests the application through the interfaces it exposes. Its findings still need validation.

Its limits are clear too. DAST only tests what it can reach: if authentication was not set up for the tool, it sees only the login page. It runs later in the cycle, needs a working environment, and does not point to the line of code to fix.

SCA and IAST complete the picture

Much of a modern application’s code comes from third-party libraries. SCA (Software Composition Analysis) inventories those dependencies, transitive ones included, and checks their versions against databases of known vulnerabilities and against each component’s license. It was this kind of inventory that let teams find quickly where the log4j vulnerable to Log4Shell (CVE-2021-44228) was running.

IAST (Interactive Application Security Testing) places an agent inside the running application. While functional tests or a DAST exercise the application, the agent watches the real flow of data to the sensitive points and reports the flaw with its line of code, combining the accuracy of dynamic testing with the address the developer needs.

What needs context and manual testing

Tools recognize patterns. Business logic and access control flaws have no syntactic pattern. If a GET /orders/{id} endpoint returns any customer’s order as long as the user is logged in, the code runs without errors, without injection and without a dangerous function, and still has an authorization flaw. SAST sees no problem, and an ordinary DAST, which does not know that order 1043 belongs to someone else, does not either. The same goes for a discount applied twice, an approval flow that can be skipped, or a transfer limit checked only in the front end. Reading someone else’s order is what the OWASP Top 10 ranks first as Broken Access Control; the other logic flaws fall into categories such as Insecure Design. Some tools test access control when given accounts with different roles, but coverage depends on configuration and on someone who knows the business rules. That is why these flaws call for manual testing.

An illustrative example

This scenario is a composite of findings common in application assessments, not a real customer’s case.

A fintech runs a Java portal with a REST API. SAST, integrated into the repository, flags a query built by string concatenation in the reports module: the sort parameter goes straight into the ORDER BY clause. The team fixes it with an allowlist of columns. The same SAST raises dozens of XSS alerts in a component that uses its own escaping function; once the rules are tuned to recognize that function, the alerts disappear and the team trusts the tool again.

SCA shows an XML processing library with a known vulnerability, pulled in by a transitive dependency nobody knew was there. DAST, configured with a test user, finds the session cookie without HttpOnly and an error page that reveals the application server’s version.

As configured, the tools do not find the most serious issue: by changing the numeric identifier in the statement route, one authenticated customer reads another’s statement. That finding comes from the application pentest, which tests access control with two accounts of different roles.

Where each technique fits in the pipeline

  • In the IDE and the pull request: incremental SAST and SCA, so developers see the problem while they are still in context.
  • In the CI/CD pipeline: full SAST, SCA with a blocking policy for critical vulnerabilities, and DAST against the staging environment.
  • Before significant releases: a manual pentest focused on business logic and access control.

References such as the NIST SSDF (SP 800-218) and the OWASP ASVS help you define which checks your company requires at each stage.

What to ask a supplier

  1. Which languages and frameworks in my stack does the SAST cover with data flow analysis, and not only with pattern matching?
  2. How are the rules tuned to recognize my team’s sanitizing functions?
  3. Does the DAST test authenticated areas, and APIs from the OpenAPI specification?
  4. Does the SCA analyze transitive dependencies and licenses, and can it produce an SBOM?
  5. How do findings reach developers: in the IDE, in the pull request, or only in a separate dashboard?
  6. What do the tools leave out, and how is that scope covered by manual testing?

How Leonnes works with AppSec

Leonnes puts security into the development pipeline with Black Duck: SAST, SCA, DAST and IAST, API fuzzing and a unified view of risk. We run the analyses on real projects before you decide, integrate them with your repository, CI/CD and IDEs, calibrate the rules so the team gets real findings and, depending on the scope, add application pentests and training. See Leonnes’ AppSec.

See what an attacker would see first

We reply within one business day.