缓冲区溢出实验说明

上传人:第*** 文档编号:34848436 上传时间:2018-03-02 格式:DOC 页数:9 大小:166KB
返回 下载 相关 举报
缓冲区溢出实验说明_第1页
第1页 / 共9页
缓冲区溢出实验说明_第2页
第2页 / 共9页
缓冲区溢出实验说明_第3页
第3页 / 共9页
缓冲区溢出实验说明_第4页
第4页 / 共9页
缓冲区溢出实验说明_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《缓冲区溢出实验说明》由会员分享,可在线阅读,更多相关《缓冲区溢出实验说明(9页珍藏版)》请在金锄头文库上搜索。

1、1 Introduction This assignment helps you develop a detailed understanding of the calling stack organization on an IA32 processor. It involves applying a series of buffer overflow attacks on an executable file bufbomb in the lab directory. Note: In this lab, you will gain firsthand experience with on

2、e of the methods commonly used to exploit security weaknesses in operating systems and network servers. Our purpose is to help you learn about the runtime operation of programs and to understand the nature of this form of security weakness so that you can avoid it when you write system code. We do n

3、ot condone the use of these or any other form of attack to gain unauthorized access to any system resources. There are criminal statutes governing such activities. Login the Server Everyone has an account on our Server, the address is 10.13.75.177, and username is stu+ your student number (ex:stu047

4、2001), the default password is csapp2007. You can get the access with putty. Start by copying buflab-handout.tar to a (protected) directory in which you plan to do your work. Then give the command “tar xvf buflab-handout.tar”. This will cause a number of files to be unpacked in the directory: MAKECO

5、OKIE: Generates a “cookie” based on your name. BUFBOMB: The code you will attack. SENDSTRING: A utility to help convert between string formats. All of these programs are compiled to run on Linux machines. In the following instructions, we will assume that you have copied the three programs to a prot

6、ected local directory, and 2 that you are executing them in that local directory. Get your cookie A cookie is a string of eight hexadecimal digits that is (with high probability) unique to your name. You can generate your cookie with the makecookie program giving your name as the argument. For examp

7、le: unix ./makecookie bovik 0x78327b66 The BUFBOMB Program The BUFBOMB program reads a string from standard input with a function getbuf having the following C code: 1 int getbuf() 2 3 char buf12; 4 Gets(buf); 5 return 1; 6 The function Gets is similar to the standard library function getsit reads a

8、 string from standard input (terminated by n or end-of-file) and stores it (along with a null terminator) at the specified destination. In this code, the destination is an array buf having sufficient space for 12 characters. Neither Gets nor gets has any way to determine whether there is enough spac

9、e at the destination to storethe entire string. Instead, they simply copy the entire string, possibly overrunning the bounds of the storage allocated at the destination. If the string typed by the user to getbuf is no more than 11 characters long, it is clear that getbuf will return 1, as shown by t

10、he following execution example: unix ./bufbomb Type string: howdy doody Dud: getbuf returned 0x1 Typically an error occurs if we type a longer string: unix ./bufbomb Type string: This string is too long Ouch!: You caused a segmentation fault! As the error message indicates, overrunning the buffer ty

11、pically causes the program state to be corrupted, leading to a memory access error. Your task is to be more clever with the strings you feed BUFBOMB so that it does more interesting things. These are called exploit strings. BUFBOMB takes several different command line arguments: -t NAME: Operate the

12、 bomb for the indicated name. You should always provide this argument for several reasons: It is required to log your successful attacks. BUFBOMB determines the cookie you will be using based on your name, just as does the program MAKECOOKIE. We have built features into BUFBOMB so that some of the k

13、ey stack addresses you will need to use depend on your cookie. -h: Print list of possible command line arguments -n: Operate in “Nitro” mode, as is used in Level 4 below.3 Your exploit strings will typically contain byte values that do not correspond to the ASCII values for printing characters. The

14、program SENDSTRING can help you generate these raw strings. It takes as input a hexformatted string. In this format, each byte value is represented by two hex digits. For example, the string “012345” could be entered in hex format as “30 31 32 33 34 35.” (Recall that the ASCII code fordecimal digit

15、is 0x3x). Non-hex digit characters are ignored, including the blanks in the example shown.If you generate a hex-formatted exploit string in the file exploit.txt, you can apply the raw string to BUFBOMB in several different ways: 1. You can set up a series of pipes to pass the string through SENDSTRI

16、NG. unix cat exploit.txt | ./sendstring | ./bufbomb -t bovik 2. You can store the raw string in a file and use I/O redirection to supply it to BUFBOMB: unix ./sendstring exploit-raw.txt unix ./bufbomb -t bovik gdb bufbomb (gdb) run -t bovik exploit-raw.txt One important point: your exploit string must not contain byte value 0x0A at any intermediate position, since this is the ASCII code for newline (n). When Gets encounters this b

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号