SQL Injection Detection via Syntax Tree and Semantic Analysis

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current SQL injection interception methods, primarily relying on Web Application Firewalls (WAF) with regular rules, suffer from high false positive rates due to complex situations that are difficult to describe, leading to ineffective detection of malicious SQL instructions.

Innovation Solution

A method and device that utilize a SQL syntax tree rule to detect malicious instructions, and an analysis model to determine potentially malicious instructions by generating vectors and calculating similarity with malicious SQL instruction samples, with the option to update a blacklist for improved detection and prevention.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of manufacture

If regular rules based on text characteristics are used for SQL injection detection, then the detection method is simple to implement, but the false positive rate is high

Engineering Contradiction:
Improveease of implementationVSAvoidfalse positive rate
Core Design Contradiction:
Ease of manufactureVSReliability

Solution Approach 1:

The patent segments the SQL detection process into two distinct stages: syntax tree rule detection for structured analysis and semantic analysis model detection for complex pattern recognition. This segmentation allows each method to focus on specific aspects, reducing false positives while maintaining implementation feasibility

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a syntax tree structure as an intermediary representation between the raw SQL text and the detection rules. This intermediary enables more precise matching by capturing the hierarchical structure of SQL statements, thereby reducing false positives while keeping the detection system implementable

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of manufacture

If regular rules based on text characteristics are used for SQL injection detection, then the implementation is straightforward, but the detection accuracy is low

Engineering Contradiction:
Improveease of implementationVSAvoiddetection accuracy
Core Design Contradiction:
Ease of manufactureVSMeasurement precision

Solution Approach 1:

The detection system is divided into syntax tree rule detection and semantic analysis detection, allowing straightforward implementation of rule-based detection while adding semantic analysis to improve accuracy for complex cases

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent changes the detection parameters from simple text matching to structured syntax tree analysis and semantic vector analysis. This parameter change enables more accurate detection of malicious SQL instructions while maintaining the simplicity of rule-based approaches for common cases

Inventive Principle:
Principle #35Parameter changes

3Measurement precision

If syntax tree analysis and similarity calculation are combined for SQL injection detection, then the detection accuracy is improved, but the system complexity increases

Engineering Contradiction:
Improvedetection accuracyVSAvoidsystem complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The system is segmented into distinct modules: syntax tree construction, rule-based detection, semantic vector generation, and similarity calculation. This segmentation improves detection accuracy while managing complexity through modular design

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary actions by pre-compiling syntax tree rules and pre-training semantic analysis models. This preliminary preparation reduces runtime complexity while maintaining high detection accuracy during actual SQL instruction analysis

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS11108817B2SQL injection interception detection method and device, apparatus and computer readable medium
Publication Date: 2021.08.31 BEIJING BAIDU NETCOM SCI & TECH CO LTD
  • US11108817B2 patent drawing
  • US11108817B2 patent drawing
  • US11108817B2 patent drawing

AI summary

A method for detecting SQL injection interception is provided. The method includes: detecting a received SQL instruction according to a SQL syntax tree rule to determine that the received SQL instruction is a malicious instruction; and analyzing the received SQL instruction by using an analysis model to determine that the received SQL instruction is a potentially malicious instruction, in a case that the received SQL instruction is not determined to be a malicious instruction according to the SQL syntax tree rule. The method can combine the online detection and the offline analysis to intercept the invading malicious SQL commands, and can also find and supplement the loopholes of the rules through offline analysis.