Path: blob/master/Guided Investigation - Azure WAF SQLI.ipynb
3249 views
Azure WAF SQLI Incident Triage Notebook
Version: 1.0
Data Sources Required: AzureDiagnostics, SecurityAlert
This Notebook is designed to help you triage incidents generated from Azure Front Door Web Application Firewall (WAF) SQL injection (SQLI) events.
You can use it to help determine if these incidents are True Positive, Benign Positive or False Positive and if False Positive add additional exclusions to your WAF policy to prevent further occurrence.
In order to use this Notebook you need to have Analytics generating incidents related to Azure Front Door WAF SQLI events in your Sentinel workspace, as well as permissions to access and update WAF rules in Front Door.
More details about Azure Front Door WAF can be found here: https://learn.microsoft.com/en-us/azure/web-application-firewall/afds/afds-overview
Notebook initialization
Before running this notebook ensure you have MSTICPy installed with the Azure extras.
The next cell:
Imports the required packages into the notebook
Sets a number of configuration options.
More details...
This should complete without errors. If you encounter errors or warnings look at the following two notebooks:
- TroubleShootingNotebooks
- ConfiguringNotebookEnvironment
If you are running in the Microsoft Sentinel Notebooks environment (Azure Notebooks or Azure ML) you can run live versions of these notebooks: - Run TroubleShootingNotebooks
- Run ConfiguringNotebookEnvironment
You may also need to do some additional configuration to successfully use functions such as Threat Intelligence service lookup and Geo IP lookup. There are more details about this in the ConfiguringNotebookEnvironment notebook and in these documents:
- msticpy configuration
- Threat intelligence provider configuration
Authenticate to Microsoft Sentinel APIs and Select Subscriptions
The notebook is expecting your Microsoft Sentinel Tenant ID, Subscription ID, Resource Group name, Workspace name, and Workspace ID to be configured in msticpyconfig.yaml in the current folder or location specified by MSTICPYCONFIG environment variable.
For help with setting up your msticpyconfig.yaml file see the Setup section at the end of this notebook, the ConfigureNotebookEnvironment notebook or https://msticpy.readthedocs.io/en/latest/getting_started/msticpyconfig.html
These cells connect to the Microsoft Sentinel APIs and the Log Analytics data store behind it.
In order to use this the user must have at least read permissions on the Microsoft Sentinel workspace.
Select the Workspace you want to connect to from the list of workspaces configured in your msticpyconfig.yaml file and then authenticate to this workspace.
Note: you may be asked to authenticate twice, once for the APIs and once for the Log Analytics workspace.
Get SQLI Incidents
The first step of the investigation is to find the Azure Front Door WAF SQLI incidents to triage, to do that we look for any incidents generated from Analytics looking at SQLI events from WAF logs.
Review the details of incidents below and select one to triage further.
Review details of the incident
Review the details below to understand the core details of the incident selected.
Review TI results
The following cell takes any Entities associated with the Incident selected and checks if they appear in Threat Intelligence feeds to provide further context.
Documentation on Incident entities can be found here: https://learn.microsoft.com/azure/sentinel/incident-investigation
This cell uses MSTICPy's threat intelligence features and will use the providers configured in the msticpyconfig.yaml file. More details on this feature can be found here: https://msticpy.readthedocs.io/en/latest/data_acquisition/TIProviders.html
Get raw events in incident time frame
Now that we have selected an incident to triage we can look at the WAF log events that relate to the incident, along with details of the WAF rule that triggered the incident.
Review the details in the cells below and select a specific event to see further details in the cells below.
Review other events related to this rule
Look at other events associated with the event above to understand the context of this WAF rule and its historical activity.
Determine the incident status.
Based on the above details determine whether the incident is a False Positive, True Positive or Benign Positive.
This status will be reflected in the incident within the Sentinel portal.
If the above incident is determined to be a false positive you can add exclusions to the WAF rule-set to prevent further alerts.
These exclusions are applied at the WAF level and can prevent future WAF blocks based on set parameters.
More details of WAF exclusions can be found here: https://learn.microsoft.com/en-us/azure/web-application-firewall/afds/waf-front-door-exclusion
Use the cells below to review the currently deployed policy and define and deploy the exclusions.
Select the number of exclusions that you want to add to the WAF rule:
Define the exclusions you want to apply to the rule.
Ref: https://learn.microsoft.com/en-us/azure/web-application-firewall/afds/waf-front-door-exclusion
The cell below takes the new exclusions defined above and adds them to the currently set exclusions.
Review Updated Exclusion Rules
Below you can see the exclusion rules newly applied to validate they are as expected.
Update Incident
Now the exclusions have been put in place we can update the incident in Microsoft Sentinel to reflect this.
Appendix
Configuration
msticpyconfig.yaml configuration File
You can configure primary and secondary TI providers and any required parameters in the msticpyconfig.yaml file. This is read from the current directory or you can set an environment variable (MSTICPYCONFIG) pointing to its location.
To configure this file see the ConfigureNotebookEnvironment notebook