Overview

In this reading you will be introduced to the concept of buffer overflow, which is commonly used by hackers to hijack control of a computer. In addition to learning about how buffer overflows work, you will learn about some mechanisms used for avoiding them.

Note that the term “buffer” is generally used as a synonym for an array, so buffer overflow can be thought of as “array overflow.”

Required Reading

Sections 3.10.3 to 3.10.4 (pp. 279-290) from the course textbook.

Learning Objectives

BASIC Learning Objectives

Each student will be responsible for learning and demonstrating proficiency in the following objectives PRIOR to the class meeting. The reading quiz will test these objectives.

  1. Describe how use of the gets function can lead to buggy, insecure code.
  2. Describe how buffer overflow can lead to execution of an unexpected code that is either part of the program or arbitrary code entered by an attacker.
  3. Describe the utility of stack randomization.
  4. Describe how canary values can be used to thwart buffer overflows.
  5. Describe the role of the NX bit on modern processors.

ADVANCED Learning Objectives

The following objectives should be mastered by each student DURING and FOLLOWING the class session through active work and practice.

  1. Given x86-64 code for a function that calls gets, list how many bytes of data would need to be entered to corrupt a specific location on the stack.

Pre-class Exercises

These exercises are geared towards mastering the BASIC learning objectives listed above. You are expected to submit them before class and it is highly recommended that you complete them before attempting the reading quiz.

  1. Part A: Why is use of the gets function dangerous?

    Part B: What alternative do we have to using gets? How does this alternative overcome the limitations of gets?

  2. In your own words, how does a canary value help solve the problem of buffer overflow?