Azure Sentinel SQL Solution Query Deep-Dive

Published Aug 09 2021 09:00 AM 4,016 Views
Microsoft

by @TomMcElroy & Andrey Karpovsky
Thanks to: Tamer Salman, Moshe Israel, Hani Neuvirth-Telem & Yoav Daniely

 

In May 2021 Azure Sentinel saw the launch of Azure Sentinel Solutions into public preview. This launch provided Azure Sentinel preview customers with access to over 32 solutions spanning Microsoft and other vendor data sources.

 

As part of this release Azure Defender and Microsoft Threat Intelligence Center (MSTIC) collaborated to contribute Detections and Hunting queries to the Azure Sentinel for Azure SQL solution. These detection and hunting queries are based on real world attack scenarios and provide a basis for detecting and investigating potential SQL exploitation attacks.

 

In this tech community post we will cover each of the Detection and Hunting queries included in the Azure Sentinel SQL solution. This post will cover what malicious activity these queries are designed to uncover, how to tailor them for your environment using their configurable parameters and provide some insight into how the query works.

 

Whilst the detection and hunting queries discussed in this Tech Community post will focus on Azure SQL, many of the techniques can be adapted to work with any relational database management system (RDMS).

 

More information on where to find Solutions within Azure Sentinel can be found here. Within the solutions tab search for “Azure Sentinel for Azure SQL” to install the SQL solution.

 

Common SQL Anomalies Indicating Compromise

For those unfamiliar with potentially malicious SQL activity, this section will briefly cover the different types of unusual activity that the detection and hunting queries are designed to detect. If you are already familiar with malicious SQL activity you may wish to skip straight to the queries.

 

Unsecured Databases

Databases that are improperly secured and exposed to the open internet will almost certainly see exploitation attempts. The MSTIC sensor network is a collection of deception services that collect data on active internet exploitation. In 2020 the MSTIC sensor network observed over 300,000 SQL code execution attempts targeted at our honeypot network. These were attempts where an SQL query was sent to the server with the intent of executing an unauthorised command.

 

Unpatched vulnerable server software, weak passwords, and exposed administrative interfaces are all common vectors for attackers conducting mass scanning and exploitation operations.

 

Azure hosted SQL servers benefit from some default protections. New SQL servers will be firewalled from the open internet and can only communicate with other Azure services. Firewall settings in Azure allow you to configure your server to only allow connections from specific IP addresses or ranges.

 

SQL Injection

SQLi is a code injection technique where an attacker sends crafted query statements to an SQL server, these statements are crafted to exploit poorly implemented program logic. If successful commands sent by the attacker may allow data to be extracted from the database, existing records to be modified or new records created.

 

SQL injection vulnerabilities are introduced when user-controllable input is improperly sanitised, or input sanitisation is circumvented by the attacker. SQL injection vulnerabilities may be found in any application that interacts with an SQL server, most commonly these are web applications.

 

As the vulnerable application processes and executes the command on behalf of the attacker, any commands that are injected successfully into a web application are executed from the IP address where the vulnerable application is hosted. Successful SQLi can be used to bypass IP restrictions enforced using Firewalls and make attacks harder to investigate.

 

 Threat actor injects SQL code into a vulnerable page, providing access to the underlying SQL database.Threat actor injects SQL code into a vulnerable page, providing access to the underlying SQL database.

 

SQLi can be performed with or without knowledge of the underlying database structure, when queries are sent to the server without knowledge of the underlying database structure these are commonly referred to as being “blind”. Blind SQLi is generally used to determine if the application is vulnerable, the two most common techniques are Boolean based and Timing based blind SQL injection attacks.

 

Boolean based Blind SQLi

Boolean based blind SQLi is a reconnaissance technique which uses Boolean statements, returning a True or False result, to determine if the code is being executed by the SQL server after injection into a vulnerable parameter. The attacker will view the page using standard parameters and then inject code to force a true or false result. They will then look for differences in the returned result to determine if their injection was successful.

 

In the below example, the attacker may inject some SQL into the “id” parameter of the members page, in the first instance providing and statement that will return a false:

 

http://contoso.com/member.php?id=1 and 1=2

 

This will cause the page to believe that the member ID requested doesn’t exist. While the member with an ID of 1 exists the second part of the statement will return false. The attacker will then inject SQL that will return a true:

 

http://contoso.com/member.php?id=1 and 1=1

 

By looking for differences in the response the attacker can determine the page is vulnerable. In the example above, when the first request is sent the page returns an error stating the member was not found. In the second request the attacker forces a true result, and therefore the page returns a successful lookup. If the attacker’s injection were not working, or the injected SQL was being filtered out, the page would behave normally, returning member information for member ID 1 in both instances.

 

Time-based blind SQLi

Time based blind SQL injection uses SQL sleep functions to force the query to wait for a pre-determined amount of time. Like with Boolean blind SQL injection it relies on the attacker first baselining the vulnerable pages behaviour and then injecting crafted requests to force unusual execution times.

 

An attacker may visit the page with normal parameters, and note that the base executes in 88 milliseconds.

 

http://contoso.com/member.php?id=1

 

The attacker may then append the SQL Server WAITFOR DELAY command, forcing the query to wait for 5 seconds if executed.

 

http://contoso.com/member.php?id=1; WAITFOR DELAY '00:00:05'

 

The attacker will know if the injection is successful if the page which previous took 88 milliseconds to execute now takes over 5 seconds to execute.

 

This technique can be detected by analysing logs or web requests for the presence of WAITFOR commands, however there are many techniques to obfuscate the injected command, allowing the attacker to bypass static keyword detection.

 

Data Extraction & Manipulation

The end goal for most attackers targeting SQL servers is to extract data or delete/damage that data. SQL databases often contain sensitive information that can be attractive to both criminal or nation-state actors. Extraction of sensitive user information may provide a nation-state threat group with information to further exploit the network or may be of intelligence value alone. Organised crime groups may seek to sell the data onwards or encrypted/destroy the data as part of a ransomware campaign.

 

Detection Queries

This section will cover detection queries in detail. These are queries that are designed to be used as alerts on potential malicious attempts to access and exploit the resources. Detection queries expose several parameters that can be easily tuned to control the accuracy and quantity of detections. Detections look for suspicious events inside recent time window, which are anomalous based on behavior that was learned in the preceding training window. In addition, these queries can be used as templates for other security scenarios.

 

Each detection query is built on top of a standard normalisation, using the following Kusto query to process SQL log data. For brevity, each individual query will not include this normalisation step.  Complete queries can be found within the Azure Sentinel SQL solution.

 

let timeSliceSize = 1h;
let timeRange = 14d;
let processedData = materialize (
      AzureDiagnostics
      | where TimeGenerated > ago(timeRange)
      | where Category == 'SQLSecurityAuditEvents' and action_id_s has_any ("RCM", "BCM") // Keep only SQL affected rows
      | project TimeGenerated, PrincipalName = server_principal_name_s
, ClientIp = client_ip_s, HostName = host_name_s, ResourceId
, ApplicationName = application_name_s, ActionName = action_name_s
, Database = strcat(LogicalServerName_s, '/', database_name_s)
, IsSuccess = succeeded_s, DurationMs = duration_milliseconds_d
, AffectedRows = affected_rows_d,ResponseRows = response_rows_d
, Statement = statement_s
, Error = case( additional_information_s has 'error_code', toint(extract("<error_code>([0-9.]+)", 1, additional_information_s))
                        , additional_information_s has 'failure_reason', toint(extract("<failure_reason>Err ([0-9.]+)", 1, additional_information_s))
                        , 0)
, State = case( additional_information_s has 'error_state', toint(extract("<error_state>([0-9.]+)", 1, additional_information_s))
                        , additional_information_s has 'failure_reason', toint(extract("<failure_reason>Err ([0-9.]+), Level ([0-9.]+)", 2, additional_information_s))
                        , 0),
      AdditionalInfo = additional_information_s, timeSlice = floor(TimeGenerated, timeSliceSize))
       | extend RowNumber = row_number(),                             WindowType = case( TimeGenerated >= ago(detectionWindow), 'detection',                                               (ago(trainingWindow) <= TimeGenerated and TimeGenerated < ago(detectionWindow)), 'training', 'other')
;

 

Detection queries can be divided into 3 broad categories by similar logic and content.

 

Detections for volumetric spikes

These detections monitor a single numeric variable and look for significant upward spikes, that are anomalous when compared to normal behaviour of the same variable on that resource in the training period. For example, if a malicious actor attempts to extract all the records in a database, it will be detected.

 

Currently 2 detections of these types are included, looking for different numeric columns (and security scenarios):

  1. VolumeAffectedRowsStatefulAnomalyOnDatabase: Monitors the ‘AffectedRows’ metric, which reflects changes made in the database. Upward spikes indicate that too many data rows were changed, which might indicate potential attempts to destroy data or make it temporary unusable.
  2. VolumeResponseRowsStatefulAnomalyOnDatabase: Monitors the ’ResponseRows’ metric, that reflects exfiltration from the database. Spikes indicate that too many data rows were extracted, which might indicate potential data theft.

 

The queries share several parameters that control the query logic and are exposed for easy control.

  • monitoredColumn (values: ‘ResponseRows’, ‘AffectedRows’): Name of the volumetric variable column that is analyzed in the query.
  • volumeThresholdZ (default value: 3.0): Minimal threshold for relative anomaly score (zScore), which represents the number of standard deviations that the value is above the average. For higher values, the alerts will be triggered only by very significant anomalies. For example, values of 1500 and 900 will both trigger alerts in case of volumeThresholdZ = 3.0, but only 1500 will trigger alert for volumeThresholdZ = 5.0.
  • volumeThresholdQ (default value: volumeThresholdZ): Minimal threshold for absolute anomaly score (qScore), which represents the number of median ranges that the value is above the 99th percentile. For higher values, the alerts will be triggered only by very significant anomalies.
  • volumeThresholdHardcoded (default value: 500): Minimal threshold for actual value of the monitored column that will trigger the alert. For example, in case of default value, only values above it will trigger alerts (in case the other thresholds are passed as well).
  • detectionWindow (default value: 1h): Size of the recent time window (back from current time). Events in this window will be analyzed for anomalies, and anomalies that are significant (based on thresholds) will appear in the output.
  • trainingWindow: (default value: detectionWindow + 14d): Window size before the detection window that is used to calculate the metrics for normal behaviour. Events in detection window will be compared with these metrics.

The standardized data is split to 2 datasets. Training window is a relatively long period of time (14 to 30 days are recommended) which precedes the detection window and is used to learn the normal and expected behaviour on the resource. Basic measures of central tendency (average and median) and dispersion (standard deviation and inter-percentile range) are calculated to model this behaviour.

 

trainingSet = processedData        
| where WindowType == 'training'        
| summarize AvgVal = round(avg(QuantityColumn), 2)
, StdVal = round(stdev(QuantityColumn), 2), N = max(RowNumber)
, P99Val = round(percentile(QuantityColumn, 99), 2)
, P50Val = round(percentile(QuantityColumn, 50), 2)          
by Database;

 

The detection window is relatively short period (1 to 24 hours are advised) and is used to monitor recent values of the metric. If a recent value is significantly higher than the chosen thresholds, an alert is triggered. By lowering the thresholds, the user can allow for more (less-significant) alerts to be raised.

 

processedData    
| where WindowType == 'detection'  
| join kind = inner (trainingSet) on Database  
| extend ZScoreVal = iff(N >= 20, round(todouble(QuantityColumn - AvgVal) / todouble(StdVal + 1), 2), 0.00)
, QScoreVal = iff(N >= 20, round(todouble(QuantityColumn - P99Val) / todouble(P99Val - P50Val + 1), 2), 0.00)
| extend IsVolumeAnomalyOnVal = iff((ZScoreVal > volumeThresholdZ and QScoreVal > volumeThresholdQ and QuantityColumn > volumeThresholdHardcoded), true, false), AnomalyScore = round((ZScoreVal + QScoreVal)/2, 0)    
| project TimeGenerated, Database, PrincipalName, ClientIp, HostName, ApplicationName, ActionName, Statement, IsSuccess, ResponseRows, AffectedRows, IsVolumeAnomalyOnVal, AnomalyScore  
| where IsVolumeAnomalyOnVal == 'true'
| sort by AnomalyScore desc, TimeGenerated desc

 

The output of the query contains a list of events in detection window that were flagged as anomalous (IsVolumeAnomalyOnVal = ‘true’) by the detection query with the defined parameters, together with AnomalyScore field. Higher AnomalyScore values represent the significance of the anomaly (higher values represent events that are more anomalous).

 

Detections for Monitored Errors

These detections look for statements or login attempts that fail with specific errors, which might indicate malicious attempts to access or exploit the database. For example, login failures on firewall blocks or credential errors might indicate a malicious attempt to gain access to the database. In some environments, specific errors are expected.  To prevent noise in these cases, minimal thresholds for events that trigger the alerts are exposed and can be adapted to raise alert on any relevant event, or only when specific count is reached.

