SQL(Structured Query Language)注入是一种常用且易于实施的攻击手段,对Web应用程序的安全构成严重危害.通过分析SQL注入攻击的原理,提出一种基于程序分析技术的SQL注入防御原型系统.该系统以静态分析为基础,对污染数据进行跟踪,并为包含污染数据的SQL语句建立合法查询自动机模型,然后以此作为被测程序的探针,进行动态测试,跟踪并记录程序的执行情况.系统的实现针对Java的Web应用程序,不需要修改服务器以及数据库平台的配置.实验表明,该系统具有较好的防范SQL注入的效果和较低的运行开销.
SQL injection,which is a popular and easy method to carry out,poses a major threat to Web application security.This paper analyzes the principle of SQL injection attack and then presents a prototype system of countering it with program analysis techniques.The key idea of the system on the basis of static analysis is to trace the taint data and get automata models of legal query for the SQL statement contained them and insert automata as probes in the Web applications for dynamic testing,then track and record the implementations of the procedures.Aiming at the Java-based Web applications,the prototype needs no change to the configuration of server and database.Experiments show that the mechanism is effective to prevent SQL injection attacks and imposes negligible performance overhead.