Static Application Security Testing (SAST)

Static application security testing (SAST) scans an application's source code for security flaws, such as SQL injection or hardcoded passwords, without running it. It finds problems early, while developers are still writing code.

AdvancedCategory: Cloud and software supply chain

Also called: SAST, static code analysis, source code analysis, white-box testing

What is SAST?

Static application security testing examines an application's source code, bytecode or binaries for security weaknesses without running the program. "Static" means the code is analyzed at rest. Because it has the full code, SAST is sometimes called white-box testing.

NIST's Secure Software Development Framework (SSDF) lists reviewing and analyzing code for vulnerabilities as a core practice, and automated static analysis is one of the main ways teams do it.

How it works

SAST tools parse the code and trace how data moves through it. A classic check: does user input from a web form reach a database query without being cleaned first? If so, that's a likely SQL injection. Tools run in developers' code editors, on every pull request or in the CI/CD pipeline.

What SAST catches

  • Injection flaws such as SQL injection and command injection
  • Cross-site scripting
  • Hardcoded passwords and API keys
  • Use of weak cryptography
  • Buffer overflows in languages like C and C++
  • Insecure use of risky functions

Strengths and weaknesses

OWASP's overview of source code analysis tools sums up the trade-offs:

Strengths: it finds flaws early, when they're cheapest to fix; it points to the exact file and line; it scales across large codebases; and it doesn't need a running application.

Weaknesses: it produces many false positives; it struggles with flaws that depend on configuration or how components interact at runtime; it can't find most authentication, access control or business logic problems; and support varies by programming language.

SAST vs DAST

SAST looks at code from the inside. DAST tests the running application from the outside, as an attacker would. They find different problems, so mature teams use both, along with dependency scanning for open-source components and manual penetration testing.

For businesses that buy software

Ask custom developers and software vendors whether they run SAST as part of a secure development lifecycle, and how they handle what it finds.

Related terms

Sources

  1. SP 800-218: Secure Software Development Framework (SSDF) Version 1.1 (NIST)
  2. Source Code Analysis Tools (OWASP)

Drafted with AI assistance, then edited and fact-checked by a person. How we use AI.