Currently, 3 detections of this type are included, looking for different errors (and security scenarios):

 

  1. ErrorsFirewallStatefulAnomalyOnDatabase: Looks for login attempts that are blocked by existing firewall rules (error 40615). Such events might indicate that unauthorized actor unsuccessfully tried to gain access to the database. This alert is interesting since it can help preventing further attacks on the same target (e.g. coming from a different source).
  2. ErrorsCredentialStatefulAnomalyOnDatabase: Looks for login attempts that failed due to incorrect credentials (error 18456). Such events might indicate that unauthorized actor tried to gain access to the database but didn’t have the correct credential combination. The attempts might continue with different credential sets (Brute Force).
  3. ErrorsSyntaxStatefulAnomalyOnDatabase: Attempts to execute queries that failed on syntax mistakes (errors 102 and 105). The attacker may be unfamiliar with the structure and content of the resource. In such a case, the malicious queries may be malformed (e.g. in case of SQLi) or contains unsupported scripting attempts and will fail on syntax errors.

 

The queries share the following parameters:

  • detectionWindow (default value: 1h): size of the recent time window (as described above)
  • trainingWindow: (default value: detectionWindow + 14d): training window size before the detection window (as described above).
  • timeSliceSize (default value: 1h): size of slices into which the data is divided. The number of suspicious failed attempts is calculated per each slice.
  • monitoredStatementsThreshold (default value: 1): the minimal threshold for monitored failed attempts per slice to be flagged as suspicious. For example, if some amount of credential failures is expected due to human error, this number can be set to 10. In this case, only if 10 or more failures are seen in the slice, alert can be triggered.
  • trainingSlicesThreshold (default value: 5): the maximal threshold for the number of flagged slices (based on the previous parameters) in the training window. If the number of such slices is above the threshold, the behaviour is considered normal, and no alert will be triggered for the current slice on similar event. If the number is set high (e.g. 1000), all slices with monitored attempts will trigger alerts. If the number is set to 0, alert will be triggered only on first event of the kind.
  • monitoredErrors (values: (40615) Firewall block failures, (18456) Credential failure errors, (102, 105) Syntax errors): SQL error codes that are monitored for the scenario.

 

This detection looks for logins or queries that fail with monitored error codes. Within the training window each time slice (e.g. an hour, as defined by respective parameter) that has above certain value (monitoredStatementsThreshold parameter) of errors is flagged. For example, we can count each slice that has more than 5 errors.

 

let trainingSet = processedData
| where WindowType == 'training'
| summarize countSlicesWithErrors = dcountif(timeSlice, countStatementsWithError >= monitoredStatementsThreshold) by Database;
processedData
| where WindowType == 'detection' 
| join kind = inner (trainingSet) on Database
| extend IsErrorAnomalyOnStatement = iff(((countStatementsWithError >= monitoredStatementsThreshold) and (countSlicesWithErrors <= trainingSlicesThreshold)), true, false), anomalyScore = round(countStatementsWithError/monitoredStatementsThreshold, 0)
| where IsErrorAnomalyOnStatement == 'true'
| sort by anomalyScore desc, timeSlice desc

 

The alert is triggered if the detection window contains events with monitored error code, whilst the number of flagged slices within training window is below threshold (trainingSlicesThreshold parameter). The latter logic helps control the number of alerts, especially in environments where such behavior is expected and common.

The output of the query contains a list of events in detection window that were flagged as anomalous and the AnomalyScore, as described above.

 

The output of the query contains a list of events in detection window that were flagged as anomalous (IsVolumeAnomalyOnVal = ‘true’) by the detection query with the defined parameters, together with AnomalyScore field. Higher AnomalyScore values represent the significance of the anomaly (higher values represent events that are more anomalous).

 

Detections for Monitored "Hot Words"

These detections look for statements that include hot words that might indicate attempts to execute malicious code. For example, shell commands (e.g. using the ‘xp_cmdshell’ procedure) can be used to run malicious scripts. These attempts might be successful or blocked, depending on SQL version and settings.

 

Currently, 5 detections of this type are included, covering different scenarios:

 

  1. HotwordsDropStatefulAnomalyOnDatabase: Looks for statements that drop resources (tables or databases). This might indicate that a malicious actor attempts to delete valuable data and disrupt business activity.
  2. HotwordsExecutionStatefulAnomalyOnDatabase: Looks for attempts to run shell commands or scripts via SQL. This could indicate an attempt to download malware, run malicious processes (e.g. mining). Even if shell execution is disabled, this might indicate that a malicious agent gained access to SQL server and makes blind attempts.
  3. HotwordsFirewallRuleStatefulAnomalyOnDatabase: Looks for attempts to change or delete firewall rules. Since tight firewall rules hinder potential attacks, malicious user might change them in order to pave the way for persistent attacks in the future.
  4. HotwordsOLEObjectStatefulAnomalyOnDatabase: Looks for attempts to create or use OLE objects, which can be used as part of persistent attack scenario.
  5. HotwordsOutgoingStatefulAnomalyOnDatabase: Looks for attempts to access external websites or resources. These might be used in attack scenarios to download malware or contact command and control centers during the attack.

