Buffer Overflow Attack

Size: px
Start display at page:

Download "Buffer Overflow Attack"

Transcription

1 Buffer Overflow Attack What every applicant for the hacker should know about the foundation of buffer overflow attacks By

2 Abstract Buffer overflow. buffer overflow. buffer overflow.. buffer overflow. buffer overflow. Buffer overflow,,. IA32 (32-bit Intel Architecture), buffer overflow. overflow. return address,, Return into libc buffer overflow.

3 Contents Memory Architecture CPU Segment? simple.c step step step step step step step step Buffer overflow byte order shell code buffer overlow Return into Libc

4 1. Buffer Overflow. Buffer overflow.. Buffer overflow. Buffer overflow Memory Architecture High address Available Space Kernel Low address

5 < 2> (multi-tasking). segment. segment. segment < 2>. code segment, data segment, stack segment. 16,383 segment. segment 2 32 byte. code segment instruction.. instruction,. segment.

6 segment logical address. Logical address (physical address). segment segment selector (offset) (logical address). physical address offset + logical address. < 3> segment 0x code segment instruction IS 1 0x logical address instruction segment offset 0x segment 0x x segment segment selector segment offset instruction. data segment.. data segment. data segment data segment data structure,,,. stack segment handler, task, program stack segment. multiple switch..

7 stack pointer(sp). PUSH POP instruction... (PUSH). (PUSH).. (POP). PUSH POP CPU segment. CPU CPU. (Instruction set). CPU CPU. (register). < 4>. (General-Purpose register), (segment register), (Program status and control register), (instruction pointer).,,,. code segment, data segment, stack segment.. (instruction).

8 < 4. > < 5. >. 4 32bit. 16bit AX, BX, CX, DX.. 32bit E(Extended) EAX, EBX, ECX, EDX... AX AH AL. EAX, EBX, ECX, EDX

9 ... EAX EBX DS segment ECX EDX I/O ESI DS data segment. source. EDI ES data segment. destination. ESP SS stack segment EBP SS < 6. > < 6>. CS code segment, DS, ES, FS, GS data segment, SS stack segment. segment,. < 7>.

10 < 7. >,,. 0x , 3, 5, 15, 22~31. < 8>. < 8. >

11 . Status flags CF carry flag. carry borrow 1. Carry borrow bit bound. PF Parity flag AF Adjust flag. carry borrow 3bit 1. ZF Zero flag. zero. If set. SF Sign flag.. Signed 0, 1. OF Overflow flag. 1. DF Direction flag. 1 instruction ( high address low address ), 0. System flags IF Interrupt enable flag. mask interrupt 1. TF Trap flag. single-step 1. IOPL I/O privilege level field. task. CPL I/O address I/O privilege level. NT Nested task flag. Interrupt chain. 1 task task. RF Resume flag. Exception debug. VM Virtual-8086 mode flag. Virtual AC Alignment check flag. CR0 AM set alignment checking. VIF Virtual interrupt flag. IF flag. VIP flag. VIP Virtual interrupt pending flag. pending( ). ID Identification flag. CPUID instruction CPU. Instruction Pointer Instruction pointer code segment offset

12 .. JMP, Jcc, CALL, RET IRET instruction. EIP control-transfer instruction (JMP, Jcc, CALL, RET) interrupt exception. EIP CALL instruction (procedure stack) instruction address. return instruction pointer return instruction(ret, IRET) EIP CPU. buffer overflow padding return address assembly OK. buffer. 4. Segment?.. void function(int a, int b, int c){ char buffer1[15]; char buffer2[10]; } void main(){ } function(1, 2, 3); < 9. simple.c>.. < 9> C. $gcc S o simple.asm simple.c

13 -S..,... simple.asm.. bof]$ cat simple.asm.file "simple.c".text.globl function.type function: pushl %ebp movl %esp, %ebp subl $40, %esp leave ret.lfe1:.size function,.lfe1-function.globl main.type main: pushl %ebp movl %esp, %ebp subl $8, %esp andl $-16, %esp movl $0, %eax subl %eax, %esp subl $4, %esp pushl $3 pushl $2 pushl $1 call function addl $16, %esp leave

14 ret.lfe2:.size main,.lfe2-main.ident "GCC: (GNU) (Hancom Linux 3.2.3)" bof]$ < 10. gcc simple.asm> 3.0. gcc. gcc Red Hat Fedora core 3 gcc [dalgona@testbed bof]$ cat simple.asm.file "simple.c".text.globl function.type pushl %ebp movl %esp, %ebp subl $40, %esp leave ret.size tion,.-tion.globl main.type main: pushl %ebp movl %esp, %ebp subl $8, %esp andl $-16, %esp movl $0, %eax addl $15, %eax addl $15, %eax shrl $4, %eax sall $4, %eax subl %eax, %esp subl $4, %esp

15 pushl $3 pushl $2 pushl $1 call function addl $16, %esp leave ret.size "GCC: (GNU) (Red Hat fc3)" bof]$ < 11. gcc simple.asm>. gcc < 10>. gcc simple.c gdb logical address. bof]$ gcc -o simple simple.c simple.c: In function `main': simple.c:6: warning: return type of `main' is not `int' bof]$ gdb simple GNU gdb Red Hat Linux ( ) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... (gdb) disas main Dump of assembler code for function main: 0x80482fc <main>: push %ebp 0x80482fd <main+1>: mov %esp,%ebp

16 0x80482ff <main+3>: sub $0x8,%esp 0x <main+6>: and $0xfffffff0,%esp 0x <main+9>: mov $0x0,%eax 0x804830a <main+14>: sub %eax,%esp 0x804830c <main+16>: sub $0x4,%esp 0x804830f <main+19>: push $0x3 0x <main+21>: push $0x2 0x <main+23>: push $0x1 0x <main+25>: call 0x80482f4 <function> 0x804831a <main+30>: add $0x10,%esp 0x804831d <main+33>: leave 0x804831e <main+34>: ret 0x804831f <main+35>: nop End of assembler dump. (gdb) disas function Dump of assembler code for function function: 0x80482f4 <function>: push %ebp 0x80482f5 <function+1>: mov %esp,%ebp 0x80482f7 <function+3>: sub $0x28,%esp 0x80482fa <function+6>: leave 0x80482fb <function+7>: ret End of assembler dump. (gdb) < 12. gcc gdb disassemble >. logical address. function() main(). segment < 13>. < 13> segment. segment.. segment logical address 0x stack segment 0xBFFFFFFF. simple.c

