Digital Lecture Notes · Lecture 0 · Introduction
Instructors: Prateek Saxena and Diego Meyer

Introduction to Computer Security

A self-paced walkthrough of the opening lecture: the slides, rebuilt for reading, with commentary, the original references, things to try, and checkpoints along the way.

Instructors  Prateek Saxena and Diego Meyer Course  Computer Security Level  Year 3 Time  ~30 min read
How to use this page. Read top to bottom at your own pace. Try it blocks point to things you can open and poke at, and checkpoints let you test yourself. Every link from the original slides is preserved.
01 · Motivation

Why should you care about security?

Security failures are not abstract. They cost money, leak the personal records of hundreds of millions of people, and (in cyber-physical systems like cars, pacemakers, and power grids) they threaten lives. Before we study any single attack, it helps to see the shape and scale of the problem.

There is a real economy behind attacks

Attacks are not just the work of lone hobbyists. Behind them sits a mature underground economy: an organised market that sells stolen data, exploit kits, malware installs and money laundering, turning hacking into a profit-driven business. It has specialists. A pay-per-install service, for example, will for a fee install your malware on thousands of machines it has already compromised, so an attacker who cannot break into anything can simply buy the victims. Researchers have tried to measure what all of this costs society.

{{ pan.label }} {{ pan.totalText }}

Roughly {{ costRatio }} more is spent defending against cybercrime than criminals actually take.

{{ pan.shortLabel }}
{{ it.name }} {{ it.valueText }}
Global estimates in US$ millions per year, from Anderson et al., Measuring the Cost of Cybercrime, WEIS 2012 {{ cite.weis2012 }}; revisited in the 2019 follow-up {{ cite.weis2019 }}.

Those defensive costs are paid whether or not an attack ever lands, and they include the trust an incident destroys. That asymmetry is a recurring theme in the course: a big part of thinking clearly about security is asking who pays, and how much, on each side.

Data breaches keep getting bigger

Every one of these bubbles is a breach that spilled personal records, and the largest run into the hundreds of millions {{ cite.iib_breaches }}. The biggest entry on the chart, India’s Aadhaar at 1.1 billion records, is disputed: the authority that operates Aadhaar denies its database was breached, and attributes the reported access to misuse of a public search facility that exposes names and addresses but no biometrics {{ cite.aadhaar_dispute }}. Worth noting early that even headline numbers in security are often contested.

Bubble chart of the world's biggest data breaches sized by number of records
World's biggest data breaches, sized by records lost. Source: Information is Beautiful.

And the raw supply of bugs keeps growing

The number of publicly disclosed software vulnerabilities per year has trended sharply upward. Two different things drive that, and it pays to keep them apart. More bugs are genuinely being found, because automated discovery has become cheap: OSS-Fuzz alone has helped fix over 13,000 vulnerabilities across a thousand open-source projects {{ cite.ossfuzz }}. But the count also depends on who is allowed to issue an identifier, and there the change is larger still. The CVE Program had 24 organisations authorised to assign IDs in 2016; by 2024 it had more than 400, across 40 countries {{ cite.cve_cnas }}. More of what gets found now gets a number.

CVE records published per year {{ cvePeak }}
{{ b.tick }}

{{ cveSummary }}

Complete calendar years only, counted by publication date from the NIST National Vulnerability Database {{ cite.nvd_stats }}, retrieved July 2026.
Try it · explore the live data

These are living datasets. Open them and look for the most recent year:

02 · The core tool

Threat models: thinking critically about security

Whatever else you take from this course, two ideas are meant to outlast it: principles of critical thinking about security threats, and the concept of a threat model and how to apply it. The second is the tool that makes the first practical, so it is where we start.

A threat model is the single most important reasoning tool in this course. It forces you to state, precisely, what a defence protects against, and therefore what it does not. Any claim that something is “secure” is meaningless until you name the threat model it is secure against.

A threat model has four parts:

Setup
The starting state of the world.
Assumption
What we take for granted about the environment.
Attacker capability
What the attacker can and cannot do.
Attacker goal
What counts as a win for the attacker.

Worked example: Sign the back of a credit card?

Signing a credit card is a security mechanism. Let's use the four-part framework to figure out exactly what it protects against. Step through it:

A hand signing the back of a credit card
Threat model · step {{ ccStepNum }} of 5
{{ c.tag }}
{{ c.body }}
Checkpoint · {{ quizA.tag }}

{{ quizA.question }}

{{ quizA.explanation }}

A defence is only as good as its threat model

Signing the card defeats a specific attacker: one standing at a physical terminal who cannot reproduce your handwriting. Change the threat model and the defence evaporates. Threat models are reasoning tools that let us systematically separate a real sense of security from a perceived one.

Checkpoint · {{ quizB.tag }}

{{ quizB.question }}

{{ quizB.explanation }}
Think it through

Modern card-not-present payments, where the card is never shown and only the numbers are entered, check no physical signature at all. Write the four-part threat model for online card fraud, then reveal a model answer.

Setup: A customer's card number, expiry, and CVV exist and are entered on websites.

Assumption: No human ever inspects a signature; the merchant only checks that the numbers are valid.

Attacker capability: Can obtain card numbers in bulk (phishing, breaches, skimmers) but is not physically present.

Attacker goal: Make fraudulent purchases at scale. The handwritten-signature defence is simply irrelevant here, which is why the industry moved to CVV, 3-D Secure, and tokenisation.

03 · Attacker economics

“Nothing is ever secure”: a common misconception

