How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. How to Use Buffer Overflow Demos (applets)

Slides:



Advertisements
Similar presentations
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
Advertisements

CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Buffer Overflow Intro. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Preventing Buffer Overflows (for C programmers)
Buffer Overflow Causes. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Buffer Overflow Causes Author: Jedidiah.
Algorithms Series of mathematical or variable manipulations Integer a,b,c a = 12 b = 22 c = a * b (what is c?) 12 * 22 = 264.
Software and Software Vulnerabilities. Synopsis Array overflows Stack overflows String problems Pointer clobbering. Dynamic memory management Integer.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
Software Engineering Lifecycle. ©2002. Jan G. Hogle, Susan L. Gerhart. Software Engineering Lifecycle Authors: Jan G. Hogle,
Guide To UNIX Using Linux Third Edition
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
C Programmer Quiz. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Quiz: For C Programmers Author: Jedidiah.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
1 - buttons Click “Step Forward” to execute one line of the program. Click “Reset” to start over. “Play,” “Stop,” and “Step Back” are disabled in this.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
A First Program Using C#
Buffer Overflow Defenses. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Buffer Overflow Defenses Author:
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Introduction to Buffer Overflows Author: Jedidiah R. Crandall, Distributed: 14 July 2002 Embry-Riddle Aeronautical University in Prescott,
Invitation to Computer Science, Java Version, Second Edition.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Buffer Overflow Intro. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Introduction to Buffer Overflows Author:
Overview of Key Security Concepts and Vocabulary This Document was Funded by the National Science Foundation Federal Cyber Service Scholarship For Service.
Embry-Riddle Aeronautical University Prescott, Arizona
Introduction to Computer Systems and the Java Programming Language.
Buffer Overflow Causes Quiz. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Quiz: Buffer Overflow Causes Author:
Buffer Overflow Defenses. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Buffer Overflow Defenses Author:
Buffer Overflow Defenses Quiz. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Quiz: Buffer Overflow Defenses.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Chapter 0 Getting Started. Objectives Understand the basic structure of a C++ program including: – Comments – Preprocessor instructions – Main function.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
Basic Systems and Software. Were we left off Computers are programmable (formal) machines. Digital information is stored as a series of two states (1.
Fall 2002CS 150: Intro. to Computing1 Streams and File I/O (That is, Input/Output) OR How you read data from files and write data to files.
CSC141 Introduction to Computer Programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture - 6.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Intro to Buffer Overflow Quiz. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Quiz: Buffer Overflow Intro Author:
Characters and Strings
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Chapter 1 slides1 What is C? A high-level language that is extremely useful for engineering computations. A computer language that has endured for almost.
Cases Study: Code Red. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Case Study: Code Red Author: Jedidiah.
Bill Tucker Austin Community College COSC 1315
Buffer Overflow Defenses
Development Environment
A variable is a name for a value stored in memory.
Buffer Overflow Defenses
Key Ideas from day 1 slides
Lesson 1 An Introduction
Variables and Primative Types
Variables, Expressions, and IO
Quiz: Buffer Overflow Causes
Format String.
T. Jumana Abu Shmais – AOU - Riyadh
Introduction to Primitive Data types
File I/O in C Lecture 7 Narrator: Lecture 7: File I/O in C.
Introduction to TouchDevelop
Case Study: Code Red Author: Jedidiah R. Crandall,
Buffer Overflow Defenses
Preventing Buffer Overflows (for C programmers)
Introduction to C EECS May 2019.
Understanding and Preventing Buffer Overflow Attacks in Unix
Introduction to Primitive Data types
Presentation transcript:

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. How to Use Buffer Overflow Demos (applets) Author: Jedidiah R. Crandall, This Document was Funded by the National Science Foundation Federal Cyber Service Scholarship For Service Program: Grant No Distributed July 2002 Embry-Riddle Aeronautical University Prescott, Arizona USA

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle.

1 - buttons Click “Step Forward” to execute one line of the program. Click “Reset” to start over. “Play,” “Stop,” and “Step Back” are disabled in this version of the applet.

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. 2 – input text box The input text box is enabled whenever a gets() function is being executed (library functions are not treated as separate subroutines in this applet). When it is enabled you may activate it and give input to the program by typing into the input box. The text box will ignore all non-alphabetic characters (‘1’, ‘?’, ‘~’, etc.) and will covert all lower case characters to upper case before passing the input on to the program.

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. 3 – source code This is the C source code for the program that is being executed. You should understand several things even if you are not a C programmer: 1. PasswordOkay() will call the PasswordOkay() subroutine, 2. gets() reads a string from the user and puts() prints a string, 3. strcmp() compares two strings to see if they are the same, and 4. A statement like char A[5] = “HELLO” will allocate a five byte buffer called A and initialize it to “HELLO”. char Num = ‘R’ allocates one byte called Num and sets it equal to ‘R’.

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. 4 – highlighted line The highlighted line of code is the one currently being executed. This lets you watch the path that the program execution takes.

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. 5 – more source code Notice that the source code for different subroutines is also different colors. Also notice how an if statement looks: if (something is true) do one thing; else do something else;

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. 6 – notes Every line of source code has a note that is shown on the bottom of the screen as it is executed. These notes might be hints or explanations of what is going on.

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle I/O area The Input/Output area is much like the terminal of a DOS or UNIX machine. The program can print things out for you to see and it can ask you to type things in (using the input text box) for it to store. Remember that you have to activate the input text box by clicking on it to give the program any input, and that you can only do this when the input text box is enabled during a gets() statement.

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. 8 – memory There are 256 bytes of memory. Memory is laid out in hexadecimal notation (0x??) from left to right, top to bottom like you would read a book. 0x00 is the the first byte in memory, 0xFF is the last. 0xC9 is the ‘$’. It’s just like looking something up in a table.

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. 9 – code text Code text is the program compiled into a format that the computer can understand. It is just a series of numbers like anything else in memory, except that each number represents a unique computer instruction. Note that a ‘*’ will show the current position of the program counter (how the computer keeps track of where it is) and an ‘X’ will be placed over an instruction to signify that that instruction called another subroutine and will be returned to. The color of the C code for a subroutine is the same as the color of the code text for that subroutine in memory.

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle stack The stack stores return pointers, temporary variables and buffers, and sometimes other things. When something stored on the stack is no longer needed it is destroyed. You can watch the stack be built and destroyed as you execute the program. Notice that a ‘$’ is a return pointer to the subroutine with the same color as the box the ‘$’ is in. A ‘?’ is a canary which only StackGuard uses.

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Glossary Execute – To execute the program means to “run” it. The two terms can be used interchangeably. Source code – this is the code that the programmer writes in a high-level language like Java, BASIC, or, in this case, C. A high-level language is one that humans can easily read and understand. Terminal – A terminal is a combination of a screen and a keyboard where the user of a program can type input into the program and receive output back. Memory – Memory is where the computer stores the code text for a program, the variables, the stack, and everything else that the program needs. Hexadecimal – The decimal system uses a base of 10, where 2863 has a 2 in the 1000’s place, an 8 in the 100’s place, a 6 in the 10’s place, and a 3 in the 1’s place. Hexadecimal uses 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F instead of just 0 through 9, where A = 10, B = 11 … F = 15. The base of hexadecimal is 16, so it has a 1’s place, a 16’s place, a 256’s place, a 4096’s place, etc. 0 through 255 can be represented in hexadecimal as 0x00 through 0xFF. 0x?? is a common convention for distinguishing hexadecimal numbers from decimal numbers. Compiled – A compiler takes the source code a programmer has written and turns it into code text that a computer can easily execute. Code text is a sequence of instructions. Instruction – An instruction tells the computer what to do, but it is very low-level. Unlike source code, it works at the computer level telling the computer what elementary steps to take to execute the program. Program counter – The instructions are stored as a sequence of numbers in the computer just like anything else. The computer usually executes one instruction after another unless it is told to jump somewhere else. The program counter keeps track of what instruction in memory is being executed at any given time. Jump – A jump occurs when the computer is told to start executing instructions somewhere else besides the next instruction after the current one being executed. Canary – A canary is put in memory and if it is overwritten then something is wrong. It is analogous to the canaries used in coal mines to detect poisonous gas.

How to Use BO Demos. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. About this Project This presentation is part of a larger package of materials on buffer overflow vulnerabilities, defenses, and software practices. For more information, go to: Also available are: –Demonstrations of how buffer overflows occur (Java applets) –PowerPoint lecture-style presentations on an introduction to buffer overflows, preventing buffer overflows (for C programmers), and a case study of Code Red –Checklists and Points to Remember for C Programmers –An interactive module and quiz set with alternative paths for journalists/analysts and IT managers as well as programmers and testers –A scavenger hunt on implications of the buffer overflow vulnerability Please complete a feedback form at to tell us how you used this material and to offer suggestions for improvements.