17 data segment. EIP, CPU main(). main() 0x80482fc.. ESP gdb. (gdb) break *0x80482fc Breakpoint 1 at 0x80482fc (gdb) r Starting program: /home/dalgona/work/bof/simple Breakpoint 1, 0x080482fc in main () (gdb) info register esp esp 0xbffffa7c 0xbffffa7c

18 Stack Segment, argc, argv pointer 0xBFFFFFFF Data Segment Code Segment 0x804831f <main+35>: nop 0x804831e <main+34>: ret 0x804831d <main+33>: leave 0x804831a <main+30>: add $0x10,%esp 0x <main+25>: call 0x80482f4 0x <main+23>: push $0x1 0x <main+21>: push $0x2 0x804830f <main+19>: push $0x3 0x804830c <main+16>: sub $0x4,%esp 0x804830a <main+14>: sub %eax,%esp 0x <main+9>: mov $0x0,%eax 0x <main+6>: and $0xfffffff0,%esp 0x80482ff <main+3>: sub $0x8,%esp 0x80482fd <main+1>: mov %esp,%ebp 0x80482fc <main>: push %ebp 0x80482fb <function+7>: ret 0x80482fa <function+6>: leave 0x80482f7 <function+3>: sub $0x28,%esp 0x80482f5 <function+1>: mov %esp,%ebp 0x80482f4 <function>: push %ebp < 13. simple.c segment > 0x

19 <Step 1> 0x804831f <main+35>: nop 0x804831e <main+34>: ret 0x804831d <main+33>: leave 0x804831a <main+30>: add $0x10,%esp 0x <main+25>: call 0x80482f4 0x <main+23>: push $0x1 0x <main+21>: push $0x2 0x804830f <main+19>: push $0x3 0x804830c <main+16>: sub $0x4,%esp 0x804830a <main+14>: sub %eax,%esp 0x <main+9>: mov $0x0,%eax 0x <main+6>: and $0xfffffff0,%esp 0x80482ff <main+3>: sub $0x8,%esp 0x80482fd <main+1>: mov %esp,%ebp 0x80482fc <main>: push %ebp 0x80482fb <function+7>: ret 0x80482fa <function+6>: leave 0x80482f7 <function+3>: sub $0x28,%esp 0x80482f5 <function+1>: mov %esp,%ebp 0x80482f4 <function>: push %ebp ESP 0xbffffa7c.. EIP main(). ESP. ESP PUSH POP PUSH, POP. PUSH ESP ESP system architecture. POP ESP ESP ebp. base pointer. stack pointer base pointer. EIP

20 <Step 2> base pointer EBP ESP 0xbffffa78 push %ebp base pointer stack pointer 4 0xbffffa78. 0x804831f <main+35>: nop 0x804831e <main+34>: ret 0x804831d <main+33>: leave 0x804831a <main+30>: add $0x10,%esp 0x <main+25>: call 0x80482f4 0x <main+23>: push $0x1 0x <main+21>: push $0x2 0x804830f <main+19>: push $0x3 0x804830c <main+16>: sub $0x4,%esp 0x804830a <main+14>: sub %eax,%esp 0x <main+9>: mov $0x0,%eax 0x <main+6>: and $0xfffffff0,%esp 0x80482ff <main+3>: sub $0x8,%esp 0x80482fd <main+1>: mov %esp,%ebp 0x80482fc <main>: push %ebp 0x80482fb <function+7>: ret 0x80482fa <function+6>: leave 0x80482f7 <function+3>: sub $0x28,%esp 0x80482f5 <function+1>: mov %esp,%ebp 0x80482f4 <function>: push %ebp 0xbffffa70.. EIP mov %esp, %ebp ESP EBP. base pointer stack pointer. sub $0x8, %esp ESP 8. ESP ESP and $0xfffffff0, %esp ESP AND. ESP 4bit 0.. mov $0x0, %eax EAX 0 sub %eax, %esp ESP EAX. stack pointer EAX

21 0. sub $0x4, %esp 4. ESP 0xbffffa6c.

22 <Step 3> base pointer EBP 0xbffffa78 ESP 0xbffffa6c. ESP 12. 0x804831f <main+35>: nop 0x804831e <main+34>: ret 0x804831d <main+33>: leave 0x804831a <main+30>: add $0x10,%esp 0x <main+25>: call 0x80482f4 0x <main+23>: push $0x1 0x <main+21>: push $0x2 0x804830f <main+19>: push $0x3 0x804830c <main+16>: sub $0x4,%esp 0x804830a <main+14>: sub %eax,%esp 0x <main+9>: mov $0x0,%eax 0x <main+6>: and $0xfffffff0,%esp 0x80482ff <main+3>: sub $0x8,%esp 0x80482fd <main+1>: mov %esp,%ebp 0x80482fc <main>: push %ebp 0x80482fb <function+7>: ret 0x80482fa <function+6>: leave 0x80482f7 <function+3>: sub $0x28,%esp 0x80482f5 <function+1>: mov %esp,%ebp 0x80482f4 <function>: push %ebp EIP push $0x03 push $0x02 push $0x01. function(1, 2, 3) 1, 2, 3. 3, 2, 1. < 13> argc, argv function(). call 0x80482f4 0x80482f4. 0x80482f4 function. call EIP. add $0x10, %esp. POP. buffer overflow return address. EIP function 0x80482f4.

23 <Step 4> base pointer x804831a EBP 0xbffffa78 ESP 0xbffffa5c EIP function() main(). 0x804831f <main+35>: nop 0x804831e <main+34>: ret 0x804831d <main+33>: leave 0x804831a <main+30>: add $0x10,%esp 0x <main+25>: call 0x80482f4 0x <main+23>: push $0x1 0x <main+21>: push $0x2 0x804830f <main+19>: push $0x3 0x804830c <main+16>: sub $0x4,%esp 0x804830a <main+14>: sub %eax,%esp 0x <main+9>: mov $0x0,%eax 0x <main+6>: and $0xfffffff0,%esp 0x80482ff <main+3>: sub $0x8,%esp 0x80482fd <main+1>: mov %esp,%ebp 0x80482fc <main>: push %ebp 0x80482fb <function+7>: ret 0x80482fa <function+6>: leave 0x80482f7 <function+3>: sub $0x28,%esp 0x80482f5 <function+1>: mov %esp,%ebp 0x80482f4 <function>: push %ebp EIP push %ebp mov %esp, %ebp function(). main() base pointer stack pointer function() base pointer.

