Bits and Bytes September 1, 2005 15-213 F’05 class02.ppt 15-213 “The Class That Gives CMU Its Zip!”

Slides:



Advertisements
Similar presentations
Recitation 4 Outline Buffer overflow –Practical skills for Lab 3 Code optimization –Strength reduction –Common sub-expression –Loop unrolling Reminders.
Advertisements

ByteWeight: Learning to Recognize Functions in Binary Code
Architecture Chapter 2 - Supplement Additional Features In Chapter 2.
Recitation 8 – 3/25/02 Outline Dynamic Linking Review prior test questions 213 Course Staff Office Hours: See Posting.
Lecture 10 – Activation Records Eran Yahav 1 Reference: Dragon 7.1,7.2. MCD 6.3,
Programming Project # 1 cs155 Due: Thursday, April 21 st, 11:59pm Shayan Guha Elizabeth Stinson.
Practical session 7 review. Little – Endian What’s in memory? Section.rodata a: DB ‘hello’, 0x20, ’world’, 10, 0 b: DW ‘hello’, 0x20, ’world’, 10, 0 c:
UBC104 Embedded Systems Variables, Structures & Pointers.
1 Homework Reading –PAL, pp , Machine Projects –Finish mp2warmup Questions? –Start mp2 as soon as possible Labs –Continue labs with your.
UBC104 Embedded Systems Functions & Pointers.
C Prog. To Object Code text text binary binary Code in files p1.c p2.c
Carnegie Mellon 1 This week Buffer Overflow  Vulnerability  Protection.
University of Washington Today Memory layout Buffer overflow, worms, and viruses 1.
Recitation 4: The Stack & Lab3 Andrew Faulring Section A 30 September 2002.
1 Carnegie Mellon Recitation : Introduction to Computer Systems Recitation 15: December 3, 2012 Daniel Sedra Section C.
1 #include void silly(){ char s[30]; gets(s); printf("%s\n",s); } main(){ silly(); return 0; }
Recitation 6 – 2/26/01 Outline Linking Exam Review –Topics Covered –Your Questions Shaheen Gandhi Office Hours: Wednesday.
University of Washington Today Happy Monday! HW2 due, how is Lab 3 going? Today we’ll go over:  Address space layout  Input buffers on the stack  Overflowing.
Recitation 2 – 2/11/02 Outline Stacks & Procedures Homogenous Data –Arrays –Nested Arrays Mengzhi Wang Office Hours: Thursday.
Bits, Bytes, and Integers Topics Representing information as bits Bit-level manipulations Boolean algebra Expressing in C Representations of Integers Basic.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 22: Unconventional.
Overflows & Exploits. In the beginning 11/02/1988 Robert Morris, Jr., a graduate student in Computer Science at Cornell, wrote an experimental, self-replicating,
Part II Let’s make it real Memory Layout of a Process.
Big Endian vs. Little Endian Storage of Numeric Data Noah Mendelsohn Tufts University Web:
Stack-based buffer overflows Yves Younan DistriNet, Department of Computer Science Katholieke Universiteit Leuven Belgium
Info stored in computer (memory) Numbers All in binaray – can be converted to octal, hex Characters ASCII – 1-byte/char Unicode – 2-byte/char Unicode-table.com/en.
Busted !. Why Security Systems Fail Capability List.
1 Understanding Pointers Buffer Overflow. 2 Outline Understanding Pointers Buffer Overflow Suggested reading –Chap 3.10, 3.12.
Stack Usage with MS Visual Studio Without Stack Protection.
Carnegie Mellon 1 Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, Third Edition Machine-Level Programming V: Buffer overflow Slides.
Machine Learning for Program Language Research Yao Peisen Prism Group, HKUST
Introduction to Computer Organization & Systems Topics: Command Line Bitwise operators COMP Spring 2014 C Part V.
The Runtime Environment CSE 340 – Principles of Programming Languages Fall 2015 Adam Doupé Arizona State University
1 Linking. 2 Outline Symbol Resolution Relocation Suggested reading: 7.6~7.7.
CS429 Computer Architecture Topics Simple C program Basic structure, functions, separate files Compilation Phases, options Assembler GNU style, byte ordering,
Recitation 3 Outline Recursive procedure Complex data structures –Arrays –Structs –Unions Function pointer Reminders Lab 2: Wed. 11:59PM Lab 3: start early.
OUTLINE 2 Pre-requisite Bomb! Pre-requisite Bomb! 3.
Recitation 2 – 2/11/02 Outline Stacks & Procedures Homogenous Data –Arrays –Nested Arrays Structured Data –struct s / union s –Arrays of structs.
“Success consists of going from failure to failure without loss of enthusiasm.” Winston Churchill.
Buffer Overflow Buffer overflows are possible because C doesn’t check array boundaries Buffer overflows are dangerous because buffers for user input are.
Machine-Level Programming V: Buffer overflow
Instructor: Fatma CORUT ERGİN
Recitation 3: Procedures and the Stack
The Hardware/Software Interface CSE351 Winter 2013
Machine-Level Programming V: Miscellaneous Topics
Command Line Arguments
Machine-Level Programming V: Miscellaneous Topics
Exploiting & Defense Day 2 Recap
Machine-Level Programming V: Miscellaneous Topics
Recitation 2 – 2/11/02 Outline Stacks & Procedures
143A: Principles of Operating Systems Lecture 8: Basic Architecture of a Program Anton Burtsev October, 2017.
Y86 Processor State Program Registers
Machine-Level Programming 5 Structured Data
Intel’s View of Memory Management
Defeating Instruction Set Randomization Nora Sovarel
C Prog. To Object Code text text binary binary Code in files p1.c p2.c
Bits and Bytes Topics Representing information as bits
Bits and Bytes Topics Representing information as bits
Assembly Language Programming II: C Compiler Calling Sequences
Introduction to Intel x86-64 Assembly, Architecture, Applications, & Alliteration Xeno Kovah –
Machine-Level Programming V: Advanced Topics
Bits and Bytes Topics Representing information as bits
Machine Level Representation of Programs (IV)
Machine-Level Programming: Introduction
Lecture 2 SCOPE – Local and Global variables
X86 Assembly Review.
프로그래밍2 및 실습 Sort Code 전명중.
Instructors: Majd Sakr and Khaled Harras
“The Class That Gives CMU Its Zip!”
“The Class That Gives CMU Its Zip!”
Presentation transcript:

