01-26-2010-answers - CS 161 Computer Security Spring 2010...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 161 Computer Security Spring 2010 Paxson/Wagner Answers 1 January 26, 2010 1. Compiler defense There is a technique for defending against stack smashing attacks called canaries. Similar to a canary in a coal mine, a canary in this context is a variable that will indicate whether or not a stack smashing attack has occurred. This technique is used by a compiler, not by a programmer. The idea is that the compiler inserts some additional code inside of each function to detect when a stack smashing attack has occurred, and then, during runtime, this code halts execution if an attack has been detected. How might this work? Hint: Think about which parts of memory get overwritten during a buffer overflow. Drawing a diagram of the stack may help. Answer: The compiler sets a global number randomly before each run. This number is the magic canary number. Take this function: void vuln() { char buf[n]; gets(buf); } The compiler will take this function and generate: static const int MAGIC = 7; // This number is randomly set before each run. void vuln() { char buf[n]; int canary = MAGIC; gets(buf); if (canary != MAGIC) HALT(); } StackGuard is an example of a real program that uses this exact defense....
View Full Document

This note was uploaded on 04/14/2010 for the course CS 161 taught by Professor Wagner during the Spring '10 term at University of Central Arkansas.

Page1 / 3

01-26-2010-answers - CS 161 Computer Security Spring 2010...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online