24 <Step 5> base pointer function() 0x804831f <main+35>: nop 0x804831e <main+34>: ret 0x804831d <main+33>: leave 0x804831a <main+30>: add $0x10,%esp 0x <main+25>: call 0x80482f4 0x <main+23>: push $0x1 0x <main+21>: push $0x2 0x804830f <main+19>: push $0x3 0x804830c <main+16>: sub $0x4,%esp 0x804830a <main+14>: sub %eax,%esp 0x <main+9>: mov $0x0,%eax 0x <main+6>: and $0xfffffff0,%esp 0x80482ff <main+3>: sub $0x8,%esp 0x80482fd <main+1>: mov %esp,%ebp 0x80482fc <main>: push %ebp 0x80482fb <function+7>: ret 0x80482fa <function+6>: leave 0x80482f7 <function+3>: sub $0x28,%esp 0x80482f5 <function+1>: mov %esp,%ebp 0x80482f4 <function>: push %ebp sub $0x28, %esp simple.c function() buffer1[15] buffer2[10] buffer1[15] 15 word (4byte) 16 buffer2[10] gcc. gcc 2.96 word 28 gcc word 9 4 word. 8 dummy.. buffer1[15] 16 buffer2[10] dummy dummy x804831a 0xbffffa78 EBP ESP 0xbffffa58 EIP function function() base pointer return address. < 13> main argc, argv.? < 13>?

25 <Step 6> base pointer x804831a 0xbffffa78 0x804831f <main+35>: nop 0x804831e <main+34>: ret 0x804831d <main+33>: leave 0x804831a <main+30>: add $0x10,%esp 0x <main+25>: call 0x80482f4 0x <main+23>: push $0x1 0x <main+21>: push $0x2 0x804830f <main+19>: push $0x3 0x804830c <main+16>: sub $0x4,%esp 0x804830a <main+14>: sub %eax,%esp 0x <main+9>: mov $0x0,%eax 0x <main+6>: and $0xfffffff0,%esp 0x80482ff <main+3>: sub $0x8,%esp 0x80482fd <main+1>: mov %esp,%ebp 0x80482fc <main>: push %ebp 0x80482fb <function+7>: ret 0x80482fa <function+6>: leave 0x80482f7 <function+3>: sub $0x28,%esp 0x80482f5 <function+1>: mov %esp,%ebp 0x80482f4 <function>: push %ebp EBP 0xbffffa58 ESP 0xbffffa30 EIP. mov $0x41, [$esp -4] mov $0x42, [$esp-8] ESP. simple.c.. < 14>.

26 <Step 7> base pointer x804831a EBP 0xbffffa78 ESP 0xbffffa5c leave instruction. leave instruction. push %ebp mov %esp, %ebp. 0x804831f <main+35>: nop 0x804831e <main+34>: ret 0x804831d <main+33>: leave 0x804831a <main+30>: add $0x10,%esp 0x <main+25>: call 0x80482f4 0x <main+23>: push $0x1 0x <main+21>: push $0x2 0x804830f <main+19>: push $0x3 0x804830c <main+16>: sub $0x4,%esp 0x804830a <main+14>: sub %eax,%esp 0x <main+9>: mov $0x0,%eax 0x <main+6>: and $0xfffffff0,%esp 0x80482ff <main+3>: sub $0x8,%esp 0x80482fd <main+1>: mov %esp,%ebp 0x80482fc <main>: push %ebp 0x80482fb <function+7>: ret 0x80482fa <function+6>: leave 0x80482f7 <function+3>: sub $0x28,%esp 0x80482f5 <function+1>: mov %esp,%ebp 0x80482f4 <function>: push %ebp EIP mov %ebp, %esp pop %ebp. leave instruction. stack pointer base pointer function() PUSH, main() base pointer. POP stack pointer 1 word. stack pointer return address. ret instruction return. EIP return address POP. pop %eip EIP.

27 <Step 8> base pointer EBP 0xbffffa78 ESP 0xbffffa60 ret return address POP EIP stack pointer 1 word. 0x804831f <main+35>: nop 0x804831e <main+34>: ret 0x804831d <main+33>: leave 0x804831a <main+30>: add $0x10,%esp 0x <main+25>: call 0x80482f4 0x <main+23>: push $0x1 0x <main+21>: push $0x2 0x804830f <main+19>: push $0x3 0x804830c <main+16>: sub $0x4,%esp 0x804830a <main+14>: sub %eax,%esp 0x <main+9>: mov $0x0,%eax 0x <main+6>: and $0xfffffff0,%esp 0x80482ff <main+3>: sub $0x8,%esp 0x80482fd <main+1>: mov %esp,%ebp 0x80482fc <main>: push %ebp 0x80482fb <function+7>: ret 0x80482fa <function+6>: leave 0x80482f7 <function+3>: sub $0x28,%esp 0x80482f5 <function+1>: mov %esp,%ebp 0x80482f4 <function>: push %ebp. EIP add $0x10, %esp 16. stack pointer 0x804830c. leave ret main() main(). init_process().

28 5. Buffer overflow (buffer).... malloc() (free() ). buffer overflow. buffer overflow buffer overflow. < 14> ~44? base pointer. 45~48 return address 48 return address. return address. return address base pointer. base pointer EIP. buffer overflow return address EIP.,. return address return address. < 14> simple.c. function() buffer1[15] buffer2[10] 40. function().. strcpy(buffer2, receive_from_client);

29 client buffer2 buffer1. strncpy() strcpy receive_from_client NULL(\0). < 14> 45~48 return address. < 15> ( ). receive_from_client. < 15>. strcpy receive_from_client buffer2 < 14> < 15>.

