Path: blob/master/Entity Explorer - Account.ipynb
3249 views
Entity Explorer - Account
Notebook Details...
Notebook Version: 2.0
Python Version: Python 3.10
Required Packages: msticpy, msticnb
Data Sources Required:
Sentinel - SecurityAlert, SecurityEvent, HuntingBookmark, Syslog, AAD SigninLogs, AzureActivity, OfficeActivity, ThreatIndicator
(Optional) - VirusTotal, AlienVault OTX, IBM XForce, Open Page Rank, (all require accounts and API keys)
Brings together a series of queries and visualizations to help you determine the security state of an Account.
The account can be a Windows or Linux account or an Azure Active Directory/Office 365 account.
The notebook uses the MSTIC notebooklets package to run most of the functionality. Summarized data is returned when it is run and more detailed information is contained in the returned result class.
Hunting Hypothesis
Our broad initial hunting hypothesis is that a we have received account name entity which is suspected to be compromised and is being used malicious manner in internal networks, we will need to hunt from a range of different positions to validate or disprove this hypothesis.
Notebook initialization
This should complete without errors. If you encounter errors or warnings look at the following notebooks:
If you are running in the Azure Sentinel Notebooks environment (Azure Notebooks or Azure ML) you can run live versions of these notebooks:
[Getting Started](./A Getting Started Guide For Azure Sentinel ML Notebooks.ipynb)
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:
Get Workspace and Authenticate
msticpyconfig.yaml create a connection string with your AAD TENANT_ID and
your WORKSPACE_ID (these should both be quoted UUID strings).
e.g.
Then in the Authentication cell replace the call to qry_prov.connect with the following:
The cell should now look like this:
On successful authentication you should see a popup schema button. To find your Workspace Id go to Log Analytics. Look at the workspace properties to find the ID.
Authentication and Configuration problems?
If you are having problems, expand the details section below
Click for details about configuring your authentication parameters
The notebook is expecting your Azure Sentinel Tenant ID and Workspace ID to be configured in one of the following places:
msticpyconfig.yamlin the current folder or location specified byMSTICPYCONFIGenvironment variable.config.jsonin the current folder
For help with setting up your configuration (if this hasn't been done automatically) see the [Getting Started](./A Getting Started Guide For Azure Sentinel ML Notebooks.ipynb) notebook in the root folder of your Azure-Sentinel-Notebooks project.
Import and initialize notebooklets
This imports the msticnb package and the notebooklets classes.
These are needed for the notebook operations
Enter account name and query time window
Type the account name that you want to search for and the time bounds over which you want to search.
You can specify the account as:
a simple user name (e.g.
alice)a user principal name (
[email protected])a qualified windows user name
mydomain\alice
In the second two cases the domain qualifier will be stripped off before the search. The search is not case sensitive and will match full substrings. E.g. bob will match domain\bob and [email protected] but not bobg or bo.
You can opt to search all data types or just a subset. For example, if you know the account activity that you are interested in is only Windows host activity, you can select "Windows".
The default is All Data but other options are:
Azure (includes Office365 activity, Active Directory Signin logs and Azure audit activity)
Office365 - only Office365 activity
AzureActiveDirectory - only signin logs
Azure - only Azure resource/audit activity
Windows - only Windows host event logs
Linux - only Linux host syslog
Run the main account_summary notebooklet run method
The notebooklet will search Azure, Windows host and Linux host data, searching for account matches.
Note: Different result properties will populated for different account types.
It will display a summary of the information retrieved as it is running. You can find information on accessing the full data later in the notebook.
Note: If more than one matching account name is found, all matches will be shown.
You can select each of these matching accounts to view more details about the account.
Once selected, you can retrieve more detailed information about that account.
The pivot function `account_summary` is in the `nblt` container of the `Account` entity.
In this case you do not have direct access to the methods of the "AccountSummary".
However, all methods and properties of the notebooklet class are accessible via the results class.
is equivalent to
Retrieve additional data for the selected account
The result returned from the last cell has a number of properties and methods that you can use to retrieve and view further information.
The main one for this notebooklet is get_additional_data. Depending on the account type (Azure, Windows or Linux), it will retrieve more detailed data about recent activity
Browse alerts
If there are any alerts referencing this account name they can be viewed by calling the acc_result.browse_alerts() function.
Appendix - Additional properties from the Notebooklet result
Browse other event data
You can use a simple view to make it easier to see the details of individual events by calling the "view_events" method.
You need to supply the name of the result attribute that you want to view plus one or more summary columns (as a list of strings).
Running the following cell will use the data property selected above to browse through the data (if any).
You can also access the DataFrames properties directly
Browse events with alternative sorting
You can pass a DataFrame to result.view_events() instead of an attribute name.
This means that you can apply sorting or filtering of the data before viewing it. Here is an example sorting by IPAddress.
Additional properties and methods of the result object
These are static properties - usually DataFrames or visualizations. You can access each of these to see or manipulate the retrieved data.
To see help on the available attributes type:
To see the available methods type:
Note, for the AccountSummary notebooklet, the two main data retrieval methods are:
run
get_additional_data
There are several other methods that allow you to view individual plots or subsets of the data (such as alerts).
To view help on a specific method type:
To run a method
Viewing the Result class
You can view all of the data in the results class by "running" it in a cell
Note: This produces a lot of output.
Due to the way Jupyter display Javascript objects the plots may appear out of order.
Most of the properties of the results class are pandas DataFrames - you can use these directly for further analysis. Other property types include entities and visualizations.
The DataFrames displayed by running the result object are truncated to the first five rows.
You can also access individual data properties of the result as follows:
Using Pivots to get more context information
You can run a pivot function on the account summary results to get additional context on the data.
Here is an example of looking up Whois information for Azure IPAddress requests.
Use other notebooklets and pivots functions to drill down on other entities
You may want to drill down on other entities in the Account data. You can use methods of the IpAddress or Host entities, for example, to look at these in more detail.
Run the ip_address_summary notebooklet pivot
View the TI results