Consuming threat data in a flat file
IOC’s. You can’t afford one of those $70,000 feeds of hashes and IP addresses (and larger companies may be wasting their money anyway), but from time to time you receive you receive a bunch of indicators from a reliable source and you don’t want them to go to waste. If you are a Microsoft shop, step one might be pasting those indicators into a spreadsheet template and uploading them into the MS365 portal. That’s great for protecting yourself right now and going forward, but what about looking back in time to make sure that you weren’t already pwned? Sure, you could construct a query with a huge array, but referencing a text file would be a lot easier.
Here are instructions for using Azure Sentinel to do this
with minimal fuss.
Pre-Requisites: Azure Sentinel Instance with Microsoft
365 Defender Data Connector in place
Ingredient: A simple text file called evilipaddrs.txt which
is just a list of known bad IP’s.
Steps:
Azure Portal -> Create blob storage in the Storage Accounts blade
(You do NOT want to give access for the world at large to this storage)
Browse to Storage Explorer/Blob Containers/Your new storage, click Upload to upload evilipaddrs.txt
Right click on your newly uploaded file and select “Get Shared Access Signature…” – this is to generate a URL you can use in your Sentinel querya.
Note the Start and Expiry Time – you’ll want to
set the expiry time out to a date you are comfortable with
b.
Leave the permissions alone (it should default
to read/list)
c.
Click create and copy the URI on the dialog that
appears and paste it someplace safe
d. Click Close
let badipaddresses = (externaldata(bad_ip: string )
[@"Your URL WILL GO HERE"]
with (format="txt"))
| where bad_ip !startswith "#"
| project bad_ip;
badipaddresses
| join
(
DeviceNetworkEvents
| where TimeGenerated > ago(90d)
Replace "Your URL WILL GO HERE" with the link (keep the quotation marks), and run the query. That’s it!
Other notes:
Instead of Azure Storage, you may
ask, can you just park the file in OneDrive and share it out with a link? That should work, but you might not want to enable the ability to share
a file to “anyone with a link” in the first place.
Google Drive might be an option-
and I tried that – but I don’t see a way to link to a text file that presents
the raw data (and not a web page “viewer” showing the file with a mess of other material you don't want to wade through).
Deeper dives in this topic
https://techcommunity.microsoft.com/t5/azure-sentinel/implementing-lookups-in-azure-sentinel/ba-p/1091306
https://thewindowsupdate.com/2020/01/06/implementing-lookups-in-azure-sentinel-part-1-reference-files/
Comments
Post a Comment