Module 5 — Program Analysis Bootcamp
From numeric properties to security properties
ABSTRACT_DOMAINType a malicious input and watch the query break.
Three phases: Source introduces taint, Propagation spreads it, Sink checks for it.
| Sources | get_param, read_cookie, read_input |
| Sinks | exec_query, exec_cmd, send_response |
| Sanitizers | escape_sql, html_encode, shell_escape |
A flat 4-element lattice — same shape as Sign domain, different meaning.
| join | Bot | Unt | Tai | Top |
| Bot | Bot | Unt | Tai | Top |
| Unt | Unt | Unt | Top | Top |
| Tai | Tai | Top | Tai | Top |
| Top | Top | Top | Top | Top |
join Tainted Untainted = Top — if data might be either, treat as potentially tainted (conservative/sound).
Define what's dangerous — sources, sinks, and sanitizers are configurable, not hard-coded.
When the analyzer encounters Call(name, args):
Tainted
Untainted
Top (conservative)
Call(name, args) nodes. Same analyzer, different configs → detect different vulnerability classes.
Click any expression type to see how taint propagates.
Click a rule on the left to see an example.
"safe" + tainted = tainted.
Watch taint flow through a 6-line program, step by step.
For each line, predict the taint status of the assigned variable.
Answer all questions and click "Check All"
At each Call(name, args) that is a sink — check if the relevant argument is tainted.
is_potentially_tainted returns true for both Tainted and Top — because Top means "might be tainted" and a sound analysis must warn.
Sanitizers are vulnerability-type-specific — the wrong sanitizer doesn't help!
exec_query(input)
send_response(input)
exec_cmd(input)
redirect(input)
Match each sink to the correct sanitizer, then click "Check All"
| SQLi | XSS | CmdInj | PathTrv | Redir | |
| escape_sql | ✓ | ✗ | ✗ | ✗ | ✗ |
| html_encode | ✗ | ✓ | ✗ | ✗ | ✗ |
| shell_escape | ✗ | ✗ | ✓ | ✗ | ✗ |
| validate_path | ✗ | ✗ | ✗ | ✓ | ✗ |
| validate_url | ✗ | ✗ | ✗ | ✗ | ✓ |
Two ways secret data can leak — through data or through control.
x reveals whether secret == 1234. The value of secret influences x through the branch, not through assignment. Standard taint propagation misses this!
Track whether we're inside a branch controlled by tainted data.
Click a vulnerability type to see the attack pattern, detection, and fix.
Click a vulnerability card on the left.
${v.source}
Sink:${v.sink}
Sanitizer:${v.sanitizer}
The complete security analysis pipeline — from AST to vulnerability report.
Analyze this code — identify the source, sink, vulnerability type, and fix.
Identify all four elements and click "Check All"
Taint analysis is sound (no missed bugs) but can be imprecise (false alarms).
"SELECT " + escape_sql(x) is safe at the string level. Must rely on sanitizer config.x and y point to the same data, tainting x should taint y. Our analysis treats variables independently.Production tools that use taint analysis ideas at scale.
Click a tool on the left to learn about it.
The essential ideas from Module 5 — Security Analysis.
A complete summary of security analysis concepts.
For each real-world scenario, identify the vulnerability and choose the correct defense.
Q1. A web app takes a search query from the URL and displays it on the results page: "Results for: " + query
Q2. A file download endpoint uses the filename from the request: open_file("/uploads/" + filename)
Q3. A login page redirects users to a "return URL" after login: redirect(get_param("next"))
Q4. An admin panel lets operators run diagnostics: exec_cmd("ping " + host)
Answer all scenarios and click "Check All"
Test your understanding of taint analysis fundamentals.
Q1. What does join Tainted Untainted equal?
Q2. Why does the taint lattice NOT need widening?
Q3. What does is_potentially_tainted return true for?
Trace taint through branching code with implicit flows.
With pc_taint tracking:
Fill in the answers and click "Check"
For each scenario, identify the full taint path and whether the code is safe.
Scenario 1:
Scenario 2:
Scenario 3:
Answer all scenarios and click "Check All Answers"