PHPGate: A Practical White-Delimiter-Tracking Protection against SQL-Injection for PHP

Lihua Zhang,Yu Ding,Chao Zhang,Lei Duan,Zhaofeng Chen,Tao Wei,Xinhui Han
2016-01-01
Abstract:SQL injection has a long history as a dangerous threat, grabbing lots of security researchers’ attentions. However, it is still ranked the first of the ten most dangerous web application threats by OWASP since 2008, indicating a big gap between researches and industry practice. Most SQL injection vulnerabilities are introduced by ignorance or negligence, so a good protection solution should be “fool-proof”. To be used in day-to-day deployment, it should also have little performance overhead. In this paper, we propose a white-delimiter-tracking defense solution against SQL injections: unlike typical taint-tracking solutions that track user inputs or all SQL related strings hard-coded in web applications, we only track the SQL delimiters in these hard-coded strings, and only allow these delimiters to be used in the final SQL statements. Furthermore, instead of allocating extra shadow memory for taint tracking, we encode the tracking information directly into the same byte as the delimiters by utilizing the characteristics of UTF-8 encoding. This solution tracks much less data than existing solutions and keeps the accuracy of byte-level taint tracking. A prototype called PHPGate is implemented on the PHP Zend engine. PHPGate can protect UTF-8 encoding web applications from real world SQL injection attacks and only introduces a performance overhead less than 1.5%.
What problem does this paper attempt to address?