HAMPI: A Solver for Word Equations over Strings, Regular Expressions, and Context-Free Grammars

被引:50
作者
Kiezun, Adam [1 ]
Ganesh, Vijay [2 ]
Artzi, Shay
Guo, Philip J. [3 ]
Hooimeijer, Pieter [4 ]
Ernst, Michael D. [5 ]
机构
[1] Harvard Univ, Brigham & Womens Hosp, Sch Med, Cambridge, MA 02138 USA
[2] MIT, Cambridge, MA 02139 USA
[3] Stanford Univ, Stanford, CA 94305 USA
[4] Univ Virginia, Charlottesville, VA 22903 USA
[5] Univ Washington, Seattle, WA 98195 USA
关键词
Verification; Algorithms; Reliability; Security; String constraints; word equations; regular languages; context-free languages; concolic testing; program analysis;
D O I
10.1145/2377656.2377662
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Many automatic testing, analysis, and verification techniques for programs can be effectively reduced to a constraint-generation phase followed by a constraint-solving phase. This separation of concerns often leads to more effective and maintainable software reliability tools. The increasing efficiency of off-the-shelf constraint solvers makes this approach even more compelling. However, there are few effective and sufficiently expressive off-the-shelf solvers for string constraints generated by analysis of string-manipulating programs, so researchers end up implementing their own ad-hoc solvers. To fulfill this need, we designed and implemented HAMPI, a solver for string constraints over bounded string variables. Users of HAMPI specify constraints using regular expressions, context-free grammars, equality between string terms, and typical string operations such as concatenation and substring extraction. HAMPI then finds a string that satisfies all the constraints or reports that the constraints are unsatisfiable. We demonstrate HAMPI's expressiveness and efficiency by applying it to program analysis and automated testing. We used HAMPI in static and dynamic analyses for finding SQL injection vulnerabilities in Web applications with hundreds of thousands of lines of code. We also used HAMPI in the context of automated bug finding in C programs using dynamic systematic testing (also known as concolic testing). We then compared HAMPI with another string solver, CFGAnalyzer, and show that HAMPI is several times faster. HAMPI'S source code, documentation, and experimental data are available at http://people.csail.mit.edu/akiezun/hampi(1).
引用
收藏
页数:28
相关论文
共 59 条
  • [1] [Anonymous], 2008, NDSS
  • [2] [Anonymous], 2008, P 8 USENIX C OP SYST
  • [3] [Anonymous], P C PROGR LANG DES I
  • [4] AXELSSON R., 2008, P INT C AUT LANG PRO
  • [5] BARRETT C, 2003, THESIS STANFORD U
  • [6] Biere A., 2003, ADV COMPUT, V58
  • [7] BIERE A., 2005, P INT C THEOR APPL S
  • [8] BJORNER N., 2009, P INT C TOOLS ALG CO
  • [9] CADAR C., 2006, P C COMP COMM SEC
  • [10] CHRISTENSEN A. S., 2003, P INT STAT AN S