《计算机应用》唯一官方网站 ›› 2023, Vol. 43 ›› Issue (5): 1534-1542.DOI: 10.11772/j.issn.1001-9081.2022040636

• 网络空间安全 • 上一篇    

基于ECA规则和动态污点分析的SQL注入攻击在线检测

刘吉会, 何成万()   

  1. 武汉工程大学 计算机科学与工程学院,武汉 430205
  • 收稿日期:2022-05-07 修回日期:2022-06-21 发布日期:2022-07-26 出版日期:2023-05-10
  • 通讯作者: 何成万
  • 作者简介:刘吉会(1996—),男,湖北麻城人,硕士研究生,主要研究方向:数据安全
    何成万(1967—),男,湖北荆门人,教授,博士,CCF会员,主要研究方向:软件工程及软件开发环境、软件复用及软件构件技术。hechengwan@hotmail.com
  • 基金资助:
    武汉工程大学第十二届研究生教育创新基金资助项目(CX2020216)

Online detection of SQL injection attacks based on ECA rules and dynamic taint analysis

Jihui LIU, Chengwan HE()   

  1. School of Computer Science and Engineering,Wuhan Institute of Technology,Wuhan Hubei 430205,China
  • Received:2022-05-07 Revised:2022-06-21 Online:2022-07-26 Published:2023-05-10
  • Contact: Chengwan HE
  • About author:LIU Jihui, born in 1996, M. S. candidate. His research interests include data security.
    HE Chengwan, born in 1967, Ph. D., professor. His research interests include software engineering and software development environment, software reuse and software component technology.
  • Supported by:
    the 12th Graduate Education Innovation Fund Project of Wuhan Institute of Technology(CX2020216)

摘要:

SQL注入攻击是一种常见的针对Web应用程序漏洞的攻击形式。任何形式的SQL注入攻击最终都会改变原有SQL语句的逻辑结构,违背设计者的初衷。现有的SQL注入攻击检测方法存在检测代码不易被重用、不能被在线注入Web应用程序等不足。因此,提出一种基于ECA(Event Condition Action)规则和动态污点分析的在线检测SQL注入攻击的模型。首先,定义污点标记规则监视污点源函数以标记系统外部引入数据;然后,定义污点传播规则实时跟踪污点数据在应用内部的流向;接着,定义污点检查规则以拦截污点汇聚点函数的参数,并解析它可能携带的污点状态;最后,在原始的Web应用运行时加载ECA规则脚本达到在线检测SQL注入攻击的目的,Web应用无须重新编译、打包和部署。使用Byteman实现了所提模型。在两个不同的Web应用测试实验中,该模型可以识别绝大多数的SQL注入攻击样本,对于正常请求样本没有误报,检测准确率可达99.42%,优于基于支持向量机(SVM)和基于词频逆向文件频率(TF-IDF)的方法;与基于面向方面编程(AOP)的方法相比,该模型易于在Web应用启动后在线加载检测模块。实验结果表明所提模型能够在不修改应用程序执行引擎及源码的情况下,检测6种常见的SQL注入攻击类型,且具有在线检测的优点。

关键词: SQL注入攻击, 动态污点分析, ECA规则, Web应用, 在线检测

Abstract:

SQL injection attack is a common type of attack against Web application vulnerabilities. Any form of SQL injection attacks will eventually change the logical structure of the original SQL statement, going against the original intention of the designer. The existing SQL injection attack detection methods have the shortcomings that the detection code is not easily reusable and cannot be injected into Web application online. Therefore, a model for online detection of SQL injection attacks based on Event Condition Action (ECA) rules and dynamic taint analysis was proposed. Firstly, taint marking rules were defined to monitor taint source functions, thereby marking data imported from outside of the system. Then, taint propagation rules were defined to track the flow of taint data inside the application in real time. Next, taint checking rules were defined to intercept the parameters of the taint sink functions and parse taint states they may carry. Finally, the ECA rule scripts were loaded at the runtime of the original Web application for the purpose of online detection of SQL injection attacks, and the Web application did not need to be recompiled, packaged and deployed. The proposed model was implemented by using Byteman. In two different Web application test experiments, the proposed model can identify most of the SQL injection attack samples, and there are no false positives for normal request samples, the detection accuracy of the proposed model reaches 99.42%, which is better than those of Support Vector Machine (SVM) based method and Term Frequency-Inverse Document Frequency (TF-IDF) based method. Compared with the method based on Aspect-Oriented Programming (AOP), the proposed model is easy to load the detection module online after Web applications are started. Experimental results show that the proposed model can detect 6 common forms of SQL injection attacks without modifying execution engine and source code of the application, and has the advantage of online detection.

Key words: SQL injection attack, dynamic taint analysis, Event Condition Action (ECA) rule, Web application, online detection

中图分类号: