taint analysis
Tracking untrusted data from where it enters (a source) to where it would be dangerous (a sink), unless it passes a sanitiser first.
In more detail
Simple pattern rules only see one expression, so they miss input that flows through several functions. Semgrep's taint mode follows the data instead.
Example
In the course, request.args.get is the source and os.system the sink, and a function that strips one character is still reported because the scanner cannot prove the cleaning is complete.Related terms
- static application security testing — Analysing source code without running it to find insecure patterns, such as SQL built from user input.
- Semgrep — An open-source static analysis tool whose rules look like the code they match, with metavariables and ellipses for the parts that vary.
- sink — In taint analysis, a function where untrusted data becomes dangerous, such as os.system, eval or a raw SQL call.
- untrusted input — Any data a program did not create itself, including arguments, form fields, request bodies, file contents, file names and environment variables.
- static application security testing — Finding security problems by reading a program's source code without running it.
Taught in
- Static Application Security Testing with Semgrep — Cloud Security & DevSecOps Engineering
- Static Application Security Testing — Application Security & Threat Modeling for Engineers