The queries share the following parameters:

 

  • detectionWindow (default value: 1h): size of the recent time window (as described above)
  • trainingWindow: (default value: detectionWindow + 14d): training window size before the detection window (as described above).
  • timeSliceSize (default value: 1h): size of slices into which the data is divided (as described above).
  • MonitoredStatementsThreshold (default value: 1): the minimal threshold for statements with monitored hot words per slice to be flagged as suspicious (as described above).
  • trainingSlicesThreshold (default value: 5): the maximal threshold for the number of flagged slices  in the training window (as described above).
  • Hot words:
    • ('drop table', 'drop database’): Dropping tables or databases
    • ('xp_cmdshell', 'ps.exe', 'powershell', 'cmd.exe', 'msiexec', '<script>’): Shell command executions
    • ('http:', 'https:', 'ftp:', 'onion.pet’): Outgoing connections to external websites
    • ('sp_set_firewall_rule', 'sp_set_database_firewall_rule', 'sp_delete_database_firewall_rule', 'sp_delete_firewall_rule', 'sys.firewall_rules', 'sys.database_firewall_rules’): Firewall rule tampering
    • ('sp_oamethod', 'sp_oacreate', 'sp_oasetproperty’): OLE object manipulation

 

The detection logic is like the monitored errors detection. Time slices containing monitored hot words in the training window are flagged. When the detection window contains such words but the number of flagged slices in training period is below threshold, an alert is triggered.

 

Hunting Queries

Hunting queries are designed for use in active threat hunts. Most threat hunting queries will require some amount of manual tuning, but this allows threat hunters to detect activity that may fall below detection baselines. 

 

These hunting queries will focus on exploring the abuse of applications that communicate directly with SQL like web applications, management software and accounting software. Focussing on application activity allows us to establish predicable patterns of interaction with the database. These predictable behaviours will provide loose baselines for our hunting queries.

 

We can roughly identify SQL applications by grouping using the ApplicationName and PrincipalName columns. This will provide combinations of applications with associated accounts, roughly mapping to each application in use.

 

Each hunting query is built on top of a standard normalisation described above. For brevity each individual query will not include this normalisation step, however complete queries can be found within the Azure Sentinel SQL solution.

 

Affected Row Anomaly

Azure for SQL diagnostic logging provide us with the column affected_rows_d. This column contains a count of the rows that were impacted by the SQL query.

 

In a real-world scenario, the attacker may attempt to dump the database schema, drop the table, or overwrite data in the database. Each of these commands would result in the query that was exploits returning an unusually high number of rows when compared to normal database operation.

 

Using our processed data, we can create a simple query which calculates the total number of operations for a given SQL application and then calculate the prevalence for each query executed. We can then tune to query to return only queries that represent the top 1% of affected row counts.

 

let threshold = 1;
let totals = processedData
| summarize count() by PrincipalName, ApplicationName
| extend joinKey = strcat(PrincipalName, ApplicationName)
| project joinKey, count_;
processedData
//Count the total number of times each number of rows was accessed
| summarize count() by AffectedRows, PrincipalName, ApplicationName
| extend joinKey = strcat(PrincipalName, ApplicationName)
| join kind=leftouter (
  totals
) on joinKey
| extend prevalence = round(toreal(count_) / toreal(count_1) * 100, 2)
| where prevalence <= threshold

 

By using affected row prevalence, the query can detect not only outliers from normal operation with a high number of affected rows, but also outliers with low affected row counts. An abnormally low number of affected rows may be indicative of manual SQL injection or SQL reconnaissance activity.

 

Execution Time Anomaly

As explored earlier, time-based SQLi is a reconnaissance technique that uses SQL commands to purposely delay execution. It is also common for SQLi attacks to result in longer execution times than normal, this is because the attack may introduce additional processing.

 

This hunting query uses the Kusto series_decompose_anomalies function to detect queries that are executed in an anomalous amount of time. The following Kusto is used to prepare the processed data so that series_decompose_anomalies can be executed across it.

 

First, the query will summarise all SQL query operations by each user into 1-hour bins. The query will then summarise the average duration of the query grouping on user and application to provide a list of query durations.

 

processedData
//Bin the data into 1h windows, taking the average of exeuction time
| summarize round(avg(DurationMs), 2), min(TimeGenerated), max(TimeGenerated) by PrincipalName, ApplicationName, bin(TimeGenerated, timeSliceSize)
//Summarise by user and application and create list ready for anomaly detection
| summarize make_list(avg_DurationMs), make_list(min_TimeGenerated), make_list(max_TimeGenerated) by PrincipalName, ApplicationName

 

With the data prepared, series_decompose_anomalies can be applied to the list of durations to detect outliers. This will identify hours where the average query duration increases, providing us with periods of time where possible time based SQLi could have occurred.

 

| extend series_decompose_anomalies(list_avg_DurationMs, scoreThreshold, -1, 'linefit')

 

Finally, the query will expand the results of series_decompose_anomalies and re-join them with the original query.

 

| mv-expand TimeAnomaly=series_decompose_anomalies_list_avg_DurationMs_ad_flag, WindowStart=list_min_TimeGenerated, WindowEnd=list_max_TimeGenerated
| project WindowStart, WindowEnd, PrincipalName, ApplicationName, TimeAnomaly
| where TimeAnomaly == 1 
//Split the query here to see raw anomaly results
//The next section will re-join back to the SQL diagnostics data to 
//display the queries executed within the anomalous windows identified
| extend joinKey = strcat(PrincipalName, ApplicationName)
| join kind=leftouter (
    processedData
    | project ApplicationName, PrincipalName, Statement, TimeGenerated, DurationMs
    | extend joinKey = strcat(PrincipalName, ApplicationName)
) on joinKey
| where TimeGenerated between (todatetime(WindowStart) .. todatetime(WindowEnd))
| project TimeGenerated, TimeAnomaly, WindowStart, WindowEnd, PrincipalName, ApplicationName, Statement, DurationMs, ResourceId, ClientIp, HostName
| order by DurationMs desc

 

The resolution and the anomaly decompose threshold can both be configured. The anomaly threshold allows you to control how strong the anomaly must be before a result is returned, increasing this value will effectively make the query less sensitive to minor fluctuations.

 

Boolean Blind SQLi

As covered earlier in the post, Boolean blind SQLi is one of the most common SQL injection reconnaissance techniques and is often used by automated database takeover tools.

 

This hunting query will process the SQL statement to extract both sides of a Boolean expression. The query will first identify SQL statements with an “=” are part of their structure. A regular expression is then used to extract either side of the “=”, the result of this is stored as the right and left side of the query.

 

let queryData = processedData
| where Statement contains "="
| extend extract_equals = extract_all(@"([a-zA-Z0-9\-\']+\s?=\s?[a-zA-Z0-9\-\']+)", Statement)
| where isnotempty(extract_equals)
| mv-expand extract_equals
| extend left = tostring(split(extract_equals, "=", 0)[0])
| extend right = tostring(split(extract_equals, "=", 1)[0]);

 

We then need to separate instances where the left and right side of the statement is wrapped in quotation marks, using a regular expression to handle parsing the correct portion of the statement.

 

let cleanData = queryData
| where left !has "'" and right !has "'";
//Data has a quote in both sides, we need to parse this properly
//We only care when the query is balanced e.g. '1'='1', so both sides will have a quote
//This allows us to drop some results early
let quoteData = queryData
| where left has "'" and right has "'"
| extend extract_equals = extract_all(@"(\'.+\'\s?=\s?\'.+\')", Statement)
| extend left = tostring(split(extract_equals, "=", 0)[0])
| extend right = tostring(split(extract_equals, "=", 1)[0]);

 

Finally, after processing, we can check to see if the SQL statement contained a balanced parameter by comparing the right and left side of the “=”.

 

cleanData
| union quoteData
| where left == right
| extend alertText = strcat(left, "=", right)
| summarize AlertText=make_list(alertText) by TimeGenerated, Database, ClientIp, PrincipalName, Statement, ApplicationName, ResourceId

 

 

Prevalence Based Query Size Anomaly

SQL injection will usually result in more parameters being added into the query. It is normal not possible for the attacker to remove existing parameters which are used by the legitimate page that is being exploited. As parameters will be appended to an existing query, it’s possible to baseline and then detect unusual numbers of parameters for a given user and application combination.

 

This query uses a prevalence calculation to identify queries that have an unusual number of parameters for a given application and user. First the number of queries for each user and application group is calculated, this is stored as the total count of the overall prevalence of each query size can be calculated later.

 

let total = processedData
| summarize count() by PrincipalName, ApplicationName
| extend key = strcat(PrincipalName, ApplicationName);

 

Next, the query splits the query up using “=” and a space as delimiters. Roughly each “=” indicates an SQL parameter whilst each space represents a new token, or query component. The query will then summarise to count the number of tokens based on the username, application, and number of tokens. This provides us with counts for each unique number of tokens based on the username and password.

 

let anomalyData = processedData
//Splitting on "=" provides a good estimate to the parameters
| extend parameters = countof(Statement, "=")
//Splitting on space provides a good estimate to the tokens in the query
| extend tokens = array_length(split(Statement, " "))
| summarize count(), make_set(parameters), make_list(TimeGenerated), make_list(ClientIp), dcount(ClientIp), min(TimeGenerated), max(TimeGenerated), make_list(Statement) by tokens, PrincipalName, ApplicationName

 

Now that we have the total number of queries executed by each username and application, we can calculate the prevalence for each number of tokens observed. If that number of tokens represents less than 10% of the total queries executed, a row will be returned.

 

| extend key = strcat(PrincipalName, ApplicationName)
| join kind=leftouter (total) on key
| extend prevalence = toreal(count_) / toreal(count_1) * 100
| where prevalence <= prevalenceThreshold

 

SQL applications, especially those that have pre-defined database interactions, generally produce consistent outcomes this query can help to flag anomalies where an unusual number of tokens were observed. There are limitations to this hunting query, if the attacker uses the same number of tokens as a legitimate function, no result will be returned. This query also needs application behaviour to be predictable and is most effective with applications such as content management systems and other web applications.

 

The query that is bundled as part of the SQL solution also allows additional filtering; this includes the ability to detect anomalies that only occurred on a single day.

 

Time Based Query Size Anomaly

This hunting query uses a similar mechanism to the Prevalence based query size anomaly, however, instead of using prevalence to detect outliers, this query uses series_decompose_anomalies to detect spikes in the number of parameters or token for a given day of the week.

First the query needs to prepare data for the series_decompose_anomalies function. Data is summarized into 1-day bins whilst calculating the average number of tokens and parameters for that window. The data is then summarized using the username an application name to create lists of token and parameter averages.

 

processedData
//Splitting on "=" provides a good estimate to the number of parameters in the query
| extend parameters = countof(Statement, "=")
//Splitting on space provides a good estimate to the tokens in the query
| extend tokens = array_length(split(Statement, " "))
//Bin the data into 1 day windows, taking the average of tokens and parameters for that user and application during the period
| summarize round(avg(tokens), 2), round(avg(parameters),2), min(TimeGenerated), max(TimeGenerated) by PrincipalName, ApplicationName, bin(TimeGenerated, resolution)
//Summarise by user and application and create lists ready for anomaly detection
| summarize make_list(avg_tokens), make_list(avg_parameters), make_list(min_TimeGenerated), make_list(max_TimeGenerated) by PrincipalName, ApplicationName

 

With the prepared data we can call series_decompose_anomalies to identify anomalies in the number of tokens and parameters for a given day. We will then keep results where a positive or negative anomaly is detected (too few or too many tokens for that day when compared to the baseline). It’s also important to record the start and end time of this activity so that we know when the anomaly occurred.

 

| extend series_decompose_anomalies(list_avg_tokens, scoreThreshold, -1, 'linefit'), series_decompose_anomalies(list_avg_parameters, scoreThreshold, -1, 'linefit')
| mv-expand TokenAnomaly=series_decompose_anomalies_list_avg_tokens_ad_flag, ParameterAnomaly=series_decompose_anomalies_list_avg_parameters_ad_flag, WindowStart=list_min_TimeGenerated, WindowEnd=list_max_TimeGenerated
| project WindowStart, WindowEnd, PrincipalName, ApplicationName, TokenAnomaly, ParameterAnomaly
//Enable to detect SQL statement token anomalies
| where TokenAnomaly == 1 or TokenAnomaly == -1

 

Finally, the query will create a join key using the username and application name to re-join back to the original dataset. The start and end times recorded earlier can now be used to surface results within the time window of the anomaly.

 

| extend joinKey = strcat(PrincipalName, ApplicationName)
| join kind=leftouter (
    processedData
    | project ApplicationName, PrincipalName, Statement, TimeGenerated
    | extend joinKey = strcat(PrincipalName, ApplicationName)
) on joinKey
| where TimeGenerated between (todatetime(WindowStart) .. todatetime(WindowEnd))
| extend Parameters = countof(Statement, "=")
| extend Tokens = array_length(split(Statement, " "))
| project TimeGenerated, ParameterAnomaly, Parameters, TokenAnomaly, Tokens, WindowStart, WindowEnd, PrincipalName, ApplicationName, Statement
| order by Tokens desc, Parameters desc

 

The results returned will represent activity occurring with an unusual number of tokens and parameters for that given time of day.

 

Suspicious Stored Procedures

Using the MSTIC sensor network, MSTIC can observe the most used commands by attackers when they gain access to an SQL database. Using this information, this hunting query will show SQL queries that contain the most abused SQL stored procedures.

 

let abusedProcedures = dynamic(["xp_cmdshell", "xp_regwrite", "xp_regdeletekey", "xp_regdeletevalue", "xp_dirtree", "xp_fileexist", "xp_msver", "xp_makecab", "xp_sqlshell", "xp_fixeddrivesd", "xp_regread", "sp_configure", "sp_oacreate", "sp_password", "sp_OACreate", "sp_addextendedproc", "sp_dropextendedproc", "sp_makewebtask", "sp_delete", "SP_OAcreate", "sp_OADestroy"]);
AzureDiagnostics
| where Category =~ "SQLSecurityAuditEvents"
| where statement_s has_any (abusedProcedures)
| project TimeGenerated, SubscriptionId, ResourceId, ClientIp=client_ip_s, PrincipalName=session_server_principal_name_s, statement_s, action_id_s, HostName=host_name_s, ApplicationName=application_name_s

 

The of the above commands are often abused as they allow attackers to progress their access from only the SQL database onto the underlying server. Executing command line, manipulating registry keys, and performing directory traversal are all key components to successful onward exploitation.

 

Commands such as" xp_dirtree" can be exploited to allow attackers to capture MSSQL credentials. This is especially useful if the attacker only has access via SQLi through a web application as it grants them direct database access. Credentials may also be reused to access other systems in the network.

 

All the above procedures are not supported on Azure SQL Databases. This is because Azure SQL Databases run in a shared environment. Presence of these commands in Azure SQL Database logging likely indicates random attempts if your database is exposed to the open internet.

 

If you are running your own SQL server it is recommended that you disabled commands that are not in use. Many of these commands are disabled by default.

 

First you must enable advanced options:

 

EXEC sp_configure 'show advanced options', 1
RECONFIGURE

 

 

Then you can disable the chose procedure, for example:

 

EXEC sp_configure 'xp_dirtree', 0
RECONFIGURE

 

 

If you leave any of these procedures enabled a trap should be set in your SIEM for when they are executed.

 

Conclusion

The Azure Sentinel SQL solution allows security analysts and administrators to rapidly deploy a range of detection and hunting queries to their Azure Sentinel environment. As you have seen, there are numerous ways that SQL attacks can be detected. The ever-changing security landscape means it’s not always possible to detect attacks with a single query. It’s important to develop diverse detection and hunting queries using numerous novel approaches to provide the best possible visibility of SQL attacks.

 

We hope this blog post has provided insight into how our detection and hunting queries work, and we are excited to see new Hunting and Detection queries built by the community.

 

All the queries in this post can be found in-full within the Azure Sentinel SQL solution. Additional hunting and detection queries written for Azure Sentinel can be found on the Azure Sentinel GitHub.

%3CLINGO-SUB%20id%3D%22lingo-sub-2597961%22%20slang%3D%22en-US%22%3EAzure%20Sentinel%20SQL%20Solution%20Query%20Deep-Dive%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2597961%22%20slang%3D%22en-US%22%3E%3CP%3E%3CEM%3Eby%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F686380%22%20target%3D%22_blank%22%3E%40TomMcElroy%3C%2FA%3E%26nbsp%3B%26amp%3B%20Andrey%20Karpovsky%3CBR%20%2F%3EThanks%20to%3A%20Tamer%20Salman%2C%20Moshe%20Israel%2C%26nbsp%3BHani%20Neuvirth-Telem%20%26amp%3B%20Yoav%20Daniely%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20May%202021%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sentinel%2Fintroducing-azure-sentinel-solutions%2Fba-p%2F2347312%22%20target%3D%22_blank%22%3EAzure%20Sentinel%20saw%20the%20launch%3C%2FA%3E%20of%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-gb%2Fazure%2Fsentinel%2Fsentinel-solutions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Sentinel%20Solutions%3C%2FA%3E%20into%20public%20preview.%20This%20launch%20provided%20Azure%20Sentinel%20preview%20customers%20with%20access%20to%20over%2032%20solutions%20spanning%20Microsoft%20and%20other%20vendor%20data%20sources.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20part%20of%20this%20release%20Azure%20Defender%20and%20Microsoft%20Threat%20Intelligence%20Center%20(MSTIC)%20collaborated%20to%20contribute%20Detections%20and%20Hunting%20queries%20to%20the%20Azure%20Sentinel%20for%20Azure%20SQL%20solution.%20These%20detection%20and%20hunting%20queries%20are%20based%20on%20real%20world%20attack%20scenarios%20and%20provide%20a%20basis%20for%20detecting%20and%20investigating%20potential%20SQL%20exploitation%20attacks.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20tech%20community%20post%20we%20will%20cover%20each%20of%20the%20Detection%20and%20Hunting%20queries%20included%20in%20the%20Azure%20Sentinel%20SQL%20solution.%20This%20post%20will%20cover%20what%20malicious%20activity%20these%20queries%20are%20designed%20to%20uncover%2C%20how%20to%20tailor%20them%20for%20your%20environment%20using%20their%20configurable%20parameters%20and%20provide%20some%20insight%20into%20how%20the%20query%20works.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhilst%20the%20detection%20and%20hunting%20queries%20discussed%20in%20this%20Tech%20Community%20post%20will%20focus%20on%20Azure%20SQL%2C%20many%20of%20the%20techniques%20can%20be%20adapted%20to%20work%20with%20any%20relational%20database%20management%20system%20(RDMS).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMore%20information%20on%20where%20to%20find%20Solutions%20within%20Azure%20Sentinel%20can%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sentinel%2Fintroducing-azure-sentinel-solutions%2Fba-p%2F2347312%22%20target%3D%22_blank%22%3Ebe%20found%20here%3C%2FA%3E.%20Within%20the%20solutions%20tab%20search%20for%20%E2%80%9CAzure%20Sentinel%20for%20Azure%20SQL%E2%80%9D%20to%20install%20the%20SQL%20solution.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--383731328%22%20id%3D%22toc-hId--383731329%22%3ECommon%20SQL%20Anomalies%20Indicating%20Compromise%3C%2FH2%3E%0A%3CP%3EFor%20those%20unfamiliar%20with%20potentially%20malicious%20SQL%20activity%2C%20this%20section%20will%20briefly%20cover%20the%20different%20types%20of%20unusual%20activity%20that%20the%20detection%20and%20hunting%20queries%20are%20designed%20to%20detect.%20If%20you%20are%20already%20familiar%20with%20malicious%20SQL%20activity%20you%20may%20wish%20to%20skip%20straight%20to%20the%20queries.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-306830146%22%20id%3D%22toc-hId-306830145%22%3EUnsecured%20Databases%3C%2FH3%3E%0A%3CP%3EDatabases%20that%20are%20improperly%20secured%20and%20exposed%20to%20the%20open%20internet%20will%20almost%20certainly%20see%20exploitation%20attempts.%20The%20MSTIC%20sensor%20network%20is%20a%20collection%20of%20deception%20services%26nbsp%3Bthat%20collect%20data%20on%20active%20internet%20exploitation.%20In%202020%20the%20MSTIC%20sensor%20network%20observed%20over%20300%2C000%20SQL%20code%20execution%20attempts%20targeted%20at%20our%20honeypot%20network.%20These%20were%20attempts%20where%20an%20SQL%20query%20was%20sent%20to%20the%20server%20with%20the%20intent%20of%20executing%20an%20unauthorised%20command.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUnpatched%20vulnerable%20server%20software%2C%20weak%20passwords%2C%20and%20exposed%20administrative%20interfaces%20are%20all%20common%20vectors%20for%20attackers%20conducting%20mass%20scanning%20and%20exploitation%20operations.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20hosted%20SQL%20servers%20benefit%20from%20some%20default%20protections.%20New%20SQL%20servers%20will%20be%20firewalled%20from%20the%20open%20internet%20and%20can%20only%20communicate%20with%20other%20Azure%20services.%20Firewall%20settings%20in%20Azure%20allow%20you%20to%20configure%20your%20server%20to%20only%20allow%20connections%20from%20specific%20IP%20addresses%20or%20ranges.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1500624317%22%20id%3D%22toc-hId--1500624318%22%3ESQL%20Injection%3C%2FH3%3E%0A%3CP%3ESQLi%20is%20a%20code%20injection%20technique%20where%20an%20attacker%20sends%20crafted%20query%20statements%20to%20an%20SQL%20server%2C%20these%20statements%20are%20crafted%20to%20exploit%20poorly%20implemented%20program%20logic.%20If%20successful%20commands%20sent%20by%20the%20attacker%20may%20allow%20data%20to%20be%20extracted%20from%20the%20database%2C%20existing%20records%20to%20be%20modified%20or%20new%20records%20created.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESQL%20injection%20vulnerabilities%20are%20introduced%20when%20user-controllable%20input%20is%20improperly%20sanitised%2C%20or%20input%20sanitisation%20is%20circumvented%20by%20the%20attacker.%20SQL%20injection%20vulnerabilities%20may%20be%20found%20in%20any%20application%20that%20interacts%20with%20an%20SQL%20server%2C%20most%20commonly%20these%20are%20web%20applications.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20the%20vulnerable%20application%20processes%20and%20executes%20the%20command%20on%20behalf%20of%20the%20attacker%2C%20any%20commands%20that%20are%20injected%20successfully%20into%20a%20web%20application%20are%20executed%20from%20the%20IP%20address%20where%20the%20vulnerable%20application%20is%20hosted.%20Successful%20SQLi%20can%20be%20used%20to%20bypass%20IP%20restrictions%20enforced%20using%20Firewalls%20and%20make%20attacks%20harder%20to%20investigate.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22sql_attacker.jpg%22%20style%3D%22width%3A%20623px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F299871i59E82DE9FE15FAC5%2Fimage-dimensions%2F623x169%3Fv%3Dv2%22%20width%3D%22623%22%20height%3D%22169%22%20role%3D%22button%22%20title%3D%22sql_attacker.jpg%22%20alt%3D%22Threat%20actor%20injects%20SQL%20code%20into%20a%20vulnerable%20page%2C%20providing%20access%20to%20the%20underlying%20SQL%20database.%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThreat%20actor%20injects%20SQL%20code%20into%20a%20vulnerable%20page%2C%20providing%20access%20to%20the%20underlying%20SQL%20database.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESQLi%20can%20be%20performed%20with%20or%20without%20knowledge%20of%20the%20underlying%20database%20structure%2C%20when%20queries%20are%20sent%20to%20the%20server%20without%20knowledge%20of%20the%20underlying%20database%20structure%20these%20are%20commonly%20referred%20to%20as%20being%20%E2%80%9Cblind%E2%80%9D.%20Blind%20SQLi%20is%20generally%20used%20to%20determine%20if%20the%20application%20is%20vulnerable%2C%20the%20two%20most%20common%20techniques%20are%20Boolean%20based%20and%20Timing%20based%20blind%20SQL%20injection%20attacks.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId--810062843%22%20id%3D%22toc-hId--810062844%22%3EBoolean%20based%20Blind%20SQLi%3C%2FH4%3E%0A%3CP%3EBoolean%20based%20blind%20SQLi%20is%20a%20reconnaissance%20technique%20which%20uses%20Boolean%20statements%2C%20returning%20a%20True%20or%20False%20result%2C%20to%20determine%20if%20the%20code%20is%20being%20executed%20by%20the%20SQL%20server%20after%20injection%20into%20a%20vulnerable%20parameter.%20The%20attacker%20will%20view%20the%20page%20using%20standard%20parameters%20and%20then%20inject%20code%20to%20force%20a%20true%20or%20false%20result.%20They%20will%20then%20look%20for%20differences%20in%20the%20returned%20result%20to%20determine%20if%20their%20injection%20was%20successful.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20below%20example%2C%20the%20attacker%20may%20inject%20some%20SQL%20into%20the%20%E2%80%9Cid%E2%80%9D%20parameter%20of%20the%20members%20page%2C%20in%20the%20first%20instance%20providing%20and%20statement%20that%20will%20return%20a%20false%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Ehttp%3A%2F%2Fcontoso.com%2Fmember.php%3Fid%3D1%20and%201%3D2%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20will%20cause%20the%20page%20to%20believe%20that%20the%20member%20ID%20requested%20doesn%E2%80%99t%20exist.%20While%20the%20member%20with%20an%20ID%20of%201%20exists%20the%20second%20part%20of%20the%20statement%20will%20return%20false.%20The%20attacker%20will%20then%20inject%20SQL%20that%20will%20return%20a%20true%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Ehttp%3A%2F%2Fcontoso.com%2Fmember.php%3Fid%3D1%20and%201%3D1%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBy%20looking%20for%20differences%20in%20the%20response%20the%20attacker%20can%20determine%20the%20page%20is%20vulnerable.%20In%20the%20example%20above%2C%20when%20the%20first%20request%20is%20sent%20the%20page%20returns%20an%20error%20stating%20the%20member%20was%20not%20found.%20In%20the%20second%20request%20the%20attacker%20forces%20a%20true%20result%2C%20and%20therefore%20the%20page%20returns%20a%20successful%20lookup.%20If%20the%20attacker%E2%80%99s%20injection%20were%20not%20working%2C%20or%20the%20injected%20SQL%20was%20being%20filtered%20out%2C%20the%20page%20would%20behave%20normally%2C%20returning%20member%20information%20for%20member%20ID%201%20in%20both%20instances.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId-1677449990%22%20id%3D%22toc-hId-1677449989%22%3ETime-based%20blind%20SQLi%3C%2FH4%3E%0A%3CP%3ETime%20based%20blind%20SQL%20injection%20uses%20SQL%20sleep%20functions%20to%20force%20the%20query%20to%20wait%20for%20a%20pre-determined%20amount%20of%20time.%20Like%20with%20Boolean%20blind%20SQL%20injection%20it%20relies%20on%20the%20attacker%20first%20baselining%20the%20vulnerable%20pages%20behaviour%20and%20then%20injecting%20crafted%20requests%20to%20force%20unusual%20execution%20times.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAn%20attacker%20may%20visit%20the%20page%20with%20normal%20parameters%2C%20and%20note%20that%20the%20base%20executes%20in%2088%20milliseconds.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Ehttp%3A%2F%2Fcontoso.com%2Fmember.php%3Fid%3D1%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20attacker%20may%20then%20append%20the%20SQL%20Server%20WAITFOR%20DELAY%20command%2C%20forcing%20the%20query%20to%20wait%20for%205%20seconds%20if%20executed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Ehttp%3A%2F%2Fcontoso.com%2Fmember.php%3Fid%3D1%3B%20WAITFOR%20DELAY%20'00%3A00%3A05'%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20attacker%20will%20know%20if%20the%20injection%20is%20successful%20if%20the%20page%20which%20previous%20took%2088%20milliseconds%20to%20execute%20now%20takes%20over%205%20seconds%20to%20execute.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20technique%20can%20be%20detected%20by%20analysing%20logs%20or%20web%20requests%20for%20the%20presence%20of%20WAITFOR%20commands%2C%20however%20there%20are%20many%20techniques%20to%20obfuscate%20the%20injected%20command%2C%20allowing%20the%20attacker%20to%20bypass%20static%20keyword%20detection.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1666946886%22%20id%3D%22toc-hId-1666946885%22%3EData%20Extraction%20%26amp%3B%20Manipulation%3C%2FH3%3E%0A%3CP%3EThe%20end%20goal%20for%20most%20attackers%20targeting%20SQL%20servers%20is%20to%20extract%20data%20or%20delete%2Fdamage%20that%20data.%20SQL%20databases%20often%20contain%20sensitive%20information%20that%20can%20be%20attractive%20to%20both%20criminal%20or%20nation-state%20actors.%20Extraction%20of%20sensitive%20user%20information%20may%20provide%20a%20nation-state%20threat%20group%20with%20information%20to%20further%20exploit%20the%20network%20or%20may%20be%20of%20intelligence%20value%20alone.%20Organised%20crime%20groups%20may%20seek%20to%20sell%20the%20data%20onwards%20or%20encrypted%2Fdestroy%20the%20data%20as%20part%20of%20a%20ransomware%20campaign.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1656443782%22%20id%3D%22toc-hId-1656443781%22%3EDetection%20Queries%3C%2FH2%3E%0A%3CP%3EThis%20section%20will%20cover%20detection%20queries%20in%20detail.%20These%20are%20queries%20that%20are%20designed%20to%20be%20used%20as%20alerts%20on%20potential%20malicious%20attempts%20to%20access%20and%20exploit%20the%20resources.%20Detection%20queries%20expose%20several%20parameters%20that%20can%20be%20easily%20tuned%20to%20control%20the%20accuracy%20and%20quantity%20of%20detections.%20Detections%20look%20for%20suspicious%20events%20inside%20recent%20time%20window%2C%20which%20are%20anomalous%20based%20on%20behavior%20that%20was%20learned%20in%20the%20preceding%20training%20window.%20In%20addition%2C%20these%20queries%20can%20be%20used%20as%20templates%20for%20other%20security%20scenarios.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEach%20detection%20query%20is%20built%20on%20top%20of%20a%20standard%20normalisation%2C%20using%20the%20following%20Kusto%20query%20to%20process%20SQL%20log%20data.%20For%20brevity%2C%20each%20individual%20query%20will%20not%20include%20this%20normalisation%20step.%20%26nbsp%3BComplete%20queries%20can%20be%20found%20within%20the%20Azure%20Sentinel%20SQL%20solution.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Elet%20timeSliceSize%20%3D%201h%3B%0Alet%20timeRange%20%3D%2014d%3B%0Alet%20processedData%20%3D%20materialize%20(%0A%20%20%20%20%20%20AzureDiagnostics%0A%20%20%20%20%20%20%7C%20where%20TimeGenerated%20%26gt%3B%20ago(timeRange)%0A%20%20%20%20%20%20%7C%20where%20Category%20%3D%3D%20'SQLSecurityAuditEvents'%20and%20action_id_s%20has_any%20(%22RCM%22%2C%20%22BCM%22)%20%2F%2F%20Keep%20only%20SQL%20affected%20rows%0A%20%20%20%20%20%20%7C%20project%20TimeGenerated%2C%20PrincipalName%20%3D%20server_principal_name_s%0A%2C%20ClientIp%20%3D%20client_ip_s%2C%20HostName%20%3D%20host_name_s%2C%20ResourceId%0A%2C%20ApplicationName%20%3D%20application_name_s%2C%20ActionName%20%3D%20action_name_s%0A%2C%20Database%20%3D%20strcat(LogicalServerName_s%2C%20'%2F'%2C%20database_name_s)%0A%2C%20IsSuccess%20%3D%20succeeded_s%2C%20DurationMs%20%3D%20duration_milliseconds_d%0A%2C%20AffectedRows%20%3D%20affected_rows_d%2CResponseRows%20%3D%20response_rows_d%0A%2C%20Statement%20%3D%20statement_s%0A%2C%20Error%20%3D%20case(%20additional_information_s%20has%20'error_code'%2C%20toint(extract(%22%3CERROR_CODE%3E(%5B0-9.%5D%2B)%22%2C%201%2C%20additional_information_s))%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2C%20additional_information_s%20has%20'failure_reason'%2C%20toint(extract(%22%3CFAILURE_REASON%3EErr%20(%5B0-9.%5D%2B)%22%2C%201%2C%20additional_information_s))%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2C%200)%0A%2C%20State%20%3D%20case(%20additional_information_s%20has%20'error_state'%2C%20toint(extract(%22%3CERROR_STATE%3E(%5B0-9.%5D%2B)%22%2C%201%2C%20additional_information_s))%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2C%20additional_information_s%20has%20'failure_reason'%2C%20toint(extract(%22%3CFAILURE_REASON%3EErr%20(%5B0-9.%5D%2B)%2C%20Level%20(%5B0-9.%5D%2B)%22%2C%202%2C%20additional_information_s))%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2C%200)%2C%0A%20%20%20%20%20%20AdditionalInfo%20%3D%20additional_information_s%2C%20timeSlice%20%3D%20floor(TimeGenerated%2C%20timeSliceSize))%0A%20%20%20%20%20%20%20%7C%20extend%20RowNumber%20%3D%20row_number()%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20WindowType%20%3D%20case(%20TimeGenerated%20%26gt%3B%3D%20ago(detectionWindow)%2C%20'detection'%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(ago(trainingWindow)%20%26lt%3B%3D%20TimeGenerated%20and%20TimeGenerated%20%26lt%3B%20ago(detectionWindow))%2C%20'training'%2C%20'other')%0A%3B%3C%2FFAILURE_REASON%3E%3C%2FERROR_STATE%3E%3C%2FFAILURE_REASON%3E%3C%2FERROR_CODE%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDetection%20queries%20can%20be%20divided%20into%203%20broad%20categories%20by%20similar%20logic%20and%20content.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1947962040%22%20id%3D%22toc-hId--1947962041%22%3EDetections%20for%20volumetric%20spikes%3C%2FH3%3E%0A%3CP%3EThese%20detections%20monitor%20a%20single%20numeric%20variable%20and%20look%20for%20significant%20upward%20spikes%2C%20that%20are%20anomalous%20when%20compared%20to%20normal%20behaviour%20of%20the%20same%20variable%20on%20that%20resource%20in%20the%20training%20period.%20For%20example%2C%20if%20a%20malicious%20actor%20attempts%20to%20extract%20all%20the%20records%20in%20a%20database%2C%20it%20will%20be%20detected.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECurrently%202%20detections%20of%20these%20types%20are%20included%2C%20looking%20for%20different%20numeric%20columns%20(and%20security%20scenarios)%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSTRONG%3EVolumeAffectedRowsStatefulAnomalyOnDatabase%3C%2FSTRONG%3E%3A%20Monitors%20the%20%E2%80%98AffectedRows%E2%80%99%20metric%2C%20which%20reflects%20changes%20made%20in%20the%20database.%20Upward%20spikes%20indicate%20that%20too%20many%20data%20rows%20were%20changed%2C%20which%20might%20indicate%20potential%20attempts%20to%20destroy%20data%20or%20make%20it%20temporary%20unusable.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EVolumeResponseRowsStatefulAnomalyOnDatabase%3C%2FSTRONG%3E%3A%20Monitors%20the%20%E2%80%99ResponseRows%E2%80%99%20metric%2C%20that%20reflects%20exfiltration%20from%20the%20database.%20Spikes%20indicate%20that%20too%20many%20data%20rows%20were%20extracted%2C%20which%20might%20indicate%20potential%20data%20theft.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20queries%20share%20several%20parameters%20that%20control%20the%20query%20logic%20and%20are%20exposed%20for%20easy%20control.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EmonitoredColumn%20(values%3A%20%E2%80%98ResponseRows%E2%80%99%2C%20%E2%80%98AffectedRows%E2%80%99)%3A%3C%2FSTRONG%3E%20Name%20of%20the%20volumetric%20variable%20column%20that%20is%20analyzed%20in%20the%20query.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EvolumeThresholdZ%20(default%20value%3A%203.0)%3A%3C%2FSTRONG%3E%20Minimal%20threshold%20for%20relative%20anomaly%20score%20(zScore)%2C%20which%20represents%20the%20number%20of%20standard%20deviations%20that%20the%20value%20is%20above%20the%20average.%20For%20higher%20values%2C%20the%20alerts%20will%20be%20triggered%20only%20by%20very%20significant%20anomalies.%20For%20example%2C%20values%20of%201500%20and%20900%20will%20both%20trigger%20alerts%20in%20case%20of%20volumeThresholdZ%20%3D%203.0%2C%20but%20only%201500%20will%20trigger%20alert%20for%20volumeThresholdZ%20%3D%205.0.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EvolumeThresholdQ%20(default%20value%3A%20volumeThresholdZ)%3A%3C%2FSTRONG%3E%20Minimal%20threshold%20for%20absolute%20anomaly%20score%20(qScore)%2C%20which%20represents%20the%20number%20of%20median%20ranges%20that%20the%20value%20is%20above%20the%2099%3CSUP%3Eth%3C%2FSUP%3E%20percentile.%20For%20higher%20values%2C%20the%20alerts%20will%20be%20triggered%20only%20by%20very%20significant%20anomalies.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EvolumeThresholdHardcoded%20(default%20value%3A%20500)%3A%3C%2FSTRONG%3E%20Minimal%20threshold%20for%20actual%20value%20of%20the%20monitored%20column%20that%20will%20trigger%20the%20alert.%20For%20example%2C%20in%20case%20of%20default%20value%2C%20only%20values%20above%20it%20will%20trigger%20alerts%20(in%20case%20the%20other%20thresholds%20are%20passed%20as%20well).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EdetectionWindow%20(default%20value%3A%201h)%3A%3C%2FSTRONG%3E%20Size%20of%20the%20recent%20time%20window%20(back%20from%20current%20time).%20Events%20in%20this%20window%20will%20be%20analyzed%20for%20anomalies%2C%20and%20anomalies%20that%20are%20significant%20(based%20on%20thresholds)%20will%20appear%20in%20the%20output.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EtrainingWindow%3A%20(default%20value%3A%20detectionWindow%20%2B%2014d)%3A%3C%2FSTRONG%3E%20Window%20size%20before%20the%20detection%20window%20that%20is%20used%20to%20calculate%20the%20metrics%20for%20normal%20behaviour.%20Events%20in%20detection%20window%20will%20be%20compared%20with%20these%20metrics.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20standardized%20data%20is%20split%20to%202%20datasets.%20Training%20window%20is%20a%20relatively%20long%20period%20of%20time%20(14%20to%2030%20days%20are%20recommended)%20which%20precedes%20the%20detection%20window%20and%20is%20used%20to%20learn%20the%20normal%20and%20expected%20behaviour%20on%20the%20resource.%20Basic%20measures%20of%20central%20tendency%20(average%20and%20median)%20and%20dispersion%20(standard%20deviation%20and%20inter-percentile%20range)%20are%20calculated%20to%20model%20this%20behaviour.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3EtrainingSet%20%3D%20processedData%20%20%20%20%20%20%20%20%0A%7C%20where%20WindowType%20%3D%3D%20'training'%20%20%20%20%20%20%20%20%0A%7C%20summarize%20AvgVal%20%3D%20round(avg(QuantityColumn)%2C%202)%0A%2C%20StdVal%20%3D%20round(stdev(QuantityColumn)%2C%202)%2C%20N%20%3D%20max(RowNumber)%0A%2C%20P99Val%20%3D%20round(percentile(QuantityColumn%2C%2099)%2C%202)%0A%2C%20P50Val%20%3D%20round(percentile(QuantityColumn%2C%2050)%2C%202)%20%20%20%20%20%20%20%20%20%20%0Aby%20Database%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20detection%20window%20is%20relatively%20short%20period%20(1%20to%2024%20hours%20are%20advised)%20and%20is%20used%20to%20monitor%20recent%20values%20of%20the%20metric.%20If%20a%20recent%20value%20is%20significantly%20higher%20than%20the%20chosen%20thresholds%2C%20an%20alert%20is%20triggered.%20By%20lowering%20the%20thresholds%2C%20the%20user%20can%20allow%20for%20more%20(less-significant)%20alerts%20to%20be%20raised.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3EprocessedData%20%20%20%20%0A%7C%20where%20WindowType%20%3D%3D%20'detection'%20%20%0A%7C%20join%20kind%20%3D%20inner%20(trainingSet)%20on%20Database%20%20%0A%7C%20extend%20ZScoreVal%20%3D%20iff(N%20%26gt%3B%3D%2020%2C%20round(todouble(QuantityColumn%20-%20AvgVal)%20%2F%20todouble(StdVal%20%2B%201)%2C%202)%2C%200.00)%0A%2C%20QScoreVal%20%3D%20iff(N%20%26gt%3B%3D%2020%2C%20round(todouble(QuantityColumn%20-%20P99Val)%20%2F%20todouble(P99Val%20-%20P50Val%20%2B%201)%2C%202)%2C%200.00)%0A%7C%20extend%20IsVolumeAnomalyOnVal%20%3D%20iff((ZScoreVal%20%26gt%3B%20volumeThresholdZ%20and%20QScoreVal%20%26gt%3B%20volumeThresholdQ%20and%20QuantityColumn%20%26gt%3B%20volumeThresholdHardcoded)%2C%20true%2C%20false)%2C%20AnomalyScore%20%3D%20round((ZScoreVal%20%2B%20QScoreVal)%2F2%2C%200)%20%20%20%20%0A%7C%20project%20TimeGenerated%2C%20Database%2C%20PrincipalName%2C%20ClientIp%2C%20HostName%2C%20ApplicationName%2C%20ActionName%2C%20Statement%2C%20IsSuccess%2C%20ResponseRows%2C%20AffectedRows%2C%20IsVolumeAnomalyOnVal%2C%20AnomalyScore%20%20%0A%7C%20where%20IsVolumeAnomalyOnVal%20%3D%3D%20'true'%0A%7C%20sort%20by%20AnomalyScore%20desc%2C%20TimeGenerated%20desc%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20output%20of%20the%20query%20contains%20a%20list%20of%20events%20in%20detection%20window%20that%20were%20flagged%20as%20anomalous%20(IsVolumeAnomalyOnVal%20%3D%20%E2%80%98true%E2%80%99)%20by%20the%20detection%20query%20with%20the%20defined%20parameters%2C%20together%20with%20AnomalyScore%20field.%20Higher%20AnomalyScore%20values%20represent%20the%20significance%20of%20the%20anomaly%20(higher%20values%20represent%20events%20that%20are%20more%20anomalous).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-539550793%22%20id%3D%22toc-hId-539550792%22%3EDetections%20for%20Monitored%20Errors%3C%2FH3%3E%0A%3CP%3EThese%20detections%20look%20for%20statements%20or%20login%20attempts%20that%20fail%20with%20specific%20errors%2C%20which%20might%20indicate%20malicious%20attempts%20to%20access%20or%20exploit%20the%20database.%20For%20example%2C%20login%20failures%20on%20firewall%20blocks%20or%20credential%20errors%20might%20indicate%20a%20malicious%20attempt%20to%20gain%20access%20to%20the%20database.%20In%20some%20environments%2C%20specific%20errors%20are%20expected.%20%26nbsp%3BTo%20prevent%20noise%20in%20these%20cases%2C%20minimal%20thresholds%20for%20events%20that%20trigger%20the%20alerts%20are%20exposed%20and%20can%20be%20adapted%20to%20raise%20alert%20on%20any%20relevant%20event%2C%20or%20only%20when%20specific%20count%20is%20reached.%3C%2FP%3E%0A%3CP%3ECurrently%2C%203%20detections%20of%20this%20type%20are%20included%2C%20looking%20for%20different%20errors%20(and%20security%20scenarios)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSTRONG%3EErrorsFirewallStatefulAnomalyOnDatabase%3A%3C%2FSTRONG%3E%20Looks%20for%20login%20attempts%20that%20are%20blocked%20by%20existing%20firewall%20rules%20(error%2040615).%20Such%20events%20might%20indicate%20that%20unauthorized%20actor%20unsuccessfully%20tried%20to%20gain%20access%20to%20the%20database.%20This%20alert%20is%20interesting%20since%20it%20can%20help%20preventing%20further%20attacks%20on%20the%20same%20target%20(e.g.%20coming%20from%20a%20different%20source).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EErrorsCredentialStatefulAnomalyOnDatabase%3C%2FSTRONG%3E%3A%20Looks%20for%20login%20attempts%20that%20failed%20due%20to%20incorrect%20credentials%20(error%2018456).%20Such%20events%20might%20indicate%20that%20unauthorized%20actor%20tried%20to%20gain%20access%20to%20the%20database%20but%20didn%E2%80%99t%20have%20the%20correct%20credential%20combination.%20The%20attempts%20might%20continue%20with%20different%20credential%20sets%20(Brute%20Force).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EErrorsSyntaxStatefulAnomalyOnDatabase%3A%3C%2FSTRONG%3E%20Attempts%20to%20execute%20queries%20that%20failed%20on%20syntax%20mistakes%20(errors%20102%20and%20105).%20The%20attacker%20may%20be%20unfamiliar%20with%20the%20structure%20and%20content%20of%20the%20resource.%20In%20such%20a%20case%2C%20the%20malicious%20queries%20may%20be%20malformed%20(e.g.%20in%20case%20of%20SQLi)%20or%20contains%20unsupported%20scripting%20attempts%20and%20will%20fail%20on%20syntax%20errors.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20queries%20share%20the%20following%20parameters%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EdetectionWindow%20(default%20value%3A%201h)%3A%3C%2FSTRONG%3E%20size%20of%20the%20recent%20time%20window%20(as%20described%20above)%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EtrainingWindow%3A%20(default%20value%3A%20detectionWindow%20%2B%2014d)%3A%3C%2FSTRONG%3E%20training%20window%20size%20before%20the%20detection%20window%20(as%20described%20above).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EtimeSliceSize%20(default%20value%3A%201h)%3A%3C%2FSTRONG%3E%20size%20of%20slices%20into%20which%20the%20data%20is%20divided.%20The%20number%20of%20suspicious%20failed%20attempts%20is%20calculated%20per%20each%20slice.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EmonitoredStatementsThreshold%20(default%20value%3A%201)%3A%3C%2FSTRONG%3E%20the%20minimal%20threshold%20for%20monitored%20failed%20attempts%20per%20slice%20to%20be%20flagged%20as%20suspicious.%20For%20example%2C%20if%20some%20amount%20of%20credential%20failures%20is%20expected%20due%20to%20human%20error%2C%20this%20number%20can%20be%20set%20to%2010.%20In%20this%20case%2C%20only%20if%2010%20or%20more%20failures%20are%20seen%20in%20the%20slice%2C%20alert%20can%20be%20triggered.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EtrainingSlicesThreshold%20(default%20value%3A%205)%3A%3C%2FSTRONG%3E%20the%20maximal%20threshold%20for%20the%20number%20of%20flagged%20slices%20(based%20on%20the%20previous%20parameters)%20in%20the%20training%20window.%20If%20the%20number%20of%20such%20slices%20is%20above%20the%20threshold%2C%20the%20behaviour%20is%20considered%20normal%2C%20and%20no%20alert%20will%20be%20triggered%20for%20the%20current%20slice%20on%20similar%20event.%20If%20the%20number%20is%20set%20high%20(e.g.%201000)%2C%20all%20slices%20with%20monitored%20attempts%20will%20trigger%20alerts.%20If%20the%20number%20is%20set%20to%200%2C%20alert%20will%20be%20triggered%20only%20on%20first%20event%20of%20the%20kind.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EmonitoredErrors%20(values%3A%20(40615)%20Firewall%20block%20failures%2C%20(18456)%20Credential%20failure%20errors%2C%20(102%2C%20105)%20Syntax%20errors)%3A%3C%2FSTRONG%3E%20SQL%20error%20codes%20that%20are%20monitored%20for%20the%20scenario.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20detection%20looks%20for%20logins%20or%20queries%20that%20fail%20with%20monitored%20error%20codes.%20Within%20the%20training%20window%20each%20time%20slice%20(e.g.%20an%20hour%2C%20as%20defined%20by%20respective%20parameter)%20that%20has%20above%20certain%20value%20(monitoredStatementsThreshold%20parameter)%20of%20errors%20is%20flagged.%20For%20example%2C%20we%20can%20count%20each%20slice%20that%20has%20more%20than%205%20errors.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Elet%20trainingSet%20%3D%20processedData%0A%7C%20where%20WindowType%20%3D%3D%20'training'%0A%7C%20summarize%20countSlicesWithErrors%20%3D%20dcountif(timeSlice%2C%20countStatementsWithError%20%26gt%3B%3D%20monitoredStatementsThreshold)%20by%20Database%3B%0AprocessedData%0A%7C%20where%20WindowType%20%3D%3D%20'detection'%20%0A%7C%20join%20kind%20%3D%20inner%20(trainingSet)%20on%20Database%0A%7C%20extend%20IsErrorAnomalyOnStatement%20%3D%20iff(((countStatementsWithError%20%26gt%3B%3D%20monitoredStatementsThreshold)%20and%20(countSlicesWithErrors%20%26lt%3B%3D%20trainingSlicesThreshold))%2C%20true%2C%20false)%2C%20anomalyScore%20%3D%20round(countStatementsWithError%2FmonitoredStatementsThreshold%2C%200)%0A%7C%20where%20IsErrorAnomalyOnStatement%20%3D%3D%20'true'%0A%7C%20sort%20by%20anomalyScore%20desc%2C%20timeSlice%20desc%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20alert%20is%20triggered%20if%20the%20detection%20window%20contains%20events%20with%20monitored%20error%20code%2C%20whilst%20the%20number%20of%20flagged%20slices%20within%20training%20window%20is%20below%20threshold%20(trainingSlicesThreshold%20parameter).%20The%20latter%20logic%20helps%20control%20the%20number%20of%20alerts%2C%20especially%20in%20environments%20where%20such%20behavior%20is%20expected%20and%20common.%3C%2FP%3E%0A%3CP%3EThe%20output%20of%20the%20query%20contains%20a%20list%20of%20events%20in%20detection%20window%20that%20were%20flagged%20as%20anomalous%20and%20the%20AnomalyScore%2C%20as%20described%20above.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20output%20of%20the%20query%20contains%20a%20list%20of%20events%20in%20detection%20window%20that%20were%20flagged%20as%20anomalous%20(IsVolumeAnomalyOnVal%20%3D%20%E2%80%98true%E2%80%99)%20by%20the%20detection%20query%20with%20the%20defined%20parameters%2C%20together%20with%20AnomalyScore%20field.%20Higher%20AnomalyScore%20values%20represent%20the%20significance%20of%20the%20anomaly%20(higher%20values%20represent%20events%20that%20are%20more%20anomalous).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1267903670%22%20id%3D%22toc-hId--1267903671%22%3EDetections%20for%20Monitored%20%22Hot%20Words%22%3C%2FH3%3E%0A%3CP%3EThese%20detections%20look%20for%20statements%20that%20include%20hot%20words%20that%20might%20indicate%20attempts%20to%20execute%20malicious%20code.%20For%20example%2C%20shell%20commands%20(e.g.%20using%20the%20%E2%80%98xp_cmdshell%E2%80%99%20procedure)%20can%20be%20used%20to%20run%20malicious%20scripts.%20These%20attempts%20might%20be%20successful%20or%20blocked%2C%20depending%20on%20SQL%20version%20and%20settings.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECurrently%2C%205%20detections%20of%20this%20type%20are%20included%2C%20covering%20different%20scenarios%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSTRONG%3EHotwordsDropStatefulAnomalyOnDatabase%3A%3C%2FSTRONG%3E%20Looks%20for%20statements%20that%20drop%20resources%20(tables%20or%20databases).%20This%20might%20indicate%20that%20a%20malicious%20actor%20attempts%20to%20delete%20valuable%20data%20and%20disrupt%20business%20activity.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EHotwordsExecutionStatefulAnomalyOnDatabase%3A%3C%2FSTRONG%3E%20Looks%20for%20attempts%20to%20run%20shell%20commands%20or%20scripts%20via%20SQL.%20This%20could%20indicate%20an%20attempt%20to%20download%20malware%2C%20run%20malicious%20processes%20(e.g.%20mining).%20Even%20if%20shell%20execution%20is%20disabled%2C%20this%20might%20indicate%20that%20a%20malicious%20agent%20gained%20access%20to%20SQL%20server%20and%20makes%20blind%20attempts.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EHotwordsFirewallRuleStatefulAnomalyOnDatabase%3A%20%3C%2FSTRONG%3ELooks%20for%20attempts%20to%20change%20or%20delete%20firewall%20rules.%20Since%20tight%20firewall%20rules%20hinder%20potential%20attacks%2C%20malicious%20user%20might%20change%20them%20in%20order%20to%20pave%20the%20way%20for%20persistent%20attacks%20in%20the%20future.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EHotwordsOLEObjectStatefulAnomalyOnDatabase%3A%3C%2FSTRONG%3E%20Looks%20for%20attempts%20to%20create%20or%20use%20OLE%20objects%2C%20which%20can%20be%20used%20as%20part%20of%20persistent%20attack%20scenario.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EHotwordsOutgoingStatefulAnomalyOnDatabase%3A%3C%2FSTRONG%3E%20Looks%20for%20attempts%20to%20access%20external%20websites%20or%20resources.%20These%20might%20be%20used%20in%20attack%20scenarios%20to%20download%20malware%20or%20contact%20command%20and%20control%20centers%20during%20the%20attack.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThe%20queries%20share%20the%20following%20parameters%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EdetectionWindow%20(default%20value%3A%201h)%3A%3C%2FSTRONG%3E%20size%20of%20the%20recent%20time%20window%20(as%20described%20above)%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EtrainingWindow%3A%20(default%20value%3A%20detectionWindow%20%2B%2014d)%3A%3C%2FSTRONG%3E%20training%20window%20size%20before%20the%20detection%20window%20(as%20described%20above).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EtimeSliceSize%20(default%20value%3A%201h)%3A%3C%2FSTRONG%3E%20size%20of%20slices%20into%20which%20the%20data%20is%20divided%20(as%20described%20above).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EMonitoredStatementsThreshold%20(default%20value%3A%201)%3A%3C%2FSTRONG%3E%20the%20minimal%20threshold%20for%20statements%20with%20monitored%20hot%20words%20per%20slice%20to%20be%20flagged%20as%20suspicious%20(as%20described%20above).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EtrainingSlicesThreshold%20(default%20value%3A%205)%3A%3C%2FSTRONG%3E%20the%20maximal%20threshold%20for%20the%20number%20of%20flagged%20slices%26nbsp%3B%20in%20the%20training%20window%20(as%20described%20above).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EHot%20words%3A%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3E%3CSTRONG%3E('drop%20table'%2C%20'drop%20database%E2%80%99)%3A%3C%2FSTRONG%3E%20Dropping%20tables%20or%20databases%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E('xp_cmdshell'%2C%20'ps.exe'%2C%20'powershell'%2C%20'cmd.exe'%2C%20'msiexec'%2C%20'%3CSCRIPT%3E%E2%80%99)%3A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20Shell%20command%20executions%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FLI%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BLI%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B(%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bhttp%3A%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3B%2C%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bhttps%3A%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3B%2C%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bftp%3A%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3B%2C%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bonion.pet%E2%80%99)%3A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20Outgoing%20connections%20to%20external%20websites%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FLI%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BLI%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B(%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bsp_set_firewall_rule%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3B%2C%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bsp_set_database_firewall_rule%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3B%2C%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bsp_delete_database_firewall_rule%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3B%2C%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bsp_delete_firewall_rule%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3B%2C%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bsys.firewall_rules%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3B%2C%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bsys.database_firewall_rules%E2%80%99)%3A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20Firewall%20rule%20tampering%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FLI%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BLI%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B(%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bsp_oamethod%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3B%2C%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bsp_oacreate%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3B%2C%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3B%2339%3Bsp_oasetproperty%E2%80%99)%3A%20%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BOLE%20object%20manipulation%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FLI%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FUL%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FLI%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FUL%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThe%20detection%20logic%20is%20like%20the%20monitored%20errors%20detection.%20Time%20slices%20containing%20monitored%20hot%20words%20in%20the%20training%20window%20are%20flagged.%20When%20the%20detection%20window%20contains%20such%20words%20but%20the%20number%20of%20flagged%20slices%20in%20training%20period%20is%20below%20threshold%2C%20an%20alert%20is%20triggered.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BH2%20id%3D%22toc-hId-395362965%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BHunting%20Queries%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FH2%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BHunting%20queries%20are%20designed%20for%20use%20in%20active%20threat%20hunts.%20Most%20threat%20hunting%20queries%20will%20require%20some%20amount%20of%20manual%20tuning%2C%20but%20this%20allows%20threat%20hunters%20to%20detect%20activity%20that%20may%20fall%20below%20detection%20baselines.%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThese%20hunting%20queries%20will%20focus%20on%20exploring%20the%20abuse%20of%20applications%20that%20communicate%20directly%20with%20SQL%20like%20web%20applications%2C%20management%20software%20and%20accounting%20software.%20Focussing%20on%20application%20activity%20allows%20us%20to%20establish%20predicable%20patterns%20of%20interaction%20with%20the%20database.%20These%20predictable%20behaviours%20will%20provide%20loose%20baselines%20for%20our%20hunting%20queries.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BWe%20can%20roughly%20identify%20SQL%20applications%20by%20grouping%20using%20the%20ApplicationName%20and%20PrincipalName%20columns.%20This%20will%20provide%20combinations%20of%20applications%20with%20associated%20accounts%2C%20roughly%20mapping%20to%20each%20application%20in%20use.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BEach%20hunting%20query%20is%20built%20on%20top%20of%20a%20standard%20normalisation%20described%20above.%20For%20brevity%20each%20individual%20query%20will%20not%20include%20this%20normalisation%20step%2C%20however%20complete%20queries%20can%20be%20found%20within%20the%20Azure%20Sentinel%20SQL%20solution.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BH3%20id%3D%22toc-hId--1283008779%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BAffected%20Row%20Anomaly%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FH3%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BAzure%20for%20SQL%20diagnostic%20logging%20provide%20us%20with%20the%20column%20affected_rows_d.%20This%20column%20contains%20a%20count%20of%20the%20rows%20that%20were%20impacted%20by%20the%20SQL%20query.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BIn%20a%20real-world%20scenario%2C%20the%20attacker%20may%20attempt%20to%20dump%20the%20database%20schema%2C%20drop%20the%20table%2C%20or%20overwrite%20data%20in%20the%20database.%20Each%20of%20these%20commands%20would%20result%20in%20the%20query%20that%20was%20exploits%20returning%20an%20unusually%20high%20number%20of%20rows%20when%20compared%20to%20normal%20database%20operation.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BUsing%20our%20processed%20data%2C%20we%20can%20create%20a%20simple%20query%20which%20calculates%20the%20total%20number%20of%20operations%20for%20a%20given%20SQL%20application%20and%20then%20calculate%20the%20prevalence%20for%20each%20query%20executed.%20We%20can%20then%20tune%20to%20query%20to%20return%20only%20queries%20that%20represent%20the%20top%201%25%20of%20affected%20row%20counts.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Blet%20threshold%20%3D%201%3B%0Alet%20totals%20%3D%20processedData%0A%7C%20summarize%20count()%20by%20PrincipalName%2C%20ApplicationName%0A%7C%20extend%20joinKey%20%3D%20strcat(PrincipalName%2C%20ApplicationName)%0A%7C%20project%20joinKey%2C%20count_%3B%0AprocessedData%0A%2F%2FCount%20the%20total%20number%20of%20times%20each%20number%20of%20rows%20was%20accessed%0A%7C%20summarize%20count()%20by%20AffectedRows%2C%20PrincipalName%2C%20ApplicationName%0A%7C%20extend%20joinKey%20%3D%20strcat(PrincipalName%2C%20ApplicationName)%0A%7C%20join%20kind%3Dleftouter%20(%0A%20%20totals%0A)%20on%20joinKey%0A%7C%20extend%20prevalence%20%3D%20round(toreal(count_)%20%2F%20toreal(count_1)%20*%20100%2C%202)%0A%7C%20where%20prevalence%20%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%3D%20threshold%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BBy%20using%20affected%20row%20prevalence%2C%20the%20query%20can%20detect%20not%20only%20outliers%20from%20normal%20operation%20with%20a%20high%20number%20of%20affected%20rows%2C%20but%20also%20outliers%20with%20low%20affected%20row%20counts.%20An%20abnormally%20low%20number%20of%20affected%20rows%20may%20be%20indicative%20of%20manual%20SQL%20injection%20or%20SQL%20reconnaissance%20activity.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BH3%20id%3D%22toc-hId-1204504054%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BExecution%20Time%20Anomaly%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FH3%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BAs%20explored%20earlier%2C%20time-based%20SQLi%20is%20a%20reconnaissance%20technique%20that%20uses%20SQL%20commands%20to%20purposely%20delay%20execution.%20It%20is%20also%20common%20for%20SQLi%20attacks%20to%20result%20in%20longer%20execution%20times%20than%20normal%2C%20this%20is%20because%20the%20attack%20may%20introduce%20additional%20processing.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThis%20hunting%20query%20uses%20the%20Kusto%20%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-explorer%2Fkusto%2Fquery%2Fseries-decompose-anomaliesfunction%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Bseries_decompose_anomalies%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FA%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20function%20to%20detect%20queries%20that%20are%20executed%20in%20an%20anomalous%20amount%20of%20time.%20The%20following%20Kusto%20is%20used%20to%20prepare%20the%20processed%20data%20so%20that%20series_decompose_anomalies%20can%20be%20executed%20across%20it.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BFirst%2C%20the%20query%20will%20summarise%20all%20SQL%20query%20operations%20by%20each%20user%20into%201-hour%20bins.%20The%20query%20will%20then%20summarise%20the%20average%20duration%20of%20the%20query%20grouping%20on%20user%20and%20application%20to%20provide%20a%20list%20of%20query%20durations.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BprocessedData%0A%2F%2FBin%20the%20data%20into%201h%20windows%2C%20taking%20the%20average%20of%20exeuction%20time%0A%7C%20summarize%20round(avg(DurationMs)%2C%202)%2C%20min(TimeGenerated)%2C%20max(TimeGenerated)%20by%20PrincipalName%2C%20ApplicationName%2C%20bin(TimeGenerated%2C%20timeSliceSize)%0A%2F%2FSummarise%20by%20user%20and%20application%20and%20create%20list%20ready%20for%20anomaly%20detection%0A%7C%20summarize%20make_list(avg_DurationMs)%2C%20make_list(min_TimeGenerated)%2C%20make_list(max_TimeGenerated)%20by%20PrincipalName%2C%20ApplicationName%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BWith%20the%20data%20prepared%2C%20series_decompose_anomalies%20can%20be%20applied%20to%20the%20list%20of%20durations%20to%20detect%20outliers.%20This%20will%20identify%20hours%20where%20the%20average%20query%20duration%20increases%2C%20providing%20us%20with%20periods%20of%20time%20where%20possible%20time%20based%20SQLi%20could%20have%20occurred.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%7C%20extend%20series_decompose_anomalies(list_avg_DurationMs%2C%20scoreThreshold%2C%20-1%2C%20'linefit')%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BFinally%2C%20the%20query%20will%20expand%20the%20results%20of%20series_decompose_anomalies%20and%20re-join%20them%20with%20the%20original%20query.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%7C%20mv-expand%20TimeAnomaly%3Dseries_decompose_anomalies_list_avg_DurationMs_ad_flag%2C%20WindowStart%3Dlist_min_TimeGenerated%2C%20WindowEnd%3Dlist_max_TimeGenerated%0A%7C%20project%20WindowStart%2C%20WindowEnd%2C%20PrincipalName%2C%20ApplicationName%2C%20TimeAnomaly%0A%7C%20where%20TimeAnomaly%20%3D%3D%201%20%0A%2F%2FSplit%20the%20query%20here%20to%20see%20raw%20anomaly%20results%0A%2F%2FThe%20next%20section%20will%20re-join%20back%20to%20the%20SQL%20diagnostics%20data%20to%20%0A%2F%2Fdisplay%20the%20queries%20executed%20within%20the%20anomalous%20windows%20identified%0A%7C%20extend%20joinKey%20%3D%20strcat(PrincipalName%2C%20ApplicationName)%0A%7C%20join%20kind%3Dleftouter%20(%0A%20%20%20%20processedData%0A%20%20%20%20%7C%20project%20ApplicationName%2C%20PrincipalName%2C%20Statement%2C%20TimeGenerated%2C%20DurationMs%0A%20%20%20%20%7C%20extend%20joinKey%20%3D%20strcat(PrincipalName%2C%20ApplicationName)%0A)%20on%20joinKey%0A%7C%20where%20TimeGenerated%20between%20(todatetime(WindowStart)%20..%20todatetime(WindowEnd))%0A%7C%20project%20TimeGenerated%2C%20TimeAnomaly%2C%20WindowStart%2C%20WindowEnd%2C%20PrincipalName%2C%20ApplicationName%2C%20Statement%2C%20DurationMs%2C%20ResourceId%2C%20ClientIp%2C%20HostName%0A%7C%20order%20by%20DurationMs%20desc%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThe%20resolution%20and%20the%20anomaly%20decompose%20threshold%20can%20both%20be%20configured.%20The%20anomaly%20threshold%20allows%20you%20to%20control%20how%20strong%20the%20anomaly%20must%20be%20before%20a%20result%20is%20returned%2C%20increasing%20this%20value%20will%20effectively%20make%20the%20query%20less%20sensitive%20to%20minor%20fluctuations.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BH3%20id%3D%22toc-hId--602950409%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BBoolean%20Blind%20SQLi%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FH3%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BAs%20covered%20earlier%20in%20the%20post%2C%20Boolean%20blind%20SQLi%20is%20one%20of%20the%20most%20common%20SQL%20injection%20reconnaissance%20techniques%20and%20is%20often%20used%20by%20automated%20database%20takeover%20tools.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThis%20hunting%20query%20will%20process%20the%20SQL%20statement%20to%20extract%20both%20sides%20of%20a%20Boolean%20expression.%20The%20query%20will%20first%20identify%20SQL%20statements%20with%20an%20%E2%80%9C%3D%E2%80%9D%20are%20part%20of%20their%20structure.%20A%20regular%20expression%20is%20then%20used%20to%20extract%20either%20side%20of%20the%20%E2%80%9C%3D%E2%80%9D%2C%20the%20result%20of%20this%20is%20stored%20as%20the%20right%20and%20left%20side%20of%20the%20query.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Blet%20queryData%20%3D%20processedData%0A%7C%20where%20Statement%20contains%20%22%3D%22%0A%7C%20extend%20extract_equals%20%3D%20extract_all(%40%22(%5Ba-zA-Z0-9%5C-%5C'%5D%2B%5Cs%3F%3D%5Cs%3F%5Ba-zA-Z0-9%5C-%5C'%5D%2B)%22%2C%20Statement)%0A%7C%20where%20isnotempty(extract_equals)%0A%7C%20mv-expand%20extract_equals%0A%7C%20extend%20left%20%3D%20tostring(split(extract_equals%2C%20%22%3D%22%2C%200)%5B0%5D)%0A%7C%20extend%20right%20%3D%20tostring(split(extract_equals%2C%20%22%3D%22%2C%201)%5B0%5D)%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BWe%20then%20need%20to%20separate%20instances%20where%20the%20left%20and%20right%20side%20of%20the%20statement%20is%20wrapped%20in%20quotation%20marks%2C%20using%20a%20regular%20expression%20to%20handle%20parsing%20the%20correct%20portion%20of%20the%20statement.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Blet%20cleanData%20%3D%20queryData%0A%7C%20where%20left%20!has%20%22'%22%20and%20right%20!has%20%22'%22%3B%0A%2F%2FData%20has%20a%20quote%20in%20both%20sides%2C%20we%20need%20to%20parse%20this%20properly%0A%2F%2FWe%20only%20care%20when%20the%20query%20is%20balanced%20e.g.%20'1'%3D'1'%2C%20so%20both%20sides%20will%20have%20a%20quote%0A%2F%2FThis%20allows%20us%20to%20drop%20some%20results%20early%0Alet%20quoteData%20%3D%20queryData%0A%7C%20where%20left%20has%20%22'%22%20and%20right%20has%20%22'%22%0A%7C%20extend%20extract_equals%20%3D%20extract_all(%40%22(%5C'.%2B%5C'%5Cs%3F%3D%5Cs%3F%5C'.%2B%5C')%22%2C%20Statement)%0A%7C%20extend%20left%20%3D%20tostring(split(extract_equals%2C%20%22%3D%22%2C%200)%5B0%5D)%0A%7C%20extend%20right%20%3D%20tostring(split(extract_equals%2C%20%22%3D%22%2C%201)%5B0%5D)%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BFinally%2C%20after%20processing%2C%20we%20can%20check%20to%20see%20if%20the%20SQL%20statement%20contained%20a%20balanced%20parameter%20by%20comparing%20the%20right%20and%20left%20side%20of%20the%20%E2%80%9C%3D%E2%80%9D.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BcleanData%0A%7C%20union%20quoteData%0A%7C%20where%20left%20%3D%3D%20right%0A%7C%20extend%20alertText%20%3D%20strcat(left%2C%20%22%3D%22%2C%20right)%0A%7C%20summarize%20AlertText%3Dmake_list(alertText)%20by%20TimeGenerated%2C%20Database%2C%20ClientIp%2C%20PrincipalName%2C%20Statement%2C%20ApplicationName%2C%20ResourceId%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BH3%20id%3D%22toc-hId-1884562424%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FH3%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BH3%20id%3D%22toc-hId-77107961%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BPrevalence%20Based%20Query%20Size%20Anomaly%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FH3%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BSQL%20injection%20will%20usually%20result%20in%20more%20parameters%20being%20added%20into%20the%20query.%20It%20is%20normal%20not%20possible%20for%20the%20attacker%20to%20remove%20existing%20parameters%20which%20are%20used%20by%20the%20legitimate%20page%20that%20is%20being%20exploited.%20As%20parameters%20will%20be%20appended%20to%20an%20existing%20query%2C%20it%E2%80%99s%20possible%20to%20baseline%20and%20then%20detect%20unusual%20numbers%20of%20parameters%20for%20a%20given%20user%20and%20application%20combination.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThis%20query%20uses%20a%20prevalence%20calculation%20to%20identify%20queries%20that%20have%20an%20unusual%20number%20of%20parameters%20for%20a%20given%20application%20and%20user.%20First%20the%20number%20of%20queries%20for%20each%20user%20and%20application%20group%20is%20calculated%2C%20this%20is%20stored%20as%20the%20total%20count%20of%20the%20overall%20prevalence%20of%20each%20query%20size%20can%20be%20calculated%20later.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Blet%20total%20%3D%20processedData%0A%7C%20summarize%20count()%20by%20PrincipalName%2C%20ApplicationName%0A%7C%20extend%20key%20%3D%20strcat(PrincipalName%2C%20ApplicationName)%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BNext%2C%20the%20query%20splits%20the%20query%20up%20using%20%E2%80%9C%3D%E2%80%9D%20and%20a%20space%20as%20delimiters.%20Roughly%20each%20%E2%80%9C%3D%E2%80%9D%20indicates%20an%20SQL%20parameter%20whilst%20each%20space%20represents%20a%20new%20token%2C%20or%20query%20component.%20The%20query%20will%20then%20summarise%20to%20count%20the%20number%20of%20tokens%20based%20on%20the%20username%2C%20application%2C%20and%20number%20of%20tokens.%20This%20provides%20us%20with%20counts%20for%20each%20unique%20number%20of%20tokens%20based%20on%20the%20username%20and%20password.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Blet%20anomalyData%20%3D%20processedData%0A%2F%2FSplitting%20on%20%22%3D%22%20provides%20a%20good%20estimate%20to%20the%20parameters%0A%7C%20extend%20parameters%20%3D%20countof(Statement%2C%20%22%3D%22)%0A%2F%2FSplitting%20on%20space%20provides%20a%20good%20estimate%20to%20the%20tokens%20in%20the%20query%0A%7C%20extend%20tokens%20%3D%20array_length(split(Statement%2C%20%22%20%22))%0A%7C%20summarize%20count()%2C%20make_set(parameters)%2C%20make_list(TimeGenerated)%2C%20make_list(ClientIp)%2C%20dcount(ClientIp)%2C%20min(TimeGenerated)%2C%20max(TimeGenerated)%2C%20make_list(Statement)%20by%20tokens%2C%20PrincipalName%2C%20ApplicationName%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BNow%20that%20we%20have%20the%20total%20number%20of%20queries%20executed%20by%20each%20username%20and%20application%2C%20we%20can%20calculate%20the%20prevalence%20for%20each%20number%20of%20tokens%20observed.%20If%20that%20number%20of%20tokens%20represents%20less%20than%2010%25%20of%20the%20total%20queries%20executed%2C%20a%20row%20will%20be%20returned.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%7C%20extend%20key%20%3D%20strcat(PrincipalName%2C%20ApplicationName)%0A%7C%20join%20kind%3Dleftouter%20(total)%20on%20key%0A%7C%20extend%20prevalence%20%3D%20toreal(count_)%20%2F%20toreal(count_1)%20*%20100%0A%7C%20where%20prevalence%20%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%3D%20prevalenceThreshold%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BSQL%20applications%2C%20especially%20those%20that%20have%20pre-defined%20database%20interactions%2C%20generally%20produce%20consistent%20outcomes%20this%20query%20can%20help%20to%20flag%20anomalies%20where%20an%20unusual%20number%20of%20tokens%20were%20observed.%20There%20are%20limitations%20to%20this%20hunting%20query%2C%20if%20the%20attacker%20uses%20the%20same%20number%20of%20tokens%20as%20a%20legitimate%20function%2C%20no%20result%20will%20be%20returned.%20This%20query%20also%20needs%20application%20behaviour%20to%20be%20predictable%20and%20is%20most%20effective%20with%20applications%20such%20as%20content%20management%20systems%20and%20other%20web%20applications.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThe%20query%20that%20is%20bundled%20as%20part%20of%20the%20SQL%20solution%20also%20allows%20additional%20filtering%3B%20this%20includes%20the%20ability%20to%20detect%20anomalies%20that%20only%20occurred%20on%20a%20single%20day.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BH3%20id%3D%22toc-hId--1730346502%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BTime%20Based%20Query%20Size%20Anomaly%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FH3%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThis%20hunting%20query%20uses%20a%20similar%20mechanism%20to%20the%20Prevalence%20based%20query%20size%20anomaly%2C%20however%2C%20instead%20of%20using%20prevalence%20to%20detect%20outliers%2C%20this%20query%20uses%20series_decompose_anomalies%20to%20detect%20spikes%20in%20the%20number%20of%20parameters%20or%20token%20for%20a%20given%20day%20of%20the%20week.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BFirst%20the%20query%20needs%20to%20prepare%20data%20for%20the%20series_decompose_anomalies%20function.%20Data%20is%20summarized%20into%201-day%20bins%20whilst%20calculating%20the%20average%20number%20of%20tokens%20and%20parameters%20for%20that%20window.%20The%20data%20is%20then%20summarized%20using%20the%20username%20an%20application%20name%20to%20create%20lists%20of%20token%20and%20parameter%20averages.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BprocessedData%0A%2F%2FSplitting%20on%20%22%3D%22%20provides%20a%20good%20estimate%20to%20the%20number%20of%20parameters%20in%20the%20query%0A%7C%20extend%20parameters%20%3D%20countof(Statement%2C%20%22%3D%22)%0A%2F%2FSplitting%20on%20space%20provides%20a%20good%20estimate%20to%20the%20tokens%20in%20the%20query%0A%7C%20extend%20tokens%20%3D%20array_length(split(Statement%2C%20%22%20%22))%0A%2F%2FBin%20the%20data%20into%201%20day%20windows%2C%20taking%20the%20average%20of%20tokens%20and%20parameters%20for%20that%20user%20and%20application%20during%20the%20period%0A%7C%20summarize%20round(avg(tokens)%2C%202)%2C%20round(avg(parameters)%2C2)%2C%20min(TimeGenerated)%2C%20max(TimeGenerated)%20by%20PrincipalName%2C%20ApplicationName%2C%20bin(TimeGenerated%2C%20resolution)%0A%2F%2FSummarise%20by%20user%20and%20application%20and%20create%20lists%20ready%20for%20anomaly%20detection%0A%7C%20summarize%20make_list(avg_tokens)%2C%20make_list(avg_parameters)%2C%20make_list(min_TimeGenerated)%2C%20make_list(max_TimeGenerated)%20by%20PrincipalName%2C%20ApplicationName%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BWith%20the%20prepared%20data%20we%20can%20call%20series_decompose_anomalies%20to%20identify%20anomalies%20in%20the%20number%20of%20tokens%20and%20parameters%20for%20a%20given%20day.%20We%20will%20then%20keep%20results%20where%20a%20positive%20or%20negative%20anomaly%20is%20detected%20(too%20few%20or%20too%20many%20tokens%20for%20that%20day%20when%20compared%20to%20the%20baseline).%20It%E2%80%99s%20also%20important%20to%20record%20the%20start%20and%20end%20time%20of%20this%20activity%20so%20that%20we%20know%20when%20the%20anomaly%20occurred.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%7C%20extend%20series_decompose_anomalies(list_avg_tokens%2C%20scoreThreshold%2C%20-1%2C%20'linefit')%2C%20series_decompose_anomalies(list_avg_parameters%2C%20scoreThreshold%2C%20-1%2C%20'linefit')%0A%7C%20mv-expand%20TokenAnomaly%3Dseries_decompose_anomalies_list_avg_tokens_ad_flag%2C%20ParameterAnomaly%3Dseries_decompose_anomalies_list_avg_parameters_ad_flag%2C%20WindowStart%3Dlist_min_TimeGenerated%2C%20WindowEnd%3Dlist_max_TimeGenerated%0A%7C%20project%20WindowStart%2C%20WindowEnd%2C%20PrincipalName%2C%20ApplicationName%2C%20TokenAnomaly%2C%20ParameterAnomaly%0A%2F%2FEnable%20to%20detect%20SQL%20statement%20token%20anomalies%0A%7C%20where%20TokenAnomaly%20%3D%3D%201%20or%20TokenAnomaly%20%3D%3D%20-1%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BFinally%2C%20the%20query%20will%20create%20a%20join%20key%20using%20the%20username%20and%20application%20name%20to%20re-join%20back%20to%20the%20original%20dataset.%20The%20start%20and%20end%20times%20recorded%20earlier%20can%20now%20be%20used%20to%20surface%20results%20within%20the%20time%20window%20of%20the%20anomaly.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%7C%20extend%20joinKey%20%3D%20strcat(PrincipalName%2C%20ApplicationName)%0A%7C%20join%20kind%3Dleftouter%20(%0A%20%20%20%20processedData%0A%20%20%20%20%7C%20project%20ApplicationName%2C%20PrincipalName%2C%20Statement%2C%20TimeGenerated%0A%20%20%20%20%7C%20extend%20joinKey%20%3D%20strcat(PrincipalName%2C%20ApplicationName)%0A)%20on%20joinKey%0A%7C%20where%20TimeGenerated%20between%20(todatetime(WindowStart)%20..%20todatetime(WindowEnd))%0A%7C%20extend%20Parameters%20%3D%20countof(Statement%2C%20%22%3D%22)%0A%7C%20extend%20Tokens%20%3D%20array_length(split(Statement%2C%20%22%20%22))%0A%7C%20project%20TimeGenerated%2C%20ParameterAnomaly%2C%20Parameters%2C%20TokenAnomaly%2C%20Tokens%2C%20WindowStart%2C%20WindowEnd%2C%20PrincipalName%2C%20ApplicationName%2C%20Statement%0A%7C%20order%20by%20Tokens%20desc%2C%20Parameters%20desc%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThe%20results%20returned%20will%20represent%20activity%20occurring%20with%20an%20unusual%20number%20of%20tokens%20and%20parameters%20for%20that%20given%20time%20of%20day.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BH3%20id%3D%22toc-hId-757166331%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BSuspicious%20Stored%20Procedures%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FH3%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BUsing%20the%20MSTIC%20sensor%20network%2C%20MSTIC%20can%20observe%20the%20most%20used%20commands%20by%20attackers%20when%20they%20gain%20access%20to%20an%20SQL%20database.%20Using%20this%20information%2C%20this%20hunting%20query%20will%20show%20SQL%20queries%20that%20contain%20the%20most%20abused%20SQL%20stored%20procedures.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-csharp%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Blet%20abusedProcedures%20%3D%20dynamic(%5B%22xp_cmdshell%22%2C%20%22xp_regwrite%22%2C%20%22xp_regdeletekey%22%2C%20%22xp_regdeletevalue%22%2C%20%22xp_dirtree%22%2C%20%22xp_fileexist%22%2C%20%22xp_msver%22%2C%20%22xp_makecab%22%2C%20%22xp_sqlshell%22%2C%20%22xp_fixeddrivesd%22%2C%20%22xp_regread%22%2C%20%22sp_configure%22%2C%20%22sp_oacreate%22%2C%20%22sp_password%22%2C%20%22sp_OACreate%22%2C%20%22sp_addextendedproc%22%2C%20%22sp_dropextendedproc%22%2C%20%22sp_makewebtask%22%2C%20%22sp_delete%22%2C%20%22SP_OAcreate%22%2C%20%22sp_OADestroy%22%5D)%3B%0AAzureDiagnostics%0A%7C%20where%20Category%20%3D~%20%22SQLSecurityAuditEvents%22%0A%7C%20where%20statement_s%20has_any%20(abusedProcedures)%0A%7C%20project%20TimeGenerated%2C%20SubscriptionId%2C%20ResourceId%2C%20ClientIp%3Dclient_ip_s%2C%20PrincipalName%3Dsession_server_principal_name_s%2C%20statement_s%2C%20action_id_s%2C%20HostName%3Dhost_name_s%2C%20ApplicationName%3Dapplication_name_s%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThe%20of%20the%20above%20commands%20are%20often%20abused%20as%20they%20allow%20attackers%20to%20progress%20their%20access%20from%20only%20the%20SQL%20database%20onto%20the%20underlying%20server.%20Executing%20command%20line%2C%20manipulating%20registry%20keys%2C%20and%20performing%20directory%20traversal%20are%20all%20key%20components%20to%20successful%20onward%20exploitation.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BCommands%20such%20as%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bquot%3B%20xp_dirtree%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bquot%3B%20can%20be%20exploited%20to%20%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BA%20href%3D%22https%3A%2F%2Fmedium.com%2F%40markmotig%2Fhow-to-capture-mssql-credentials-with-xp-dirtree-smbserver-py-5c29d852f478%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Ballow%20attackers%20to%20capture%20MSSQL%20credentials%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FA%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B.%20This%20is%20especially%20useful%20if%20the%20attacker%20only%20has%20access%20via%20SQLi%20through%20a%20web%20application%20as%20it%20grants%20them%20direct%20database%20access.%20Credentials%20may%20also%20be%20reused%20to%20access%20other%20systems%20in%20the%20network.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BAll%20the%20above%20procedures%20are%20%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Bnot%20supported%20on%20Azure%20SQL%20Databases%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B.%20This%20is%20because%20Azure%20SQL%20Databases%20run%20in%20a%20shared%20environment.%20Presence%20of%20these%20commands%20in%20Azure%20SQL%20Database%20logging%20likely%20indicates%20random%20attempts%20if%20your%20database%20is%20exposed%20to%20the%20open%20internet.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BIf%20you%20are%20running%20your%20own%20SQL%20server%20it%20is%20recommended%20that%20you%20disabled%20commands%20that%20are%20not%20in%20use.%20Many%20of%20these%20commands%20are%20disabled%20by%20default.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BFirst%20you%20must%20enable%20advanced%20options%3A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-sql%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BEXEC%20sp_configure%20'show%20advanced%20options'%2C%201%0ARECONFIGURE%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThen%20you%20can%20disable%20the%20chose%20procedure%2C%20for%20example%3A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSTRONG%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bpre%20class%3D%22lia-code-sample%20language-sql%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BEXEC%20sp_configure%20'xp_dirtree'%2C%200%0ARECONFIGURE%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fcode%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fpre%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BIf%20you%20leave%20any%20of%20these%20procedures%20enabled%20a%20trap%20should%20be%20set%20in%20your%20SIEM%20for%20when%20they%20are%20executed.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BH2%20id%3D%22toc-hId--1179370851%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BConclusion%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FH2%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThe%20Azure%20Sentinel%20SQL%20solution%20allows%20security%20analysts%20and%20administrators%20to%20rapidly%20deploy%20a%20range%20of%20detection%20and%20hunting%20queries%20to%20their%20Azure%20Sentinel%20environment.%20As%20you%20have%20seen%2C%20there%20are%20numerous%20ways%20that%20SQL%20attacks%20can%20be%20detected.%20The%20ever-changing%20security%20landscape%20means%20it%E2%80%99s%20not%20always%20possible%20to%20detect%20attacks%20with%20a%20single%20query.%20It%E2%80%99s%20important%20to%20develop%20diverse%20detection%20and%20hunting%20queries%20using%20numerous%20novel%20approaches%20to%20provide%20the%20best%20possible%20visibility%20of%20SQL%20attacks.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BWe%20hope%20this%20blog%20post%20has%20provided%20insight%20into%20how%20our%20detection%20and%20hunting%20queries%20work%2C%20and%20we%20are%20excited%20to%20see%20new%20Hunting%20and%20Detection%20queries%20built%20by%20the%20community.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BAll%20the%20queries%20in%20this%20post%20can%20be%20found%20in-full%20within%20the%20Azure%20Sentinel%20SQL%20solution.%20Additional%20hunting%20and%20detection%20queries%20written%20for%20Azure%20Sentinel%20can%20be%20found%20on%20the%20%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BAzure%20Sentinel%20GitHub%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FA%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-body%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-teaser%20id%3D%22lingo-teaser-2597961%22%20slang%3D%22en-US%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bspan%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%228d19deba-2956-4b96-ab96-ddf496cfe99e.jfif%22%20style%3D%22width%3A%20998px%3B%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Bimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301786iF4F59C196A897894%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%228d19deba-2956-4b96-ab96-ddf496cfe99e.jfif%22%20alt%3D%228d19deba-2956-4b96-ab96-ddf496cfe99e.jfif%22%20%2F%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Fspan%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BExplore%20the%20queries%20develop%20by%20Microsoft%20Threat%20Intelligence%20Center%20(MSTIC)%20and%20Azure%20Defender%20and%20released%20as%20part%20of%20the%20Azure%20SQL%20Solution.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-teaser%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-labs%20id%3D%22lingo-labs-2597961%22%20slang%3D%22en-US%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BAzure%20Sentinel%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BDetection%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BHunting%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BSecurity%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-labs%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%3C%2FSCRIPT%3E%3C%2FSTRONG%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎Aug 09 2021 10:14 AM
Updated by:
www.000webhost.com