TAILIEUCHUNG - Lecture An toàn Hệ điều hành: Stack Overflows - Nguyễn Hồng Sơn

Lecture "An toàn Hệ điều hành: Stack Overflows" has contents: Buffers, reading past the end of a buffer, writing past the end of a buffer, stacks and functions, overflowing buffers on the stack, kiểm soát EIP. | Lecture An toàn Hệ điều hành Stack Overflows - Nguyễn Hồng Sơn Stack Overflows 1 Buffers A buffer is defined as a limited contiguously allocated set of memory Stack overflows are possible because no inherent bounds-checking exists onbuffers in the C or C languages 2 reading past the end of a buffer include include int main int array 5 1 2 3 4 5 printf d n array 5 This example shows how easy it is to read past the end of a buffer C provides no built-in protection 3 writing past the end of a buffer int main int array 5 int i for i 0 i The Stack the stack is a LIFO data structure. push 1 push addr var PUSHing values onto the stack 5 pop eax pop ebx POPing values from the stack 6 Stacks and Functions For each function call there s a section of the stack reserved for the function. This is usually called a stack frame A stack frame exists whenever a function has started but yet to complete main in a C program Stack frame for main is also called the activation record 7 If inside of body of main there s a call to foo . Suppose foo takes two arguments. One way to pass the arguments to foo is through the stack. Thus there needs to be assembly language code in main to quot push quot arguments for foo onto the the stack. 8 by placing the arguments on the stack the stack frame for main has increased in size. When the arguments are placed onto the stack the function is called placing the return address or RET value onto the stack. RET value is the address stored in the instruction pointer EIP at the time function is called. 9 Once we get into code for foo the function foo may need local variables so foo needs to push some space on the stack 10 The frame pointer points to the location where the stack pointer was just before foo moved the stack pointer for foo s own local variables. Having a frame pointer is convenient when a function is likely to move the stack pointer several times throughout the course of running the function. The idea is to keep the frame pointer fixed for .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.