30 base pointer main() base pointer stack (12 byte) x804831a 0xbffffa78 function() main() return address main() base pointer stack (40 byte) ESP (40byte) main() base pointer return address (24byte) E6B0C03 59FFE374 AC357D61 C0E39BCA CEA631F7 C9AD10CC6A2 < 16. > strcpy < 17>.

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63 , argc, argv ebp,esp : 0xbffffa88 EGG 0xbffffa85 argc, argv ebp,esp : 0xbffff288

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

Basic Execution Environment

Basic Execution Environment Basic Execution Environment 3 CHAPTER 3 BASIC EXECUTION ENVIRONMENT This chapter describes the basic execution environment of an Intel Architecture processor as seen by assembly-language programmers.

More information

Binghamton University. CS-220 Spring X86 Debug. Computer Systems Section 3.11

Binghamton University. CS-220 Spring X86 Debug. Computer Systems Section 3.11 X86 Debug Computer Systems Section 3.11 GDB is a Source Level debugger We have learned how to debug at the C level Now, C has been translated to X86 assembler! How does GDB play the shell game? Makes it

More information

Simple C Program. Assembly Ouput. Using GCC to produce Assembly. Assembly produced by GCC is easy to recognize:

Simple C Program. Assembly Ouput. Using GCC to produce Assembly. Assembly produced by GCC is easy to recognize: Simple C Program Helloworld.c Programming and Debugging Assembly under Linux slides by Alexandre Denault int main(int argc, char *argv[]) { } printf("hello World"); Programming and Debugging Assembly under

More information

Machine-level Representation of Programs. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Machine-level Representation of Programs. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Machine-level Representation of Programs Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Program? 짬뽕라면 준비시간 :10 분, 조리시간 :10 분 재료라면 1개, 스프 1봉지, 오징어

More information

Assembler Programming. Lecture 2

Assembler Programming. Lecture 2 Assembler Programming Lecture 2 Lecture 2 8086 family architecture. From 8086 to Pentium4. Registers, flags, memory organization. Logical, physical, effective address. Addressing modes. Processor Processor

More information

The Microprocessor and its Architecture

The Microprocessor and its Architecture The Microprocessor and its Architecture Contents Internal architecture of the Microprocessor: The programmer s model, i.e. The registers model The processor model (organization) Real mode memory addressing

More information

x86 assembly CS449 Fall 2017

x86 assembly CS449 Fall 2017 x86 assembly CS449 Fall 2017 x86 is a CISC CISC (Complex Instruction Set Computer) e.g. x86 Hundreds of (complex) instructions Only a handful of registers RISC (Reduced Instruction Set Computer) e.g. MIPS

More information

Lab 10: Introduction to x86 Assembly

Lab 10: Introduction to x86 Assembly CS342 Computer Security Handout # 8 Prof. Lyn Turbak Wednesday, Nov. 07, 2012 Wellesley College Revised Nov. 09, 2012 Lab 10: Introduction to x86 Assembly Revisions: Nov. 9 The sos O3.s file on p. 10 was

More information

CS241 Computer Organization Spring 2015 IA

CS241 Computer Organization Spring 2015 IA CS241 Computer Organization Spring 2015 IA-32 2-10 2015 Outline! Review HW#3 and Quiz#1! More on Assembly (IA32) move instruction (mov) memory address computation arithmetic & logic instructions (add,

More information

Introduction to IA-32. Jo, Heeseung

Introduction to IA-32. Jo, Heeseung Introduction to IA-32 Jo, Heeseung IA-32 Processors Evolutionary design Starting in 1978 with 8086 Added more features as time goes on Still support old features, although obsolete Totally dominate computer

More information

INTRODUCTION TO IA-32. Jo, Heeseung

INTRODUCTION TO IA-32. Jo, Heeseung INTRODUCTION TO IA-32 Jo, Heeseung IA-32 PROCESSORS Evolutionary design Starting in 1978 with 8086 Added more features as time goes on Still support old features, although obsolete Totally dominate computer

More information

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM EXPERIMENT WRITE UP AIM: Assembly language program for 16 bit BCD addition LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM TOOLS/SOFTWARE

More information

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model SYSC3601 Microprocessor Systems Unit 2: The Intel 8086 Architecture and Programming Model Topics/Reading SYSC3601 2 Microprocessor Systems 1. Registers and internal architecture (Ch 2) 2. Address generation

More information

Complex Instruction Set Computer (CISC)

Complex Instruction Set Computer (CISC) Introduction ti to IA-32 IA-32 Processors Evolutionary design Starting in 1978 with 886 Added more features as time goes on Still support old features, although obsolete Totally dominate computer market

More information

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1 Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD 21252 rkarne@towson.edu 11/12/2014 Slide 1 Intel x86 Aseembly Language Assembly Language Assembly Language

More information

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017 CS 31: Intro to Systems ISAs and Assembly Martin Gagné Swarthmore College February 7, 2017 ANNOUNCEMENT All labs will meet in SCI 252 (the robot lab) tomorrow. Overview How to directly interact with hardware

More information

buffer overflow exploitation

buffer overflow exploitation buffer overflow exploitation Samuele Andreoli, Nicolò Fornari, Giuseppe Vitto May 11, 2016 University of Trento Introduction 1 introduction A Buffer Overflow is an anomaly where a program, while writing

More information

CMSC 313 Lecture 12. Project 3 Questions. How C functions pass parameters. UMBC, CMSC313, Richard Chang

CMSC 313 Lecture 12. Project 3 Questions. How C functions pass parameters. UMBC, CMSC313, Richard Chang Project 3 Questions CMSC 313 Lecture 12 How C functions pass parameters UMBC, CMSC313, Richard Chang Last Time Stack Instructions: PUSH, POP PUSH adds an item to the top of the stack POP

More information

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II) MICROPROCESSOR UOP S.E.COMP (SEM-II) 80386 MICROPROCESSOR ARCHITECTURE Prof. P. C. Patil Department of Computer Engg Sandip Institute of Engineering & Management Nashik pc.patil@siem.org.in 1 Introduction

More information

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86 Lecture 15 Intel Manual, Vol. 1, Chapter 3 Hampden-Sydney College Fri, Mar 6, 2009 Outline 1 2 Overview See the reference IA-32 Intel Software Developer s Manual Volume 1: Basic, Chapter 3. Instructions

More information

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Introduction This chapter presents the microprocessor

More information

Machine Programming 1: Introduction

