Textbooks & primary references
- NNH
- Nielson, Nielson, Hankin. Principles of Program Analysis. Springer, 2005.
- M&S
- Møller & Schwartzbach. Static Program Analysis. cs.au.dk/~amoeller/spa/ (free).
- Aho
- Aho, Lam, Sethi, Ullman. Compilers: Principles, Techniques & Tools, 2nd ed.
- FB
- Zeller, Gopinath, Böhme, Fraser, Holler. The Fuzzing Book. fuzzingbook.org.
Readings for this week will be posted when the week begins.
L1. Course intro & motivation
- Slides
- L1 — Course intro & motivation (PDF)
- Handout
- L1 — handout (PDF)
- Follow
- Paper
- Outline
- Why analyze programs; kinds of bugs and vulnerabilities; a tour of the course; grading, logistics, tools.
L2. Static, dynamic, and hybrid analysis; program invariants
- Handout
- L2 — handout (PDF)
- Follow
- NNH §1.1–1.3; RY ch. 1
- Paper
- Ernst, “Static and Dynamic Analysis: Synergy and Duality”, WODA 2003; Ernst, Cockrell, Griswold, Notkin, “Dynamically Discovering Likely Program Invariants…” (Daikon), TSE 2001.
- Outline
- Static vs dynamic vs hybrid; running examples; what an “invariant” is; over- and under-approximation.
L3. Vulnerability assessment and secure coding
- Slides
- L3 — Vulnerability assessment and secure coding (PDF)
- Handout
- L3 — handout (PDF)
- Follow
- Paper
- Wagner, Foster, Brewer, Aiken. “A First Step Towards Automated Detection of Buffer Overrun Vulnerabilities”, NDSS 2000; One. “Smashing the Stack for Fun and Profit”, Phrack 1996.
- Outline
- Threat models; common vulnerability classes (memory safety, integer overflow, injection)
Readings for this week will be posted when the week begins.
L4. Soundness, completeness, undecidability
- Slides
- L4 — Soundness, completeness, undecidability (PDF)
- Handout
- L4 — handout (PDF)
- Outline
- Rice's theorem; sound vs complete analyses; soundy analyses in practice.
L5. Precision, recall, F-measure for analyzers
- Slides
- L5 — Precision, recall, F-measure for analyzers (PDF)
- Handout
- L5 — handout (PDF)
- Outline
- True/false positives & negatives
L6. Program representation: AST, CFG, intermediate representations
- Slides
- L6 — Program representation (PDF)
- Follow
- Aho ch. 5 & 8; NNH §1.5; Introduction to the Clang AST; CIS 547 — LLVM Framework Primer
- Paper
- Cytron et al. 1991 (SSA).
- Outline
- What LLVM is and how its front-end/back-end pipeline fits together; abstract syntax trees; the Clang AST (inspect / detect / transform); dumping a tree with
clang++ -Xclang -ast-dump -fsyntax-only; reading an AST dump; branch instrumentation as a worked example; from AST to CFG to IR.
Readings for this week will be posted when the week begins.
L7. Clang tutorial: libtooling & AST-based analysis
- Slides
- L7 — Clang tutorial (external PDF, KAIST CS492)
- Follow
- LibTooling; RecursiveASTVisitor-based ASTFrontendActions; AST Matchers tutorial
- Outline
- Building a stand-alone Clang tool;
ASTFrontendActionandASTConsumer; walking the tree withRecursiveASTVisitor;SourceManagerand source locations; rewriting source withRewriter; coverage instrumentation at the source level. - Note
- Delivered from the KAIST CS492 Clang tutorial deck linked above; the AST material it builds on is in L6.
L8. LLVM IR
- Slides
- L8 — LLVM IR (PDF)
- Follow
- LLVM Language Reference; CIS 547 — LLVM Framework Primer; Lattner & Adve 2004
- Paper
- Lattner & Adve 2004 (LLVM design).
- Outline
- The LLVM pipeline: Clang front end → IR →
optpasses → back end; analysis vs transformation passes; the three IR formats (in-memory, bitcode.bc, textual.ll);clang -S -emit-llvm; module / function / basic block / instruction structure; iterating the IR (STL,auto,inst_iterator); introduction to SSA form and why it helps analysis.
L9. LLVM IR (continued): CFGs & the LLVM class hierarchy
- Slides
- L9 — LLVM IR continued (PDF)
- Follow
- LLVM Programmer's Manual; llvm::Value / llvm::Instruction doxygen
- Outline
- C program → LLVM IR walk-through; basic blocks and the CFG (
opt -p=dot-cfg); SSA — one definition per variable, instruction as value name; printing withouts()/errs(); the class hierarchyValue→User→Instruction;isa/cast/dyn_cast;LoadInst,StoreInst,BinaryOperator,PHINode;BasicBlockandFunctiontraversal. - Announced
- From Week 4 onwards the class meets on Tuesday, Wednesday and Thursday. HW-1 released (due Fri 21 Aug, 23:59 IST).
Timetable change. From this week the class meets on Tuesday, Wednesday and Thursday (announced in L9).
Readings for this week will be posted when the week begins.
L10. Software specifications; safety & liveness
- Slides
- L10 — Software specifications (PDF)
- Follow
- Naik, “Software Specifications”, CIS 5470 (Penn); The Checker Framework manual
- Paper
- Outline
- What a specification is and why there is nothing to test without one; kinds of specifications; pre- and post-conditions and weakest pre-conditions; contracts in testing vs verification; safety and liveness; typestate properties; types as lightweight specs and the Checker Framework; black-box vs white-box, automated vs manual testing.
L11. Hoare logic
- Slides
- L11 — Hoare logic (PDF)
- Follow
- Svendsen, Hoare Logic and Model Checking (Cambridge), lectures 1–3
- Paper
- Hoare, “An Axiomatic Basis for Computer Programming”, CACM 12(10), 1969.
- Outline
- Program state and assertions; the Hoare triple
{P} C {Q}; partial vs total correctness; inference rules forskip, assignment, sequence, conditional and consequence; the assignment rule read backwards; the while rule, loop invariants and the three proof obligations.
L12. Invariants & specification inference
- Slides
- L12 — Invariants and specification inference (PDF)
- Follow
- Naik, “Software Specifications”, CIS 5470 (Penn); JML
//@invariant///@requiresannotations - Paper
- Flanagan, Leino, “Houdini, an Annotation Assistant for ESC/Java”, FME 2001; Ernst et al., “Dynamically Discovering Likely Program Invariants” (Daikon), TSE 2001.
- Outline
- Program, loop and class invariants; why validity is not enough — the useful invariant is the one implying the post-condition; inferring specifications instead of writing them; the Houdini algorithm (candidate invariants, refutation, workflow) on buggy and corrected programs; pros and cons.
Wed 26 Aug — no class (holiday).
Readings for this week will be posted when the week begins.
L13. Coverage & mutation testing
- Slides
- L13 — Coverage & mutation testing (PDF)
- Follow
- Zhu, Hall, May, “Software Unit Test Coverage and Adequacy”, ACM CSUR 1997; Aho §9 (CFG background for branch coverage)
- Paper
- Jia, Harman, “An Analysis and Survey of the Development of Mutation Testing”, TSE 2011.
- Outline
- Test adequacy — when is a test suite “enough”; statement / line, branch, condition and MC-DC coverage; coverage on the CFG and what coverage does not tell you; instrumenting a program to measure it; mutation testing — mutation operators, mutants and the mutation score; killed vs surviving mutants; equivalent mutants and undecidability; cost and mutant-reduction techniques.
L14. Introduction to fuzzing
- Slides
- L14 — Introduction to fuzzing (PDF)
- Follow
- FB “Introduction to Fuzzing” & “Greybox Fuzzing”; AFL technical whitepaper (M. Zalewski)
- Paper
- Miller, Fredriksen, So, “An Empirical Study of the Reliability of UNIX Utilities”, CACM 1990; Böhme, Pham, Roychoudhury, “Coverage-based Greybox Fuzzing as Markov Chain” (AFLFast), CCS 2016; Fioraldi et al., “AFL++”, WOOT 2020.
- Outline
- Random testing and the 1990 UNIX utilities study; blind vs mutation-based fuzzing; seeds, corpora and mutation operators; what counts as a bug — crashes, assertions and sanitizers (ASan / UBSan / MSan) as oracles; black-, white- and greybox fuzzing; coverage-guided greybox fuzzing (AFL, libFuzzer, AFL++); edge-coverage instrumentation and the coverage bitmap; corpus scheduling and power schedules.
Tue 1 Sep — no class (Institute Day).
Readings for this week will be posted when the week begins.
L15. Fuzzing (continued): grammar-based fuzzing & concurrency testing
Slides, readings and outline posted when this lecture is delivered.
L16. Dataflow analysis: lattices & fixed points; reaching definitions
Slides, readings and outline posted when this lecture is delivered.
Readings for this week will be posted when the week begins.
Quiz 1 on Thu 10 Sep, 2:00 PM — covers Topics 1–3.
L17. Available expressions & very busy expressions
Slides, readings and outline posted when this lecture is delivered.
L18. Live variables & DCE; interval analysis, widening & abstract interpretation
Slides, readings and outline posted when this lecture is delivered.
Quiz 1
- Covers
- Topics 1–3 (Foundations, Testing/Fuzzing, Dataflow) — definitions, algorithms, worked examples; closed book.
No classes. Mid-sem exam covers L1–L18 (Topics 1–3).
Project proposal due Sun 20 Sep.
Readings for this week will be posted when the week begins.
L20
Title, topic and materials posted when this lecture is delivered.
L21
Title, topic and materials posted when this lecture is delivered.
Readings for this week will be posted when the week begins.
L22
Title, topic and materials posted when this lecture is delivered.
L23
Title, topic and materials posted when this lecture is delivered.
L24
Title, topic and materials posted when this lecture is delivered.
Readings for this week will be posted when the week begins.
L25
Title, topic and materials posted when this lecture is delivered.
L26
Title, topic and materials posted when this lecture is delivered.
L27
Title, topic and materials posted when this lecture is delivered.
Readings for this week will be posted when the week begins.
L28
Title, topic and materials posted when this lecture is delivered.
L29
Title, topic and materials posted when this lecture is delivered.
Readings for this week will be posted when the week begins.
L31
Title, topic and materials posted when this lecture is delivered.
L32
Title, topic and materials posted when this lecture is delivered.
Readings for this week will be posted when the week begins.
L33
Title, topic and materials posted when this lecture is delivered.
L34
Title, topic and materials posted when this lecture is delivered.
L35
Title, topic and materials posted when this lecture is delivered.
Readings for this week will be posted when the week begins.
Quiz 2 on Thu 5 Nov, 2:00 PM — covers Topics 4–8.
L37
Title, topic and materials posted when this lecture is delivered.
Quiz 2
- Covers
- Topics 4–8 (Pointer, Constraint-based, Types, SymExec, Test generation) — definitions, algorithms, worked examples; closed book.
Readings for this week will be posted when the week begins.
L38
Title, topic and materials posted when this lecture is delivered.
L39
Title, topic and materials posted when this lecture is delivered.
Three guest lectures from industry practitioners, interleaved
with regular lectures to give a working-engineer view of
program analysis in real security/tooling teams. Format: 45 min talk
+ 10 min Q&A. Held in Room 5G4. Speakers
& topics will be filled in as they confirm;
L19. Industry Talk 1
- Speaker
- TBA
L30. Industry Talk 2
- Speaker
- TBA
L36. Industry Talk 3
- Speaker
- TBA