IP Library Granted Patent US 9,519,774
Granted Patent B2
US 9,519,774 · App. 14/599,978 · Granted Dec 13, 2016

Systems and methods for SQL query constraint solving

Inventors: Kunal Anand (San Jose, CA); Joseph Rozner (Northridge, CA); Merritt Carl Vincent (Buena Park, CA); Stephen Weinberg (Los Angeles, CA)
Assignee: PREVOTY, INC.
G06F21/52G06F17/3051G06F17/30371G06F21/577G06F2221/033
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,519,774
App. No.
14/599,978
Granted
Dec 13, 2016
Kind
B2
Abstract

The present invention relates to systems and methods for analyzing SQL queries for constraint violations, which may indicate injection attacks. The systems and methods tokenize a SQL query to generate a token stream. Next, lexical nodes are generated by iterating over the token stream. Then, a parse tree can be constructed by iterating over the lexical nodes. The parse tree may be compared to a SQL schema and access configuration for a database in order to analyze the SQL query for constraint violations, including determining the number of queries in the parse tree, identifying invalid fields and table access, identifying invalid field type comparisons and pattern matches, and identifying early statement termination.

Claims (25)

1. A computerized method for analyzing SQL queries for constraint violations comprising:

tokenizing a SQL query to generate a token stream;

generating lexical nodes by iterating over the token stream to chunk into SQL commands, SQL functions and field/table identifiers;

constructing a parse tree by iterating over the lexical nodes;

analyzing, using a processor, the parse tree for constraint violations by comparing the parse tree to a SQL schema and access configuration for a database, wherein the analyzing includes identifying invalid fields and table access, wherein identifying invalid fields and table access comprises identifying parse tree identifiers for fields or tables that do not exist or for which access is restricted; and

performing risk mitigation for SQL queries that are likely harboring an SQL injection attack.

2. The method of claim 1 , wherein the analyzing includes determining the number of queries in the parse tree.

3. The method of claim 2 , further comprising at least one of identifying multiple SQL statements, delineating by a query separator, and identifying sub-queries.

4. The method of claim 1 , wherein the analyzing includes identifying invalid field type comparisons and pattern matches.

5. The method of claim 4 , wherein identifying invalid field type comparisons and pattern matches comprises identifying where the field input mismatches the SQL query function, or where field are compared by the SQL query which are restricted from being compared by the access configuration.

6. The method of claim 1 , wherein the analyzing includes identifying early statement termination.

7. The method of claim 1 , further comprising outputting a report of the analysis.

8. A system for analyzing SQL queries for constraint violations comprising:

a processor executing computer readable medium to:

tokenize a SQL query to generate a token stream;

generate lexical nodes by iterating over the token stream to chunk into SQL commands, SQL functions and field/table identifiers;

construct a parse tree by iterating over the lexical nodes;

analyze the parse tree for constraint violations by comparing the parse tree to a SQL schema and access configuration for a database, wherein the query constraint solver is further configured to identify invalid fields and table access, wherein identifying invalid fields and table access comprises identifying parse tree identifiers for fields or tables that do not exist or for which access is restricted; and

perform risk mitigation for SQL queries that are likely harboring an SQL injection attack.

9. The system of claim 8 , wherein the query constraint solver is further configured to determine the number of queries in the parse tree.

10. The system of claim 9 , the query constraint solver is further configured to identify multiple SQL statements, delineate by a query separator, and identify sub-queries.

11. The system of claim 8 , wherein the query constraint solver is further configured to identify invalid field type comparisons and pattern matches.

12. The system of claim 11 , wherein identifying invalid field type comparisons and pattern matches comprises identifying where the field input mismatches the SQL query function, or where field are compared by the SQL query which are restricted from being compared by the access configuration.

13. The system of claim 8 , wherein the query constraint solver is further configured to identify early statement termination.

14. The system of claim 8 , the query constraint solver is further configured to output a report of the analysis.

Assignments (7)
RELEASE OF FIRST LIEN SECURITY INTEREST IN INTELLECTUAL PROPERTY RECORDED AT R/F 048077/0753 Recorded Dec 1, 2023
From: BANK OF AMERICA, N.A., AS AGENT
To: PREVOTY, INC.
Reel/Frame 065744/0045 →
RELEASE OF SECOND LIEN SECURITY INTEREST IN INTELLECTUAL PROPERTY RECORDED AT R/F 048077/0795 Recorded Dec 1, 2023
From: GOLDMAN SACH BANK USA, AS AGENT
To: PREVOTY, INC.
Reel/Frame 065744/0067 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 2, 2022
From: PREVOTY, INC.
To: IMPERVA, INC.
Reel/Frame 059786/0372 →
CHANGE OF ASSIGNEE ADDRESS Recorded Feb 23, 2022
From: PREVOTY, INC.
To: PREVOTY, INC.
Reel/Frame 059353/0953 →
FIRST LIEN INTELLECTUAL PROPERTY SECURITY AGREEMENT Recorded Jan 15, 2019
From: PREVOTY, INC.
To: BANK OF AMERICA, N.A., AS COLLATERAL AGENT
Reel/Frame 048077/0753 →
SECOND LIEN INTELLECTUAL PROPERTY SECURITY AGREEMENT Recorded Jan 15, 2019
From: PREVOTY, INC.
To: GOLDMAN SACHS BANK USA, AS COLLATERAL AGENT
Reel/Frame 048077/0795 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 9, 2016
From: ANAND, KUNAL; ROZNER, JOSEPH; VINCENT, MERRITT CARL; WEINBERG, STEPHEN
To: PREVOTY, INC.
Reel/Frame 040273/0295 →
Continuity (2)
Provisional Application 61929474 · Jan 20, 2014
Related Publication 20150205951A1 · Jul 23, 2015