Machine Programming 1: Introduction Machine Programming 1: Introduction CS61, Lecture 3 Prof. Stephen Chong September 8, 2011 Announcements (1/2) Assignment 1 due Tuesday Please fill in survey by 5pm today! Assignment 2 will be released

More information

Chapter 2: The Microprocessor and its Architecture

Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Introduction This chapter presents the microprocessor

More information

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee ١ INTERNAL MICROPROCESSOR ARCHITECTURE Before a program is written or instruction investigated, internal configuration of the

More information

x86 assembly CS449 Spring 2016

x86 assembly CS449 Spring 2016 x86 assembly CS449 Spring 2016 CISC vs. RISC CISC [Complex instruction set Computing] - larger, more feature-rich instruction set (more operations, addressing modes, etc.). slower clock speeds. fewer general

More information

x86 Assembly Tutorial COS 318: Fall 2017

x86 Assembly Tutorial COS 318: Fall 2017 x86 Assembly Tutorial COS 318: Fall 2017 Project 1 Schedule Design Review: Monday 9/25 Sign up for 10-min slot from 3:00pm to 7:00pm Complete set up and answer posted questions (Official) Precept: Monday

More information

Function Calls COS 217. Reading: Chapter 4 of Programming From the Ground Up (available online from the course Web site)

Function Calls COS 217. Reading: Chapter 4 of Programming From the Ground Up (available online from the course Web site) Function Calls COS 217 Reading: Chapter 4 of Programming From the Ground Up (available online from the course Web site) 1 Goals of Today s Lecture Finishing introduction to assembly language o EFLAGS register

More information

Turning C into Object Code Code in files p1.c p2.c Compile with command: gcc -O p1.c p2.c -o p Use optimizations (-O) Put resulting binary in file p

Turning C into Object Code Code in files p1.c p2.c Compile with command: gcc -O p1.c p2.c -o p Use optimizations (-O) Put resulting binary in file p Turning C into Object Code Code in files p1.c p2.c Compile with command: gcc -O p1.c p2.c -o p Use optimizations (-O) Put resulting binary in file p text C program (p1.c p2.c) Compiler (gcc -S) text Asm

More information

Lab 3. The Art of Assembly Language (II)

Lab 3. The Art of Assembly Language (II) Lab. The Art of Assembly Language (II) Dan Bruce, David Clark and Héctor D. Menéndez Department of Computer Science University College London October 2, 2017 License Creative Commons Share Alike Modified

More information

Assembly Programmer s View Lecture 4A Machine-Level Programming I: Introduction

Assembly Programmer s View Lecture 4A Machine-Level Programming I: Introduction Assembly Programmer s View Lecture 4A Machine-Level Programming I: Introduction E I P CPU isters Condition Codes Addresses Data Instructions Memory Object Code Program Data OS Data Topics Assembly Programmer

More information

The Instruction Set. Chapter 5

The Instruction Set. Chapter 5 The Instruction Set Architecture Level(ISA) Chapter 5 1 ISA Level The ISA level l is the interface between the compilers and the hardware. (ISA level code is what a compiler outputs) 2 Memory Models An

More information

The x86 Architecture

The x86 Architecture The x86 Architecture Lecture 24 Intel Manual, Vol. 1, Chapter 3 Robb T. Koether Hampden-Sydney College Fri, Mar 20, 2015 Robb T. Koether (Hampden-Sydney College) The x86 Architecture Fri, Mar 20, 2015

More information

Binghamton University. CS-220 Spring X86 Debug. Computer Systems Section 3.11

Binghamton University. CS-220 Spring X86 Debug. Computer Systems Section 3.11 X86 Debug Computer Systems Section 3.11 GDB is a Source Level debugger We have learned how to debug at the C level But the machine is executing X86 object code! How does GDB play the shell game? Makes

More information

Introduction Selected details Live demos. HrwCC. A self-compiling C-compiler. Stefan Huber Christian Rathgeb Stefan Walkner

Introduction Selected details Live demos. HrwCC. A self-compiling C-compiler. Stefan Huber Christian Rathgeb Stefan Walkner HrwCC A self-compiling C-compiler. Stefan Huber Christian Rathgeb Stefan Walkner Universität Salzburg VP Compiler Construction June 26, 2007 Overview 1 Introduction Basic properties Features 2 Selected

More information

Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998

Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998 Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998 Assembler Syntax Everything looks like this: label: instruction dest,src instruction label Comments: comment $ This is a comment

More information

Process Layout, Function Calls, and the Heap

Process Layout, Function Calls, and the Heap Process Layout, Function Calls, and the Heap CS 6 Spring 20 Prof. Vern Paxson TAs: Devdatta Akhawe, Mobin Javed, Matthias Vallentin January 9, 20 / 5 2 / 5 Outline Process Layout Function Calls The Heap

More information

CNIT 127: Exploit Development. Ch 2: Stack Overflows in Linux

CNIT 127: Exploit Development. Ch 2: Stack Overflows in Linux CNIT 127: Exploit Development Ch 2: Stack Overflows in Linux Stack-based Buffer Overflows Most popular and best understood exploitation method Aleph One's "Smashing the Stack for Fun and Profit" (1996)

More information

CSC 591 Systems Attacks and Defenses Return-into-libc & ROP

CSC 591 Systems Attacks and Defenses Return-into-libc & ROP CSC 591 Systems Attacks and Defenses Return-into-libc & ROP Alexandros Kapravelos akaprav@ncsu.edu NOEXEC (W^X) 0xFFFFFF Stack Heap BSS Data 0x000000 Code RW RX Deployment Linux (via PaX patches) OpenBSD

More information

Homework. In-line Assembly Code Machine Language Program Efficiency Tricks Reading PAL, pp 3-6, Practice Exam 1

Homework. In-line Assembly Code Machine Language Program Efficiency Tricks Reading PAL, pp 3-6, Practice Exam 1 Homework In-line Assembly Code Machine Language Program Efficiency Tricks Reading PAL, pp 3-6, 361-367 Practice Exam 1 1 In-line Assembly Code The gcc compiler allows you to put assembly instructions in-line

More information

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016 CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College February 9, 2016 Reading Quiz Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between

More information

EEM336 Microprocessors I. The Microprocessor and Its Architecture

