IP Library Granted Patent US 12,301,616
Granted Patent B2
US 12,301,616 · App. 17/572,460 · Granted May 13, 2025

Detecting malicious obfuscation in a SQL statement based on an effect and/or processed version thereof

Inventors: Michael Makhlevich (Haifa, IL); Andrey Karpovsky (Kiryat Motzkin, IL); Fady Naser El Deen (Daliyat El Carmel, IL)
Assignee: Microsoft Technology Licensing, LLC
H04L63/1466G06F40/205
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 12,301,616
App. No.
17/572,460
Granted
May 13, 2025
Kind
B2
Abstract

Techniques are described herein that are capable of detecting malicious obfuscation in a SQL statement based at least in part on an effect and/or processed version of the SQL statement. In a first example, a raw version of a SQL statement is compared to a processed version of the SQL statement. A determination is made that a command in the processed version is not included in the raw version. The raw version is detected to be malicious based at least in part on the determination. In a second example, a SQL statement is bound to an event that results from execution of the SQL statement. Textual content of the SQL statement and an effect of the event are compared. The SQL statement is detected to be malicious based at least in part on the effect of the event not being indicated by the textual content.

Claims (58)

1. A computing system comprising:

a memory that stores an operating system; and

a processing system coupled to the memory, the processing system configured to execute the operating system, the operating system configured to, when executed, perform the following:

compare a raw version of a structured query language (SQL) statement to a processed version of the SQL statement that results from parsing of the raw version of the SQL statement, wherein the raw version of the SQL statement and the processed version of the SQL statement are configured to produce a common result;

determine that a command that is comprised in the processed version of the SQL statement is obfuscated in the raw version of the SQL statement;

detect that the raw version of the SQL statement is malicious based at least on the command that is comprised in the processed version of the SQL statement being obfuscated in the raw version of the SQL statement; and

as a result of detecting that the raw version of the SQL statement is malicious, prevent execution of the SQL statement.

2. The computing system of claim 1 , wherein the raw version of the SQL statement formats a binary array that defines the SQL statement using a first format, and

wherein the processed version of the SQL statement formats the binary array using a second format that is different from the first format.

3. The computing system of claim 1 , wherein the operating system is configured to, when executed, perform the following:

determine whether the command that is comprised in the processed version of the SQL statement is comprised in a pre-defined list of commands that are known to have been used for malicious activity; and

detect that the raw version of the SQL statement is malicious further based at least on the command that is comprised in the processed version of the SQL statement being comprised in the pre-defined list of commands that are known to have been used for malicious activity.

4. The computing system of claim 1 , wherein the operating system is configured to, when executed, perform the following:

determine that the command, which is configured to connect to a website hosted by a computer that is external to the computing system, is obfuscated in the raw version of the SQL statement.

5. The computing system of claim 1 , wherein the operating system is configured to, when executed, perform the following:

determine that the command, which is configured to connect to a device having an IP address that is different from an IP address of the computing system, is obfuscated in the raw version of the SQL statement.

6. The computing system of claim 1 , wherein the operating system is configured to, when executed, perform the following:

determine that the command, which is configured to change a configuration setting of a computer, is obfuscated in the raw version of the SQL statement.

7. The computing system of claim 1 , wherein the operating system is configured to, when executed, perform the following:

determine that the command, which is configured to communicate with an operating system that executes on a computer, is obfuscated in the raw version of the SQL statement.

8. The computing system of claim 1 , wherein the operating system is configured to, when executed, perform the following:

determine that the command, which is configured to communicate with a network, is obfuscated in the raw version of the SQL statement.

9. The computing system of claim 1 , wherein the raw version of the SQL statement utilizes string concatenation in which a plurality of parts of a string, which defines at least a portion of a command, are concatenated using a concatenation operator to form the string.

10. The computing system of claim 1 , wherein the raw version of the SQL statement utilizes type casting in which a type of at least a portion of a command is changed from a first data type to a second data type that is different from the first data type.

11. A method, which is implemented by a computing system, comprising:

comparing a raw version of a structured query language (SQL) statement to a processed version of the SQL statement that results from parsing of the raw version of the SQL statement, wherein the raw version of the SQL statement and the processed version of the SQL statement are configured to produce a common result;

determining that a command that is comprised in the processed version of the SQL statement is obfuscated in the raw version of the SQL statement;

detecting that the raw version of the SQL statement is malicious based at least on the command that is comprised in the processed version of the SQL statement being obfuscated in the raw version of the SQL statement; and

as a result of detecting that the raw version of the SQL statement is malicious, execute an instruction, which prevents execution of the SQL statement.

12. The method of claim 11 , wherein a series of bits that defines the SQL statement is common among the raw version of the SQL statement and the processed version of the SQL statement; and

wherein the method further comprises:

defining the raw version of the SQL statement by interpreting the series of bits in a first manner; and

defining the processed version of the SQL statement by interpreting the series of bits in a second manner, which is different from the first manner.

13. The method of claim 12 , further comprising:

removing obfuscation of the command, which is obfuscated in the raw version of the SQL statement, to generate the processed version of the SQL statement, which causes the command to be comprised in the processed version of the SQL statement.

