Font Size: a A A

Research On SQL Injection Defense Based On Abstract Syntax Tree

Posted on:2019-06-28Degree:MasterType:Thesis
Country:ChinaCandidate:J WangFull Text:PDF
GTID:2348330542455580Subject:Communication and Information System
Abstract/Summary:PDF Full Text Request
Web applications based on databases as storage media have been pervasive in business systems in various domains.Due to some irregularities in the coding of Web application developers,there is a potential injection risk in these applications.The potential SQL injection vulnerability will cause significant damage to the website system once the attacker finds it.Therefore,it is necessary to construct an SQL injection attack defense system in the application to intercept the illegal user request,which is necessary to protect the system from injection attack.Since the SQL injection attack statement itself is the correct SQL statement,no exception occurs even if the system executes the attack statement.This article analyzes the syntactic structure of SQL statements,and compares the structural differences between SQL injection attacks and normal SQL statements to determine whether the user's input contains an attack payload.For SQL injection attack detection and defense,this article has done the following work.(1)The implementation of SQL syntax analyzer.Precise analysis of SQL statements is the cornerstone of database security.In this thesis,through the study of SQL grammar and lexical rules,EBNF paradigm is used to describe the lexical rules and grammatical rules of SQL language.Finally,SQL parser is implemented by using ANTLR automation construction tools.(2)The construction of SQL Language Abstract Syntax Tree.This thesis first proposed the use of abstract syntax tree to judge SQL injection attacks.Abstract syntax tree is a formalized representation of SQL statements.Compared to a concrete syntax tree,the abstract syntax tree removes the redundant nodes in the tree,that is,the nodes that do not affect the final determination result,and therefore has better performance in the comparison of the tree nodes.This thesis completes the construction of abstract syntax tree by rewriting the tree rules.(3)Application Logic of SQL Injection Attack Based on Abstract Syntax Tree.This thesis presents an AST-based comparison of hash values to determine SQL injection attacks.And based on the ANTRL listener mechanism to complete the application of abstract syntax tree SQL injection attack logic.(4)Application of Syntax Analysis Module and Abstract Syntax Tree in SQL Injection Defense System.In this thesis,the main achievement of the SQL syntax analysis module and the abstract syntax tree decision module,and these two modules are applied to the SQL injection defense system.At the end of this defense system also conducted a false negative rate,false alarm rate and response time of the test.The experimental results show that the comparison method based on the abstract syntax tree hash value proposed in this paper has a good effect on SQL injection attack defense.
Keywords/Search Tags:ANTLR, EBNF, lexical analysis, syntax analysis, abstract syntax tree
PDF Full Text Request
Related items