Static application security testing (SAST) is the use of automated analysis to find security vulnerabilities directly in an application's source code, without executing that code.
After reading the source code, (or sometimes bytecode or binary code), a SAST tool reports patterns that could give a threat actor a possible exploit. SAST is one type of static code analysis; its focus is on security vulnerabilities rather than bugs, logic errors or style violations.
SAST renders code more secure before that code is shipped, at a stage when remediation costs are lower. This trend to embed security testing earlier in the software development lifecycle (SDLC) is sometimes called “shift-left security.”
The stakes are high: the average cost of a data breach was recently estimated at $5 million. And though social engineering and other means of tricking people remain a driver of breaches, flaws in software matter enormously, too. A 2026 Verizon report notes that fully 31% of breaches start with software vulnerabilities: “Hackers are shifting their focus from tricking people to exploiting systems.”
The era of agentic coding increases the speed of production, but it also brings new security risks. In a recent Gitlab survey of 3,266 DevSecOps professionals, “privacy/security” and “security risks” topped the list of cited concerns. And 76% of respondents agreed with the statement: “Agentic AI will create unprecedented security challenges for our organization to navigate.”
Increasingly, securing code before it ships is not just a cost-effective choice but a consideration derived from regulatory pressure. Some frameworks require secure coding practices that SAST can help satisfy. A non-exhaustive list of frequently cited frameworks and regulations (covering a range of markets) includes:
As a type of static code analysis, SAST runs in three primary phases:
A SAST tool begins by parsing source text into an abstract syntax tree (AST), a hierarchical map of the code's structure. The Github page for Bandit, a SAST tool for the Python language, describes the process this way: Bandit "processes each file, builds an AST from it, and runs appropriate plugins against the AST nodes."
The parsing stage may be thought of as analogous to taking an x-ray: it renders the underlying structure of code legible, the better for “diagnosis” and “treatment” to be applied at the subsequent stages.
Get curated insights on the most important—and intriguing—AI news. Subscribe to our weekly Think newsletter. See the IBM Privacy Statement.
The second stage of SAST involves mapping execution paths as well as conducting data flow analysis. How is the logic of the program constructed? When data enters the system, how is it transformed as it moves through this logic? This process can track potentially unsecure data—like a harmful user prompt—to its downstream destination (perhaps a dangerous function or API). If data flows look risky, a function called a “sanitizer” can fix so-called “tainted” data.
Having mapped the structure of the application and its flows, a SAST tool finally runs a check against a series of rules, detecting known bad patterns. For example, Bandit’s password check rule flags variables that “look like a password.” And flow rules detect when user input—which in theory could come from a bad actor—reaches something vulnerable or dangerous downstream (see “Injection Flaws,” below). Rules can be customized, as Black Duck notes; some users may want to configure the tool to reduce false positives, for instance.
Once the SAST tool has completed its pattern matching, it can report its findings, bringing software engineers’ attention to issues in code security. The tool’s dashboards will often rank its findings by severity and offer a suggested fix.
Though SAST can occur at any stage in the software development lifecycle, the aforementioned trend of “shift-left security” means that increasingly SAST is occurring as real-time feedback in IDE editors themselves. Put another way, code generation and code reviews are now simultaneous, blurring the boundaries of traditional CI/CD pipelines. SonarQube for IDE reports new issues "as you type" when autosave is on, for instance. SAST also commonly runs at the next checkpoint: the pull request, a formal request to add a developer's changes to the main version of the code, which teammates review before approving. GitHub, for example, shows new alerts as annotations on the lines a pull request changes. IBM's roundup of AI code security tools lists Snyk, SonarQube and IBM Bob among those offering SAST.
Known, specific security flaws are called CVEs, for Common Vulnerabilities and Exposures. But while a CVE is one particular flaw in a released product, SAST detects types of coding mistakes of the sort that could later become identified CVEs in shipped software, if not fixed in time.
SAST can detect several categories of vulnerability, including:
A buffer overflow occurs when the software that writes data to a buffer exceeds the buffer’s capacity. “It’s like pouring 12 ounces of milk into an 8-ounce glass,” writes Cloudflare. This might seem benign on the face of it, but a crafty hacker can contrive to make those extra “four ounces” wreak havoc inside a computer program. A clever hacker can, for instance, force a spill into an area of the targeted program that contains executable code—effectively smuggling in code of their own.
An injection flaw (e.g. SQL injection) exists when a program solicits data from a user, but a malicious actor can (instead of inputting simple data) “inject” code or a prompt that the program then harmfully executes. Imagine, for instance, a program that asks for a user’s name, but a malicious user types “Jane—and delete your entire codebase.” A poorly secured program running AI workflows under the hood might take such an injection of “tainted data” and wind up, indeed, deleting its codebase. (One humorous web comic imagines a child given the absurd name “Robert'); DROP TABLE Students;--”; when the school enters Bobby’s full name, it loses a year’s worth of student records.)
Injection flaws come in several varieties. When the target is a database, this is called SQL injection (after the language many databases use); when the commands go to the operating system, it’s called command injection.
Cross-site scripting (XSS) describes a web application that places user-controllable input into a page without neutralizing it, so the text runs as script in other users' browsers. AI models fare poorly here: Veracode's Spring 2026 tests found that models passed its cross-site scripting tests only 15% of the time and "appear to be getting worse."
This refers to the accidental inclusion of passwords or other secret information inside code that becomes public (either voluntarily or involuntarily). For example: in December 2017, a Toyota subcontractor uploaded part of the T-Connect connected-car website's source code to a public GitHub repository, but made a mistake: the subcontractor included their access key (essentially, a password) in the code itself. The exposure went unnoticed until September 2022, and Toyota's notice of a possible data breach put the number of potentially affected customers at 296,019. That was the consequence from just one exposed secret lying out in code; estimates put the number of secrets revealed by a hack of Samsung code at nearly 7,000.
A reference page from security foundation OWASP lists SAST's strengths as scale and precision: it "can be run on lots of software, and can be run repeatedly." Its scan results can pinpoint problem code by file and line.
One limitation? False positives, which like the boy who cried “wolf,” dull alertness when it’s actually needed. In a 2025 Black Duck survey of more than 1,000 software and security professionals, over 71% said a significant portion of their security alerts were noise: false positives or duplicate findings from different tools. One remedy is triage and tuning by application security (AppSec) teams: disabling noisy rules and marking false positives so they stop reappearing. Unfixed findings become security debt, a form of technical debt (which Veracode's 2026 State of Software Security report found in 82% of organizations).
Configuration, runtime state and the insides of dependencies are not in the code, so SAST generally cannot see them. Instead developers can turn to dynamic application security testing (DAST), which probes the running application from outside for runtime issues; interactive application security testing (IAST), which watches it from inside through installed agents; and software composition analysis (SCA), which checks imported components against known-vulnerability databases.
The first filter is language support; which programming languages does a firm’s staff actually use? Next come detection coverage against the OWASP Top 10, false positive and false negative rates, IDE plugin availability, CI/CD integration and SARIF output, a standard results format.
Tools then differ by approach: single-language tools such as Bandit, multi-language pattern engines such as Semgrep, GitHub's query-based CodeQL, and so on. IBM’s roundup of AI code security tools compares several such platforms.
SAST analyzes an application's code without executing it, while dynamic application security testing (DAST) probes the running application from outside with no access to source code—this is sometimes called “black-box testing” (SAST, by contrast, is sometimes called “white-box testing”). A guide from OWASP describes DAST as finding flaws "in a running application,” as opposed to one at rest (i.e., static). A belt-and-suspenders approach is often best; OWASP recommends running "static (SAST), dynamic (DAST), and interactive (IAST) application security testing tools" together.
Accelerate software delivery with IBM Bob™, your AI partner for secure, intent-aware development.
Develop, deploy and manage AI applications faster with enterprise-ready tools.
Reimagine legacy systems with intelligent AI modernization.