EEM336 Microprocessors I. The Microprocessor and Its Architecture EEM336 Microprocessors I The Microprocessor and Its Architecture Introduction This chapter presents the microprocessor as a programmable device by first looking at its internal programming model and then

More information

administrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions?

administrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions? administrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions? exam on Wednesday today s material not on the exam 1 Assembly Assembly is programming

More information

Practical Malware Analysis

Practical Malware Analysis Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the

More information

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018 CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College September 25, 2018 Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between programmer

More information

x86 architecture et similia

x86 architecture et similia x86 architecture et similia 1 FREELY INSPIRED FROM CLASS 6.828, MIT A full PC has: PC architecture 2 an x86 CPU with registers, execution unit, and memory management CPU chip pins include address and data

More information

War Industries Presents: An Introduction to Programming for Hackers Part V - Functions. By Lovepump, Visit:

War Industries Presents: An Introduction to Programming for Hackers Part V - Functions. By Lovepump, Visit: War Industries Presents: An Introduction to Programming for Hackers Part V - Functions By Lovepump, 2004 Visit: www.warindustries.com Goals: At the end of Part IV, you should be able to competently code

More information

CS , Fall 2004 Exam 1

CS , Fall 2004 Exam 1 Andrew login ID: Full Name: CS 15-213, Fall 2004 Exam 1 Tuesday October 12, 2004 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front.

More information

Assembly Language: Function Calls

Assembly Language: Function Calls Assembly Language: Function Calls 1 Goals of this Lecture Help you learn: Function call problems: Calling and returning Passing parameters Storing local variables Handling registers without interference

More information

CPEG421/621 Tutorial

CPEG421/621 Tutorial CPEG421/621 Tutorial Compiler data representation system call interface calling convention Assembler object file format object code model Linker program initialization exception handling relocation model

More information

Buffer Overflow. An Introduction

Buffer Overflow. An Introduction Buffer Overflow An Introduction Workshop Flow-1 Revision (4-10) How a program runs Registers Memory Layout of a Process Layout of a StackFrame Layout of stack frame using GDB and looking at Assembly code

More information

Assembly Language: Function Calls" Goals of this Lecture"

Assembly Language: Function Calls Goals of this Lecture Assembly Language: Function Calls" 1 Goals of this Lecture" Help you learn:" Function call problems:" Calling and returning" Passing parameters" Storing local variables" Handling registers without interference"

More information

Program Exploitation Intro

Program Exploitation Intro Program Exploitation Intro x86 Assembly 04//2018 Security 1 Univeristà Ca Foscari, Venezia What is Program Exploitation "Making a program do something unexpected and not planned" The right bugs can be

More information

IA32 Intel 32-bit Architecture

IA32 Intel 32-bit Architecture 1 2 IA32 Intel 32-bit Architecture Intel 32-bit Architecture (IA32) 32-bit machine CISC: 32-bit internal and external data bus 32-bit external address bus 8086 general registers extended to 32 bit width

More information

CPS104 Recitation: Assembly Programming

CPS104 Recitation: Assembly Programming CPS104 Recitation: Assembly Programming Alexandru Duțu 1 Facts OS kernel and embedded software engineers use assembly for some parts of their code some OSes had their entire GUIs written in assembly in

More information

ICS143A: Principles of Operating Systems. Midterm recap, sample questions. Anton Burtsev February, 2017

ICS143A: Principles of Operating Systems. Midterm recap, sample questions. Anton Burtsev February, 2017 ICS143A: Principles of Operating Systems Midterm recap, sample questions Anton Burtsev February, 2017 Describe the x86 address translation pipeline (draw figure), explain stages. Address translation What

More information

Y86 Processor State. Instruction Example. Encoding Registers. Lecture 7A. Computer Architecture I Instruction Set Architecture Assembly Language View

Y86 Processor State. Instruction Example. Encoding Registers. Lecture 7A. Computer Architecture I Instruction Set Architecture Assembly Language View Computer Architecture I Instruction Set Architecture Assembly Language View Processor state Registers, memory, Instructions addl, movl, andl, How instructions are encoded as bytes Layer of Abstraction

More information

Sungkyunkwan University

Sungkyunkwan University - 2 - Complete addressing mode, address computation (leal) Arithmetic operations Control: Condition codes Conditional branches While loops - 3 - Most General Form D(Rb,Ri,S) Mem[ Reg[ R b ] + S Reg[ R

More information

UMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP.

UMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP. Procedures: CALL: Pushes the address of the instruction following the CALL instruction onto the stack. RET: Pops the address. SUM PROC NEAR USES BX CX DX ADD AX, BX ADD AX, CX MOV AX, DX RET SUM ENDP NEAR

More information

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II) MICROPROCESSOR UOP S.E.COMP (SEM-II) 80386 MICROPROCESSOR ARCHITECTURE Prof. P. C. Patil Department of Computer Engg Sandip Institute of Engineering & Management Nashik pc.patil@siem.org.in 1 Introduction

More information

Assembly Language: Function Calls" Goals of this Lecture"

Assembly Language: Function Calls Goals of this Lecture Assembly Language: Function Calls" 1 Goals of this Lecture" Help you learn:" Function call problems:" Calling and urning" Passing parameters" Storing local variables" Handling registers without interference"

More information

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated CNIT 127: Exploit Development Ch 1: Before you begin Updated 1-14-16 Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend, such as Denial

More information

Assembly Language Programming Debugging programs

Assembly Language Programming Debugging programs Assembly Language Programming Debugging programs November 18, 2017 Debugging programs During the development and investigation of behavior of system programs various tools are used. Some utilities are

More information

Assembly Language: Function Calls. Goals of this Lecture. Function Call Problems

Assembly Language: Function Calls. Goals of this Lecture. Function Call Problems Assembly Language: Function Calls 1 Goals of this Lecture Help you learn: Function call problems: Calling and urning Passing parameters Storing local variables Handling registers without interference Returning

More information

4) C = 96 * B 5) 1 and 3 only 6) 2 and 4 only

4) C = 96 * B 5) 1 and 3 only 6) 2 and 4 only Instructions: The following questions use the AT&T (GNU) syntax for x86-32 assembly code, as in the course notes. Submit your answers to these questions to the Curator as OQ05 by the posted due date and

More information