14. The method of claim 11 , wherein the raw version of the SQL statement formats a binary array that defines the SQL statement using a first format, and

wherein the processed version of the SQL statement formats the binary array using a second format that is different from the first format.

15. The method of claim 14 , wherein the SQL statement is written in accordance with the first format, and the SQL statement is read in accordance with the second format.

16. The method of claim 11 , further comprising:

determining whether the command that is comprised in the processed version of the SQL statement is comprised in a pre-defined list of commands that are known to have been used for malicious activity;

wherein detecting that the raw version of the SQL statement is malicious comprises:

detecting that the raw version of the SQL statement is malicious further based at least on the command that is comprised in the processed version of the SQL statement being comprised in the pre-defined list of commands that are known to have been used for malicious activity.

17. The method of claim 11 , wherein the command is configured to perform at least one of the following operations:

connect to a website hosted by a first computer that is external to the computing system;

connect to a device having an IP address that is different from an IP address of the computing system;

change a configuration setting of a second computer;

communicate with an operating system that executes on the second computer; or

communicate with a network.

18. The method of claim 11 , wherein the raw version of the SQL statement utilizes:

string concatenation in which a plurality of parts of a string, which defines at least a portion of a command, are concatenated using a concatenation operator to form the string; and

type casting in which a type of at least the portion of the command is changed from a first data type to a second data type that is different from the first data type.

19. The method of claim 11 , wherein detecting that the raw version of the SQL statement is malicious comprises:

detecting that the raw version of the SQL statement is malicious in absence of re-parsing the raw version of the SQL statement.

20. A computer program product comprising a computer-readable storage medium having instructions recorded thereon for enabling a processor-based system to perform operations, the operations comprising:

comparing a raw version of a structured query language (SQL) statement to a processed version of the SQL statement that results from parsing of the raw version of the SQL statement, wherein the raw version of the SQL statement and the processed version of the SQL statement are configured to produce a common result;

determining that a command that is comprised in the processed version of the SQL statement is obfuscated in the raw version of the SQL statement;

detecting that the raw version of the SQL statement is malicious based at least on the command that is comprised in the processed version of the SQL statement being obfuscated in the raw version of the SQL statement; and

as a result of detecting that the raw version of the SQL statement is malicious, performing a remedial operation, which comprises preventing execution of the SQL statement.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 10, 2022
From: MAKHLEVICH, MICHAEL; KARPOVSKY, ANDREY; NASER EL DEEN, FADY
To: MICROSOFT TECHNOLOGY LICENSING, LLC
Reel/Frame 058611/0835 →
Continuity (1)
Related Publication 20230224323A1 · Jul 13, 2023
References Cited (26)
US 8010522B2 · Dewey · 2011 [cited by examiner]
US 8225402B1 · Averbuch et al. · 2012 [cited by applicant]
US 11354306B2 · Wilding · 2022 [cited by applicant]
US 11824894B2 · Simioni · 2023 [cited by applicant]
US 20070192474A1 · Decasper · 2007 [cited by examiner]
US 20090119777A1 · Jeon · 2009 [cited by applicant]
US 20090150374A1 · Dewey · 2009 [cited by applicant]
US 20150156209A1 · Heart · 2015 [cited by examiner]
US 20170220798A1 · Madou et al. · 2017 [cited by applicant]
US 20180278647A1 · Gabaev · 2018 [cited by examiner]
US 20190297056A1 · Chiang · 2019 [cited by examiner]
US 20200097587A1 · Klein · 2020 [cited by examiner]
US 20200404007A1 · Singh et al. · 2020 [cited by applicant]
US 20210203676A1 · Pendse · 2021 [cited by examiner]
US 20210357409A1 · Rodriguez · 2021 [cited by applicant]
US 20220004630A1 · Almukaynizi · 2022 [cited by applicant]
US 20220166795A1 · Simioni · 2022 [cited by applicant]
CN 110427754A · 2019 [cited by applicant]
WO WO2014152079A1 · 2014 [cited by examiner]
“International Search Report and Written Opinion Issued in PCT Application No. PCT/US22/052487”, Mailed Date: Jun. 20, 2023, 15 Pages. [cited by applicant]
Buehrer, et al., “Using parse tree validation to prevent SQL injection attacks”, In Proceedings of the 5th international workshop on Software engineering and middleware, Sep. 5, 2005, pp. 106-113. [cited by applicant]
“International Search Report and Written Opinion Issued in PCT Application No. PCT/US22/052188”, Mailed Date: Apr. 5, 2023, 11 Pages. [cited by applicant]
“Invitation to Pay Additional Fees Issued in PCT Application No. PCT/US22/052487”, Mailed Date: Apr. 28, 2023, 8 Pages. [cited by applicant]
“Application as Filed in U.S. Appl. No. 17/565,155”, filed Dec. 29, 2021, 36 Pages. [cited by applicant]
Non-Final Office Action mailed on Dec. 29, 2023, in U.S. Appl. No. 17/565,155, 14 pages. [cited by applicant]
Notice of Allowance mailed on Jun. 24, 2024, in U.S. Appl. No. 17/565,155, 11 pages. [cited by applicant]