Introduction

Note: These lecture notes were slightly modified from the ones posted on the 6.858 course website from 2014.

What is security?

What's the point if we can't achieve perfect security?

What goes wrong #1: Problems with the policy

What goes wrong #2: Problems with threat model / assumptions

What goes wrong #3: problems with the mechanism -- bugs

Case study: buffer overflows

webserver.c:

    int read_req(void) {
        char buf[128];
        int i;
        gets(buf);
        i = atoi(buf);
        return i;
    }

read_req() stack layout:

                     +------------------+
    entry %ebp ----> | .. prev frame .. |
                     |                  |
                     |                  |
                     +------------------+
    entry %esp ----> |  return address  |
                     +------------------+
    new %ebp ------> |    saved %ebp    |
                     +------------------+
                     |     buf[127]     |
                     |       ...        |
                     |      buf[0]      |
                     +------------------+
                     |        i         |
    new %esp ------> +------------------+
                     |       ...        |
                     +------------------+

read_req()'s assembly code:

    push    %ebp
    mov     %esp -> %ebp
    sub     168, %esp        # stack vars, etc
    ...
    mov     %ebp -> %esp
    pop     %ebp
    ret

How to avoid mechanism problems?