Static Application Security Testing

Research
Introduced by
Various researchers
Year
2000s
Type
source code vulnerability detection
Family
Software security testing

What does it do?

Static Application Security Testing (SAST) is a security analysis technique that examines source code without executing the program, in order to identify potential vulnerabilities and security-relevant code quality issues.

It analyzes code structure and data flow to flag patterns such as SQL injection, buffer overflows, and insecure cryptographic usage. SAST is commonly used as a shift-left practice, so that findings can surface early in development rather than after deployment.

The intuition behind the method

SAST parses source code into an internal representation, such as an abstract syntax tree, and then follows how values move through the program. Taint analysis treats untrusted input as a source and traces it toward sensitive operations, or sinks, such as database queries and file operations. Rules flag patterns such as untrusted input reaching a SQL query (SQL injection), an unchecked array index (buffer overflow), or a weak cryptographic primitive. Because the code is read rather than run, the analysis does not need test inputs that happen to reach a given branch, although tools still cannot analyze every path in full, so coverage is partial in practice.

History

SAST grew in prominence during the 2000s as security concerns increased in software development. Earlier static checkers had already analyzed C code for issues including memory safety; Lint and Splint are examples. Commercial and open tools such as Fortify, Checkmarx and SonarQube are commonly named in the literature as later products that made this type of analysis widely available. SAST later became a common part of secure development practice and of many modern development toolchains.

When to use it

Use SAST when the source code is available and you want security findings before a build or deployment, for example as a check in continuous integration or before code review. It is best suited to classes of flaw that can be seen in code, such as injection, weak cryptography, and hardcoded secrets. Check that the tool supports your language and frameworks, because rules and taint models are written per language. Do not rely on SAST alone for runtime behaviour, deployment configuration, or business-logic flaws; these need dynamic testing or manual review. Coverage is generally weaker for dynamically typed languages, where it is harder to determine which code is actually called.

Limitations and considerations

  • High false positive rate; many reported flows may not be exploitable once the surrounding context is considered
  • Cannot detect runtime issues or flaws that depend on deployment configuration
  • Reflection, dynamic dispatch and dynamic typing make it hard to determine which code is actually called, so some flows are missed or misattributed
  • Cannot trace data flow through external dependencies or third-party libraries unless their behaviour is modelled

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Does not need a running application or a deployed environment, so checks can run during the build
  • Reads code that tests may never execute, such as rarely used error-handling branches, although coverage remains partial
  • Findings point to specific code locations, which helps developers locate and fix the source of a flow
  • Rules can be extended to cover internal wrappers and in-house security functions

Applications

  • Continuous integration pipelines for automated vulnerability scanning during build processes
  • Pre-deployment code review to identify security issues before production release
  • Compliance programmes where code review or static analysis is expected, such as PCI-DSS; check the framework's own text to see whether a given scan satisfies a requirement
  • Third-party software assessment during vendor evaluation and supply chain security
  • Legacy code modernization and security hardening of existing applications
  • Development training by providing developers with immediate feedback on security issues

How it works

How it works

1

Parse the source code into an abstract syntax tree (AST) or intermediate representation, recovering the program structure and control flow.

2

Build a symbol table and a data flow graph that record variable declarations, assignments, and how each value is used.

3

Run taint analysis: mark untrusted inputs as sources and trace them through assignments and calls to sinks such as database queries or file operations. A flow that passes through a sanitiser the rules recognize is usually not reported, so the configured list of sanitisers directly affects the results.

4

Match the identified flows and patterns against the rule set's vulnerability signatures and misconfiguration checks, and report each match with its code location and a severity level. Treat each result as a candidate flow rather than a confirmed vulnerability. Many tools also report a confidence level, and severity and confidence should be read separately. To triage a finding, trace the flow from its source to the reported sink, check whether validation or encoding is applied on the way, and then confirm, fix or suppress it. Record each suppression with a reason so that the decision can be reviewed later.

Common pitfalls

  • Treating findings as confirmed vulnerabilities without triage; each flow needs to be checked against the real input handling
  • Leaving custom validation or encoding wrappers unknown to the rules, which produces false positives on code that is in fact protected
  • Enabling every rule at maximum severity, which causes alert fatigue and makes real issues harder to see
  • Relying on SAST alone; flaws that only appear at runtime or in configuration need dynamic testing

Frequently asked questions

Why does SAST report so many false positives?

SAST conservatively flags potential issues without knowing whether they are actually exploitable. Context matters: a flow into a dangerous function may be safe if the input is validated or encoded on the way, and a rule set may not recognize the validation. Developers need to triage findings to separate real risks from false alarms.

Can SAST find all security vulnerabilities?

No. SAST finds code-level patterns covered by its rule set, but it misses logic flaws, authentication bypass and runtime configuration issues. It is most effective when combined with dynamic testing and manual review.

Is SAST sufficient for compliance?

Some compliance frameworks expect code review or static analysis, including PCI-DSS. Whether a given tool or scan satisfies a specific requirement depends on that framework, so the requirement should be checked against its text. SAST alone is generally not enough, since compliance programmes usually also involve dynamic testing, manual review and audits.

How do I reduce SAST false positives?

Set rule severity levels deliberately, suppress confirmed non-issues with documented annotations, and triage and validate findings on a regular schedule. Teaching developers secure coding reduces the number of genuine vulnerabilities, which lowers the overall alert volume over time.

Which SAST tool should I choose?

The choice depends on your programming languages, integration needs and budget. Commonly considered options include Checkmarx, Fortify, SonarQube and open-source tools. Evaluate candidates on a trial basis using your own codebase, since results vary by language and framework.

Related methods

Sources

  1. Chess, B., & West, J. (2007). Secure Programming with Static Analysis. Addison-Wesley Professional.

    ISBN: 978-0321424778
  2. Walz, C., Seifert, H. P., & Fischer, A. (2010). Static source code analysis tools. In Secure Software Development (SANS Institute), pp. 1-20.

    Open publication reference