Integer overflow bugs in C and C++ programs are difficult to track down and may lead to fatal errors or exploitable vulnerabilities. Although a number of tools for finding these bugs exist, the situation is complicated because not all overflows are bugs. Better tools need to be constructed — but a thorough understanding of the issues behind these errors does not yet exist. We developed IOC, a dynamic checking tool for integer overflows, and used it to conduct the first detailed empirical study of the prevalence and patterns of occurrence of integer overflows in C and C++ code. Our results show that intentional uses of wraparound behaviors are more common than is widely believed; for example, there are over 200 distinct locations in the SPEC CINT2000 benchmarks where overflow occurs. Although many overflows are intentional, a large number of accidental overflows also occur. Orthogonal to programmers' intent, overflows are found in both well-defined and undefined flavors. Applications executing undefined operations can be, and have been, broken by improvements in compiler optimizations. Looking beyond SPEC, we found and reported undefined integer overflows in SQLite, PostgreSQL, SafeInt, GNU MPC and GMP, Firefox, GCC, LLVM, Python, BIND, and OpenSSL; many of these have since been fixed. Our results show that integer overflow issues in C and C++ are subtle and complex, that they are common even in mature, widely used programs, and that they are widely misunderstood by developers.
[1]
Nancy G. Leveson,et al.
An investigation of the Therac-25 accidents
,
1993,
Computer.
[2]
Timothy Wilson,et al.
As-If Infinitely Ranged Integer Model
,
2010,
2010 IEEE 21st International Symposium on Software Reliability Engineering.
[3]
Robert A. Martin,et al.
Vulnerability Type Distributions in CVE
,
2007
.
[4]
David Brumley,et al.
RICH: Automatically Protecting Against Integer-Based Vulnerabilities
,
2007,
NDSS.
[5]
Nicholas Nethercote,et al.
Valgrind: A Program Supervision Framework
,
2003,
RV@CAV.
[6]
Tao Wei,et al.
IntScope: Automatically Detecting Integer Overflow Vulnerability in X86 Binary Using Symbolic Execution
,
2009,
NDSS.
[7]
Vikram S. Adve,et al.
LLVM: a compilation framework for lifelong program analysis & transformation
,
2004,
International Symposium on Code Generation and Optimization, 2004. CGO 2004..
[8]
David A. Wagner,et al.
Dynamic Test Generation to Find Integer Bugs in x86 Binary Linux Programs
,
2009,
USENIX Security Symposium.
[9]
Yi Wang,et al.
BRICK: A Binary Tool for Run-Time Detecting and Locating Integer-Based Vulnerability
,
2009,
2009 International Conference on Availability, Reliability and Security.
[10]
Bob Martin,et al.
2010 CWE/SANS Top 25 Most Dangerous Software Errors
,
2010
.