Intro x86 Part 3: Linux Tools & Analysis

Intro x86 Part 3: Linux Tools & Analysis Intro x86 Part 3: Linux Tools & Analysis Xeno Kovah 2009/2010 xkovah at gmail Approved for Public Release: 10-3348. Distribution Unlimited All materials is licensed under a Creative Commons Share Alike

More information

iapx Systems Electronic Computers M

iapx Systems Electronic Computers M iapx Systems Electronic Computers M 1 iapx History We analyze 32 bit systems: generalization to 64 bits is straigtforward Segment Registers (16 bits) Code Segment Stack Segment Data Segment Extra Ssegment

More information

Assembly level Programming. 198:211 Computer Architecture. (recall) Von Neumann Architecture. Simplified hardware view. Lecture 10 Fall 2012

Assembly level Programming. 198:211 Computer Architecture. (recall) Von Neumann Architecture. Simplified hardware view. Lecture 10 Fall 2012 19:211 Computer Architecture Lecture 10 Fall 20 Topics:Chapter 3 Assembly Language 3.2 Register Transfer 3. ALU 3.5 Assembly level Programming We are now familiar with high level programming languages

More information

CMSC 313 Lecture 12 [draft] How C functions pass parameters

CMSC 313 Lecture 12 [draft] How C functions pass parameters CMSC 313 Lecture 12 [draft] How C functions pass parameters UMBC, CMSC313, Richard Chang Last Time Stack Instructions: PUSH, POP PUSH adds an item to the top of the stack POP removes an

More information

X86 Stack Calling Function POV

X86 Stack Calling Function POV X86 Stack Calling Function POV Computer Systems Section 3.7 Stack Frame Reg Value ebp xffff FFF0 esp xffff FFE0 eax x0000 000E Memory Address Value xffff FFF8 xffff FFF4 x0000 0004 xffff FFF4 x0000 0003

More information

X86 Review Process Layout, ISA, etc. CS642: Computer Security. Drew Davidson

X86 Review Process Layout, ISA, etc. CS642: Computer Security. Drew Davidson X86 Review Process Layout, ISA, etc. CS642: Computer Security Drew Davidson davidson@cs.wisc.edu From Last Time ACL-based permissions (UNIX style) Read, Write, execute can be restricted on users and groups

More information

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING PREVIEW SLIDES 16, SPRING 2013

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING PREVIEW SLIDES 16, SPRING 2013 CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING PREVIEW SLIDES 16, SPRING 2013 CONST POINTERS CONST POINTERS 4 ways to declare pointers in combination with const:!! int *ptr! const int *ptr!

More information

CS , Fall 2002 Exam 1

CS , Fall 2002 Exam 1 Andrew login ID: Full Name: CS 15-213, Fall 2002 Exam 1 October 8, 2002 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write

More information

Process Layout and Function Calls

Process Layout and Function Calls Process Layout and Function Calls CS 6 Spring 07 / 8 Process Layout in Memory Stack grows towards decreasing addresses. is initialized at run-time. Heap grow towards increasing addresses. is initialized

More information

Instruction Set Architecture

Instruction Set Architecture CS:APP Chapter 4 Computer Architecture Instruction Set Architecture Randal E. Bryant Carnegie Mellon University http://csapp.cs.cmu.edu CS:APP Instruction Set Architecture Assembly Language View! Processor

More information

Instruction Set Architecture

Instruction Set Architecture CS:APP Chapter 4 Computer Architecture Instruction Set Architecture Randal E. Bryant Carnegie Mellon University http://csapp.cs.cmu.edu CS:APP Instruction Set Architecture Assembly Language View Processor

More information

Buffer Overflow Attacks

Buffer Overflow Attacks CS- Spring Buffer Overflow Attacks Computer Systems..-, CS- Spring Hacking Roots in phone phreaking White Hat vs Gray Hat vs Black Hat Over % of Modern Software Development is Black Hat! Tip the balance:

More information

Assembly I: Basic Operations. Jo, Heeseung

Assembly I: Basic Operations. Jo, Heeseung Assembly I: Basic Operations Jo, Heeseung Moving Data (1) Moving data: movl source, dest Move 4-byte ("long") word Lots of these in typical code Operand types Immediate: constant integer data - Like C

More information

Low Level Programming Lecture 2. International Faculty of Engineerig, Technical University of Łódź

Low Level Programming Lecture 2. International Faculty of Engineerig, Technical University of Łódź Low Level Programming Lecture 2 Intel processors' architecture reminder Fig. 1. IA32 Registers IA general purpose registers EAX- accumulator, usually used to store results of integer arithmetical or binary

More information

CSCE 212H, Spring 2008 Lab Assignment 3: Assembly Language Assigned: Feb. 7, Due: Feb. 14, 11:59PM

CSCE 212H, Spring 2008 Lab Assignment 3: Assembly Language Assigned: Feb. 7, Due: Feb. 14, 11:59PM CSCE 212H, Spring 2008 Lab Assignment 3: Assembly Language Assigned: Feb. 7, Due: Feb. 14, 11:59PM February 7, 2008 1 Overview The purpose of this assignment is to introduce you to the assembly language

More information

UW CSE 351, Winter 2013 Midterm Exam

UW CSE 351, Winter 2013 Midterm Exam Full Name: Student ID: UW CSE 351, Winter 2013 Midterm Exam February 15, 2013 Instructions: Make sure that your exam is not missing any of the 9 pages, then write your full name and UW student ID on the

More information

ASSEMBLY I: BASIC OPERATIONS. Jo, Heeseung

ASSEMBLY I: BASIC OPERATIONS. Jo, Heeseung ASSEMBLY I: BASIC OPERATIONS Jo, Heeseung MOVING DATA (1) Moving data: movl source, dest Move 4-byte ("long") word Lots of these in typical code Operand types Immediate: constant integer data - Like C

More information

CHAPTER 3 BASIC EXECUTION ENVIRONMENT

CHAPTER 3 BASIC EXECUTION ENVIRONMENT CHAPTER 3 BASIC EXECUTION ENVIRONMENT This chapter describes the basic execution environment of an Intel 64 or I A-32 processor as seen by assemblylanguage programmers. It describes how the processor executes

More information

1. A student is testing an implementation of a C function; when compiled with gcc, the following x86-32 assembly code is produced:

