Format String Bugs Detection Technologies for C Programs

Author
HuangHai
Advisor
HuangChun
School
National University of Defense Science and Technology
Major
Computer Science and Technology
Classification
TP311.11 Programming method
Degree
Master's thesis
Year
2008
Downloads
56
Citations
1

Request the full text

Abstract

The C programming language is one of the most wildly used languages. However, there are some security problems in it, for example, format string vulnerabilities, a typical one. Though appearing relatively late, it has done as much harm as other notorious defects, such as Buffer Overflow. Experienced attackers can exploit it to modify the return address of a function call, resulting in the execution of malicious codes, so as to get the root privilege to do whatever they want.CQual is a lightweight program analysis tool. Like other static analysis tools, it may lead to a few false positives in some situations. In this paper, we analyze the false positive of the structs through a piece of code. In order to reduce the false positive and improve the precision, we add a record type to lambda calculus to imitate the structs in C, and based on that ,we model the relation among fields of structs, and expand the rules of type inference, type checking and constraint solving. Theoretically, it will reduce some false positives in format string bugs detection, const inference and dead lock detection .In order to evaluate the extension of CQual, we build a tool named ECQual based on CQual. In the experiment, we use ECQual to check the format string bugs in a few network programs. Compared with the results of CQual, it removes a kind of false positives,which are related to fields of structs..Based on former thoughts of format string bugs detection, we propose a novel method named LibFmtGrd , which combines DLL injection and comparison of the number of parameters to detect potential format string attacks. We implement the tool on the Linux platform and do some experiments. The results reveal that it can find most kinds of format string bugs, and when compared with FormatGuard and FormatShield ,the runtime burden having been reduced by 0.17% and 2.29% respectively.

Table of contents

Abstract 8-9 ABSTRACT 9-10 Chapter Introduction 10-17 1.1 format string flaw 11-12 1.2 format string flaw detection method 12-14 1.2.1 program static analysis 12 1.2.2 dynamic Analysis 12-13 <br / > 1.2.3 comprehensive static and dynamic analysis 13 1.2.4 Summary 13-14 1.3 dissertation research content and the main results achieved 14 - 15 1.4 the paper is structured 15-17 Chapter extended CQUAL support structure members polymorphism studies 17-31 2.1 CQUAL background 17-21 2.1.1 type qualifiers sub 17-19 2.1.2 CQual analysis principles 19-20 2.1.3 CQual problems 20-21 2.2 type qualifier child and subtypes 21-23 2.3 define sub- labels and assertions 23-24 2.4 with limited Son type inference system 24-29 2.5 with a limited sub- type inspection system 29 2.6 constraint generation and solving 29-30 2.7 polymorphic 30-31 Chapter III development ECQUAL to check the format string flaw 31-38 3.1 ECQUAL realization 31-33 3.2 for example process improvement effect 33-34 3.3 for the application of experimental 34-36 3.3.1 measurable goals 34 3.3.2 build test 34-35 3.3.3 experimental results and results analysis 35-36 3.4 related work and compare 36-38 Chapter use LIBFMTGRD check the format string flaw 38-49 4.1 background 38-40 4.1.1 FormatGuard methods and inadequate 38-39 4.1 .2 LibFormat methods and inadequate 39-40 4.1.3 analysis and Lessons 40 4.2 LIBFMTGRD method 40-43 4.2.1 insert terminator 41-42 4.2.2 dynamic interception 42 4.2.3 parameter count and compare 42-43 4.3 LIBFMTGRD achieve 43-44 4.3.1 insert terminator 43 4.3.2 dynamic interception 43-44 4.3.3 parameter count and compare 44 4.4 experimental 44-46 4.4.1 security Testing 44 4.4.2 performance Test 44-46 <br / > 4.5 discussion 46-47 4.5.1 false negatives and false positives 47 4.5.2 shortcomings and deficiencies 47 4.6 Related work Compare 47-49 Chapter Summary 49-51 5.1 paper summarizes 49-50 5.2 the next step 50-51 Thanks 51-52 References 52-55 author during term academic achievements 55-56 authors participated in research projects during the study period 56