Design and Implementation of Static Program Analyzer Finding All Buffer Overrun Errors in C Programs

C 프로그램의 버퍼 오버런(buffer overrun) 오류를 찾아 주는 정적 분석기의 설계와 구현

  • 이광근 (서울대학교 컴퓨터공학부) ;
  • 김재황 (서울대학교 컴퓨터공학부) ;
  • 정영범 (서울대학교 컴퓨터공학부)
  • Published : 2006.05.01

Abstract

We present our experience of combining, in a realistic setting, a static analyzer with a statistical analysis. This combination is in order to reduce the inevitable false alarms from a domain-unaware static analyzer. Our analyzer named Airac(Array Index Range Analyzer for C) collects all the true buffer-overrun points in ANSI C programs. The soundness is maintained, and the analysis' cost-accuracy improvement is achieved by techniques that static analysis community has long accumulated. For still inevitable false alarms (e.g. Airac raised 970 buffer-overrun alarms in commercial C programs of 5.3 million lines and 737 among the 970 alarms were false), which are always apt for particular C programs, we use a statistical post analysis. The statistical analysis, given the analysis results (alarms), sifts out probable false alarms and prioritizes true alarms. It estimates the probability of each alarm being true. The probabilities are used in two ways: 1) only the alarms that have true-alarm probabilities higher than a threshold are reported to the user; 2) the alarms are sorted by the probability before reporting, so that the user can check highly probable errors first. In our experiments with Linux kernel sources, if we set the risk of missing true error is about 3 times greater than false alarming, 74.83% of false alarms could be filtered; only 15.17% of false alarms were mixed up until the user observes 50% of the true alarms.

이 논문에서는 정적 프로그램 분석(static program analysis)과 통계적 분석(statistical analysis)의 조합을 가지고 실제적인 C 프로그램을 검증한 경험을 보고한다. 정적 분석과 통계적 분석의 조합은 입력 프로그램에 제한을 두지 않는 정적 분석기에서 발생하는 불가피한 허위 경보를 줄이기 위한 것이다. 우리는 ANSI C 프로그램이 실행 중에 겪을 수 있는 모든 배열 참조 오류(buffer overrun)를 찾아주는 정적 프로그램 분석기 아이락(Airac, Array Index Range Analyzer for C)을 고안하고 구현하였다. 분석의 안전성(soundness)을 유지하면서 프로그램 분석 분야에서 오랫동안 축적된 기술들을 활용하여 분석 비용 절감 및 정확도 향상을 달성했다. 대상 프로그램에 제한을 두지 않는 안전한 분석은 정확도에 한계가 있으므로 불가피한 허위 경보가 존재할 수 있다. 이러한 허위 경보(예를 들어 530만 줄짜리 상용 C 프로그램에 대한 분석 결과 아이락은 970개의 배열 참조 오류 경보를 발생시켰으나 그 중 737개는 허위 경보였다.)에 대처하기 위해 우리는 통계적 사후 분석을 시도하였다. 통계적 사후 분석은 주어진 경보가 실제 오류를 가리킬 확률을 계산한다. 이렇게 계산된 확률은 두 가지 방법으로 사용된다. 1) 경보를 걸러내거나, 2) 실제 오류에 대한 경보일 가능성이 높은 것들을 우선적으로 사용자에게 보여준다. 우리는 리눅스 커널 프로그램과 알고리즘 교과서의 프로그램들을 대상으로 실험을 수행했다. 우리 실험에서 실제 오류를 놓칠 위험이 허위 경보의 위험의 3배라고 설정한 경우 74.83%의 허위 경보를 걸러낼 수 있었고, 참일 확률이 높은 경보부터 검증하는 경우 15.17%의 허위 경보만이 실제 오류 50%와 섞여 있었다.

Keywords