1. A student is testing an implementation of a C function; when compiled with gcc, the following x86-32 assembly code is produced: This assignment refers to concepts discussed in the course notes on gdb and the book The Art of Debugging by Matloff & Salzman. The questions are definitely "hands-on" and will require some reading beyond

More information

1 /* file cpuid2.s */ 4.asciz "The processor Vendor ID is %s \n" 5.section.bss. 6.lcomm buffer, section.text. 8.globl _start.

1 /* file cpuid2.s */ 4.asciz The processor Vendor ID is %s \n 5.section.bss. 6.lcomm buffer, section.text. 8.globl _start. 1 /* file cpuid2.s */ 2.section.data 3 output: 4.asciz "The processor Vendor ID is %s \n" 5.section.bss 6.lcomm buffer, 12 7.section.text 8.globl _start 9 _start: 10 movl $0, %eax 11 cpuid 12 movl $buffer,

More information

Module 3 Instruction Set Architecture (ISA)

Module 3 Instruction Set Architecture (ISA) Module 3 Instruction Set Architecture (ISA) I S A L E V E L E L E M E N T S O F I N S T R U C T I O N S I N S T R U C T I O N S T Y P E S N U M B E R O F A D D R E S S E S R E G I S T E R S T Y P E S O

More information

CSE2421 FINAL EXAM SPRING Name KEY. Instructions: Signature

CSE2421 FINAL EXAM SPRING Name KEY. Instructions: Signature CSE2421 FINAL EXAM SPRING 2013 Name KEY Instructions: This is a closed-book, closed-notes, closed-neighbor exam. Only a writing utensil is needed for this exam. No calculators allowed. If you need to go

More information

Mechanisms for entering the system

Mechanisms for entering the system Mechanisms for entering the system Yolanda Becerra Fontal Juan José Costa Prats Facultat d'informàtica de Barcelona (FIB) Universitat Politècnica de Catalunya (UPC) BarcelonaTech 2017-2018 QP Content Introduction

More information

MACHINE-LEVEL PROGRAMMING I: BASICS COMPUTER ARCHITECTURE AND ORGANIZATION

MACHINE-LEVEL PROGRAMMING I: BASICS COMPUTER ARCHITECTURE AND ORGANIZATION MACHINE-LEVEL PROGRAMMING I: BASICS COMPUTER ARCHITECTURE AND ORGANIZATION Today: Machine Programming I: Basics History of Intel processors and architectures C, assembly, machine code Assembly Basics:

More information

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY BACKGROUND 8086 CPU has 8 general purpose registers listed below: AX - the accumulator register (divided into AH / AL): 1. Generates shortest machine code 2. Arithmetic, logic and data transfer 3. One

More information

Instruction Set Architectures

Instruction Set Architectures Instruction Set Architectures ISAs Brief history of processors and architectures C, assembly, machine code Assembly basics: registers, operands, move instructions 1 What should the HW/SW interface contain?

More information

CS / ECE , Spring 2010 Exam 1

CS / ECE , Spring 2010 Exam 1 Andrew login ID: Full Name: Recitation Section: CS 15-213 / ECE 18-243, Spring 2010 Exam 1 Version 1100101 Tuesday, March 2nd, 2010 Instructions: Make sure that your exam is not missing any sheets, then

More information

Project 1 Notes and Demo

Project 1 Notes and Demo Project 1 Notes and Demo Overview You ll be given the source code for 7 short buggy programs (target[1-7].c). These programs will be installed with setuid root Your job is to write exploits (sploit[1-7].c)

More information

You may work with a partner on this quiz; both of you must submit your answers.

You may work with a partner on this quiz; both of you must submit your answers. Instructions: Choose the best answer for each of the following questions. It is possible that several answers are partially correct, but one answer is best. It is also possible that several answers are

More information

CS 31: Intro to Systems Functions and the Stack. Martin Gagne Swarthmore College February 23, 2016

CS 31: Intro to Systems Functions and the Stack. Martin Gagne Swarthmore College February 23, 2016 CS 31: Intro to Systems Functions and the Stack Martin Gagne Swarthmore College February 23, 2016 Reminders Late policy: you do not have to send me an email to inform me of a late submission before the

More information

Assembly I: Basic Operations. Computer Systems Laboratory Sungkyunkwan University

Assembly I: Basic Operations. Computer Systems Laboratory Sungkyunkwan University Assembly I: Basic Operations Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Moving Data (1) Moving data: movl source, dest Move 4-byte ( long )

More information

CS642: Computer Security

CS642: Computer Security X86 Review Process Layout, ISA, etc. CS642: Computer Security Drew Davidson davidson@cs.wisc.edu From Last Week ACL- based permissions (UNIX style) Read, Write, execute can be restricted on users and groups

More information

Advanced Buffer Overflow

Advanced Buffer Overflow Pattern Recognition and Applications Lab Advanced Buffer Overflow Ing. Davide Maiorca, Ph.D. davide.maiorca@diee.unica.it Computer Security A.Y. 2016/2017 Department of Electrical and Electronic Engineering

More information

Control flow. Condition codes Conditional and unconditional jumps Loops Switch statements

Control flow. Condition codes Conditional and unconditional jumps Loops Switch statements Control flow Condition codes Conditional and unconditional jumps Loops Switch statements 1 Conditionals and Control Flow Familiar C constructs l l l l l l if else while do while for break continue Two

More information

MICROPROCESSOR ALL IN ONE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

MICROPROCESSOR ALL IN ONE. Prof. P. C. Patil UOP S.E.COMP (SEM-II) MICROPROCESSOR UOP S.E.COMP (SEM-II) 80386 ALL IN ONE Prof. P. C. Patil Department of Computer Engg Sandip Institute of Engineering & Management Nashik pc.patil@siem.org.in 1 Architecture of 80386 2 ARCHITECTURE

More information

ANITA S SUPER AWESOME RECITATION SLIDES

ANITA S SUPER AWESOME RECITATION SLIDES ANITA S SUPER AWESOME RECITATION SLIDES 15/18-213: Introduction to Computer Systems Stacks and Buflab, 11 Jun 2013 Anita Zhang, Section M WHAT S NEW (OR NOT) Bomblab is due tonight, 11:59 PM EDT Your late

More information