Bits and Bytes September 1, F’05 class02.ppt “The Class That Gives CMU Its Zip!”

– 2 – , F’05 C Program #include char *buf[2] = {"Hello", "Goodbye"}; int main() { int i = random() & 1; printf("%s World!\n", buf[i]); return 0; }

– 3 – , F’05 Object Code (Window/Cygwin) : :55 push %ebp :b mov $0x10,%eax :89 e5 mov %esp,%ebp :83 ec 08 sub $0x8,%esp 40105b:83 e4 f0 and $0xfffffff0,%esp 40105e:e8 2d call :e8 b call :e8 d call d:c e movl $0x40300e,(%esp) :83 e0 01 and $0x1,%eax :8b mov 0x402000(,%eax,4),%eax 40107e: mov %eax,0x4(%esp) :e8 a call :c9 leave :31 c0 xor %eax,%eax 40108a:c3 ret

– 4 – , F’05 Object Code (Linux/IA32) b0 : 80483b0:55 push %ebp 80483b1:89 e5 mov %esp,%ebp 80483b3:83 ec 08 sub $0x8,%esp 80483b6:83 e4 f0 and $0xfffffff0,%esp 80483b9:83 ec 10 sub $0x10,%esp 80483bc:e8 07 ff ff ff call 80482c c1:83 e0 01 and $0x1,%eax 80483c4:c da movl $0x80484da,(%esp) 80483cb:8b f mov 0x80495f0(,%eax,4),%eax 80483d2: mov %eax,0x4(%esp) 80483d6:e8 0d ff ff ff call 80482e db:c9 leave 80483dc:31 c0 xor %eax,%eax 80483de:c3 ret

– 5 – , F’05 Object Code (Linux/x86-64) : :48 83 ec 08 sub $0x8,%rsp :e8 17 ff ff ff callq :83 e0 01 and $0x1,%eax 40050c:bf 2a mov $0x40062a,%edi :48 98 cltq :48 8b 34 c mov 0x500910(,%rax,8),%rsi 40051a: b:31 c0 xor %eax,%eax 40051d:e8 0e ff ff ff callq :31 c0 xor %eax,%eax :48 83 c4 08 add $0x8,%rsp :c3 retq

– 6 – , F’05 Examining Data Representations typedef unsigned char *pointer; void show_bytes(pointer start, int len) { int i; for (i = 0; i < len; i++) printf("%.2x ", start[i]); printf("\n"); } int main(int argc, char *argv[]) { int i; for (i = 1; i < argc; i++) { long int v = strtol(argv[i], NULL, 0); show_bytes((pointer) &v, sizeof(long)); } return 0; }