It's tempting to shrug and say every system can eventually be broken, so why bother? That's the wrong frame. Security is a cat-and-mouse game, yes, but you win it by analysing the attacker's cost versus the defender's cost at each step. A good defence doesn't make attacks impossible; it makes them uneconomical.

The decisive question is not “can it be broken?” but “does the attack scale cheaply?” An exploit that costs the attacker a lot per victim (physical access, custom hardware) is far less dangerous than one that costs almost nothing to repeat a million times (a wormable memory bug, a phishing kit). Keep this asymmetry in mind for the rest of the course.

Mapping threats by what they cost each side

One way to reason about a threat is to place it on two axes: what one more victim costs the attacker, and what coping with it costs the defender. Here is roughly where a few familiar things land, and what a defence does to them.

Cost to the defender  →  higher
Worry about this corner
Attacks that do not scale
{{ d.name }} {{ d.note }}
{{ t.name }}
{{ t.note }}
Cost to the attacker, per victim  →  higher

Dots are threats. An arrow is what a defence does: it cannot delete a threat, it can only push it to the right, making each attempt cost the attacker more. Ask of any defence how far right it pushes, and what deploying it costs you.

04 · What this module does

The objective of this module

Now that you have the tool, here is what the rest of the module does with it. For each popular class of security threat, we work through three things in a fixed order:

  1. Take the threat and understand how it actually works. For Part I, that means memory errors and the exploits built on them.
  2. Analyse its threat model, precisely, using the four-part framework above.
  3. Learn the defences, and argue about what each one does and does not buy you.

Note the emphasis. Attacks are studied because you cannot reason about a defence without knowing what it is defending against, but they are the means here, not the end. This is not CS2107 again, and it is not a CTF.

05 · Syllabus & logistics

Syllabus & logistics

This book is Part I of the module: memory safety. Six lectures, from this introduction through to non-control-flow attacks, all of them about code that reads or writes memory it should not. Rust and elementary cryptography belong to Part II and are not covered here, though the Rust assignment is assessed against the ideas Part I sets up: once you have seen what goes wrong in C, a language that forbids it by construction is the obvious next question.

#
Lecture, and what it covers
Assumes
Read
{{ r.tag }}
{{ r.title }}
{{ r.covers }}
{{ r.needs }}
{{ r.read }}
Six lectures, read in this order.
{{ syllabusTotal }}
Prerequisite self-test Check the systems-programming background this module assumes: memory layout, the build toolchain, and the x86 calling convention. Answer it and check your score. Take the self-test →
Prerequisites & workload
  • CS2107, C programming, the basics of OS processes.
  • Self-paced, and it expects self-learning.
  • The module is heavy. It asks you to write secure code, and to argue about security rather than assert it.
How Part I is assessed
  • A memory-safety assignment: exploit real vulnerabilities. Individual.
  • A Rust programming assignment, sitting in Part II. Individual.
  • A midterm on Part I: in lecture, closed-book, no retakes.
Getting help
  • Ask on Canvas Discussions by default, so the answer is visible to everyone. It is a large class, and the same question asked privately gets answered once instead of once for all.
  • Neither the TAs nor the instructor will debug your code for you.
  • For anything specific to you, email via Canvas and CC the TA: adityajha@u.nus.edu.
  • There are no physical tutorials. Weekly Q&A sessions with the TAs run online; times are on Canvas.
Academic honesty
  • Do not use AI tools in any Part I assignment or exam.
  • Every graded component in Part I is done individually.
  • If you sought help elsewhere, acknowledge it: cite the source or the person.
  • Academic dishonesty results in an F for the module.

Weights, dates, deadlines and Q&A times change each semester and are not repeated here. Canvas is authoritative for all of them.

06 · Expectations

What makes this module different

This is not a course about a single artefact like an OS or a database. It teaches the attacker's perspective (essentially, how not to build things) so that you can build them soundly. It's as much about a way of arguing as it is about new facts: making sound security arguments (threat models), and learning principles and abstractions for secure construction. The spirit is DIY and open-ended.

FROM PAST STUDENTS (ANONYMISED)

“Lectures are conceptual; assignments and quizzes expect you to understand things in depth.”

“I spent 14 hours learning a new language… reading external references… all with little help.”

There is a real gap between theory and systems in security, and closing it is the point. Lectures give the main message; the exercises fill in the details with examples, and exams test both. Nothing in the coding assignments works out of the box: be resourceful, tinker, and resist the urge to reach for AI. If you want push-button hacking, this is not that course.

Let's start

You now have the mindset. Next: real bugs.

The first technical lecture puts the threat-model lens to work on the oldest and most dangerous class of bugs: memory-safety vulnerabilities (buffer overflows, format-string bugs, integer overflows, and the exploits built on them).

Both halves of that claim are measured, not rhetorical. Memory-safety bugs accounted for roughly 70% of the CVEs Microsoft patched over twelve years {{ cite.msrc_bluehat }}, and about 70% of the serious bugs Chromium found across 912 high-severity reports {{ cite.chromium_memsafe }}. Two independent codebases, the same number. And the class is as old as the network: the 1988 Morris worm {{ cite.spafford_worm }} spread partly through a gets() overflow in fingerd.

Digital Lecture Notes · Instructors: Prateek Saxena and Diego Meyer

07 · Sources

References

[{{ r.n }}] {{ r.cite }} ↗ {{ r.linkLabel }}

Links last checked July 2026. The NVD dataset {{ cite.nvd_stats }} changes continuously; the chart above is a snapshot, and its caption gives the year it was taken.