文档介绍:华中科技大学
硕士学位论文
缓冲区溢出检测工具设计与实现
姓名:丁雁林
申请学位级别:硕士
专业:计算机软件与理论
指导教师:朱虹
20060401
摘要
缓冲区溢出漏洞是目前软件面临最严重的安全漏洞。产生缓冲区溢出漏洞有两
种原因,一是在软件开发过程中,程序员在编写程序时对缓冲区操作没有进行边界
检测;二是在程序中调用了 C 标准库中的一些不安全的字符串操作函数,而这些 C
库函数本身没有对缓冲区边界进行检测,因而造成缓冲区溢出问题。
通过对缓冲区溢出原理和各种缓冲区溢出类型的分析,对测试对象进行了形式
化定义,并定义了缓冲区状态和缓冲区上的操作。在此基础上建立了一种缓冲区溢
出漏洞检测模型,同时归纳四条缓冲区溢出漏洞检测规则和一条缓冲区溢出漏洞检
测定理,说明了存在缓冲区溢出的必要条件是程序中定义了指针或数组变量,并且
在对这些缓冲区操作时没有进行边界检测,根据缓冲区的状态来判断缓冲区溢出的
定理。
为了克服在源程序中添加注解的繁重的工作,同时也为了防止执行程序的过渡
膨胀而增加运行程序的负荷,根据缓冲区溢出漏洞检测模型,实现了一个缓冲区溢
出检测的检测工具。实现过程中根据模型的检测规则判断测试对象中是否存在缓冲
区溢出漏洞。检测工具通过对被检测对象扫描来实现缓冲区溢出漏洞检测。检测工
具由输入处理、词法分析、语法分析、语义分析和输出五大模块组成。检测工具实
现了对指针变量、数组变量、程序员自定义数据类型变量和部分 C 库函数的缓冲区
溢出漏洞检测。
研究和实验结果表明,缓冲区溢出漏洞检测工具能有效检测源程序中的指针变
量越界访问、数组变量越界访问、结构类型对象越界访问和部分 C 库函数调用造成
的缓冲区溢出问题。能快速检测出大型程序中的缓冲溢出漏洞,具有一定的实用价
值。
关键词: 缓冲区溢出,检测模型,检测工具,检测规则
I
Abstract
Now, the buffer overflow is the most security problem in software. When the
programmers forget to check the boundary of buffers or use some standard C library
strings functions, those functions don’t check the boundary of buffers the buffer overflow
vulnerabilities would be produced.
Through analyzing the theory and types of buffer overflow vulnerabilities, the
format defines of the testing object are brought up, the manipulation on buffer and the
status of buffer are defined. And the checking model of buffer overflow vulnerabilities is
brought up that based on those definitions, at the same time four checking rules of buffer
overflow and one theory are presented. When the buffer overflow vulnerabilities has
been occurred, there must have two necessary conditions. First is the buffers had been
defined in C source codes, the second is the programmer didn’t check the boundary of
the buffers. The buffer overflow vulnerabilities checked theory based on the buffers
status checks buffer overflow vulnerabilities.
A checking tool of buffer overflow is designed and implemented base on the
checking model, it can e the heavy