References

  1. bugtraq. www.securityfocus.com
  2. CERT/CC advisories. www.cert.org/advisories
  3. Nurit Dor, Michael Rodeh, and Mooly Sagiv. Cssv: towards a realistic tool for statically detecting all buffer overflows in c. In PLDI '03: Proceedings of the ACM SIGPLAN 2003 con-ference on Programming language design and implementation, pages 155-167. ACM Press, 2003 https://doi.org/10.1145/781131.781149
  4. Bruno Blanchet, Patrie Cousot, Radhia Cousot, Jerome Feret, Laurent Mauborgne, Antonie Mine, David Monnizux, and Xavier Rival. A static analyzer for large safety-critical software. In Proceedings of the SIGPLAN Coriference on Programming Language Design and Implementation, pages 196-207, June 2003 https://doi.org/10.1145/781131.781153
  5. Yichen Xie, Andy Chou, and Dawson Engler. Archer: using symbolic, path-sensitive analysis to detect memory access errors. In ESEC/FSE-11: Proceedings qf the 9th European software engineering corference held jointly with 11th ACM SIGSOFT international symposium on Foundations of software engineering, pages 327-336. ACM Press, 2003 https://doi.org/10.1145/949952.940115
  6. David Hovemeyer and William Pugh. Finding bugs is easy. SIGPLAN Not., 39(2):92-106, 2004 https://doi.org/10.1145/1052883.1052895
  7. Patrick Cousot and Radhia Cousot. Comparing the galois connection and' widening/narrowing approaches to abstract interpretation. In PLILP '92: Proceedings of the 4th International Symposium on Programming Language Implementation and Logic Programming, pages 269-295. SpringerVerlag, 1992
  8. Laurent Mauborgne and Xavier Rival. Trace partitioning in abstract interpretation based static analyzers. In M. Sagiv, editor, European Symposium on Programming (ESOP'O5), volume 3444 of Lecture Notes in Computer Science, pages 5-20. Springer-Verlag, 2005
  9. N. Metropolis and S. Ulam. The Monte Carlo method. Journal of the American Statistical Association, 44(247):335-341, September 1949 https://doi.org/10.2307/2280232
  10. James O. Berger. Statistical Decision Theory and Bayesian Analysis, 2nd Edition. Springer, 1985
  11. Andrew Gelman, John B. Carlin, Hal S. Stern, and Donald B. Rubin. Bayesian Data Analysis. Text in Statistical Science. Chapman & HaIl/CRC, second edition edition, 2004
  12. Patrick Cousot and Radhia Cousot. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of ACM Symposium on Principles of Programming Languages, pages 238-252, January 1977 https://doi.org/10.1145/512950.512973
  13. Patrick Cousot and Radhia Cousot. Systematic design of program analysis frameworks. In Proceedings of ACM Symposium on Principles of Programming Languages, pages 269-282, 1979 https://doi.org/10.1145/567752.567778
  14. Patrick Cousot, Radhia Cousot, J'er^ome Feret, Laurent Mauborgne, Antoine Min'e, David Monniaux, and Xavier Rival. The astr'ee analyzer. In M. Sagiv, editor, European Symposium on Programming (ESOP'05), volume 3444 of Lecture Notes in Computer Science, pages 21-30. pringer-Verlag, 2005
  15. Misha Zitser, Richard Lippmann, and Tim Leek. Testing static analysis tools using exploitable buffer overflows from open source code. In SIGSOFT '04/FSE-12: Proceedings of the 12th ACM SIGSOFT twelfth international symposium on Foundations of software engineering, pages 97-106. ACM Press, 2004 https://doi.org/10.1145/1029894.1029911
  16. Patrick Cousot, Radhia Cousot, .I'er^ome Feret, Laurent Mauborgne, Antoine Min'e, David Monniaux, and Xavier Rival. The astr'ee analyzer. In M. Sagiv, editor, European Symposium on Programming (ESOP'05), volume 3444 of Lecture Notes in Computer Science, pages 21-30. pringer-Verlag, 2005