Building a Clean IOC List from M365 Incident Logs for Firewall & CA Blocks
Extracting clean Indicators of Compromise (IOCs) from Microsoft 365 incidents requires isolating verified attacker ClientIPs (stripping Purview ephemeral :port suffixes), rogue OAuth AppIds, scripted UserAgents, and external forwarding domains—while carefully excluding corporate VPN/SASE IPs and shared carrier CG-NAT ranges before pushing Entra Named Location blocks.
Why This Artifact Matters in M365 Incident Response
In the middle of a live Business Email Compromise, SOC teams routinely rush to extract IP addresses from raw logs and shove them into an Entra Conditional Access Named Location block list or perimeter firewall deny list. Without clean deduplication and false-positive filtering, two disasters happen: Purview’s `185.220.101.45:51422` port syntax breaks firewall parsers, OR an analyst accidentally blocks their own company VPN gateway and locks out 500 employees!
Building a clean, verified IOC bundle prevents self-inflicted outages while letting you pivot across SIEM watchlists and threat-intel feeds.
Notice how Purview UAL formats IPv4 and IPv6 addresses inconsistently: `ClientIP` frequently appends an ephemeral TCP port (`185.220.101.45:51422` or `[2001:db8::1]:44312`), whereas Entra Sign-In logs omit ports. AuditVane automatically strips trailing port numbers cleanly during normalization, deduplicates every IP, UPN, UserAgent, and suspicious Target, and ranks them by frequency inside the Extracted IOCs panel and **Export IOCs JSON** download.
Real-World Incident Walkthrough
After triaging a merged BEC + AiTM incident across 3 Purview CSVs and 2 Entra Sign-In JSON exports, an analyst clicks **Export IOCs JSON** in AuditVane. They inspect the deduplicated list—confirming `194.26.135.210` (hosting ASN, tied to `python-requests`) and `45.155.205.19` (tied to `IMAP4` `curl`) are pure attacker infrastructure, while excluding `203.0.113.77` (the employee’s verified Austin home ISP)—and push those two IPs cleanly into an Entra Named Location Block.
Forensic Telemetry Fields & High-Signal Indicators
| Telemetry Field / Pattern | Meaning in M365 / Entra | High-Signal Threat Indicator |
|---|---|---|
Confirmed Proxy / VPS IPs | IPs tied directly to AV-001/003/004 detections | Safe for Entra Named Location Block + SIEM Watchlist |
External Forwarding Targets | ForwardingSmtpAddress / ForwardTo / RedirectTo | Block outbound SMTP & alert email gateway |
Rogue OAuth AppIds | ClientId from AV-005 Consent / AppRole grants | Disable & delete Enterprise App tenant-wide |
Malicious Inbox Rule Names | Rule names & targeted keywords (".", "wire") | Feed into tenant-wide InboxRule sweep |
External Teams TenantIds | ParticipatingTenantIds from vishing chats | Block federated tenant GUID in Teams Admin |
Corporate SASE / Mobile CG-NAT | Shared carrier, Zscaler, Cloudflare or office IPs | NEVER block globally without ASN verification! |
Safe IOCs to Block Globally vs. High-Collateral-Risk IPs
| Indicator Type | Safe for Tenant-Wide Block? | Verification Check First |
|---|---|---|
| Dedicated VPS / Tor Exit tied to AV-003 | Yes (Named Location Block + Firewall) | Confirm ASN is hosting/Tor and zero benign employees use it |
| Rogue External OAuth AppId | Yes (Disable/Delete ServicePrincipal) | Verify AppId is not used by another department |
| External Attacker Drop Email Domain | Yes (Exchange Transport Rule / Defender Block) | Verify not a shared consumer domain like gmail.com globally |
| Domestic Mobile Carrier / Cloudflare IP | NO — High risk of blocking legitimate staff! | Revoke sessions & require FIDO2 instead of IP banning |
AuditVane Exported IOC Summary JSON Structure
{
"summary": { "totalEvents": 7, "criticalEvents": 4, "uniqueIps": 3 },
"iocs": {
"ips": [
{ "value": "185.220.101.45", "count": 5 },
{ "value": "91.214.124.88", "count": 1 }
],
"actors": [{ "value": "finance.director@contoso-demo.invalid", "count": 7 }],
"userAgents": [{ "value": "axios/1.7.7", "count": 1 }, { "value": "Boto3/1.34 Python/3.11", "count": 1 }],
"suspiciousTargets": ["..", "smtp:accounting-audit@external-drop.invalid"]
}
}
Notice how `185.220.101.45:51422` normalized cleanly to `185.220.101.45` (`count: 5`), while `suspiciousTargets` isolated both the stealth rule name (`..`) and the external SMTP drop address.
Push Verified Attacker IPs into an Entra Named Location Block via Graph
Connect-MgGraph -Scopes "Policy.ReadWrite.ConditionalAccess"
# Always verify IPs exclude corporate VPN & shared CDNs first!
$attackerIps = @("185.220.101.45/32", "194.26.135.210/32")
$ranges = $attackerIps | ForEach-Object { @{ "@odata.type" = "#microsoft.graph.iPv4CidrRange"; cidrAddress = $_ } }
New-MgIdentityConditionalAccessNamedLocation -DisplayName "IR-Blocked-Attacker-IPs" -IsTrusted:$false `
-IpRanges $ranges -AdditionalProperties @{ "@odata.type" = "#microsoft.graph.ipNamedLocation" }
Sample Entra Named Location Creation Output
Id DisplayName IsTrusted
-- ----------- ---------
aa119988-7766-5544-3322-1100ffeeddcc IR-Blocked-Attacker-IPs False
Step-by-Step Triage, Containment & Verification
- Filter AuditVane to **Flagged Only** events before reviewing Extracted IOCs so clean employee home/office IPs don’t pollute your block list.
- Click **Export IOCs JSON** in AuditVane to download deduplicated IPs, UPNs, UserAgents, and suspicious targets.
- Cross-reference every candidate IP against your corporate SASE/VPN allowlist and ASN lookup (avoiding global blocks on T-Mobile/AT&T CG-NAT or Cloudflare ranges).
- Sweep all other users across your tenant for those confirmed attacker IPs (`SigninLogs | where IPAddress in (...)`) to verify no second victim clicked the same phishing kit!
- Push verified attacker IPs into an Entra Conditional Access **Blocked Named Location** policy (targeting All Users -> All Cloud Apps -> Block Access) and block external drop domains in Defender Tenant Allow/Block Lists.
How to Verify Containment Completed Cleanly
- Every candidate IP verified NOT to match corporate office, VPN, or legitimate employee ISP before blocking.
- Tenant-wide retrospective sweep completed across all users for every extracted attacker IP.
- External forwarding drop domains added to Microsoft Defender Tenant Block List.
Analyst Blind Spots, Licensing Quirks & False Positives
Don’t rely solely on IP block lists as long-term remediation! Modern phishing kits rotate residential proxy IPs daily—so IP blocks only slow down an active operator for hours, whereas `Revoke-MgUserSignInSession` + Phishing-Resistant MFA + OAuth cleanup close the root vulnerability permanently.
When sweeping IPs across Purview CSVs in Excel/PowerShell, always strip `:port` suffixes first (`$ip -replace ":\d+$",""`).
Frequently Asked Questions
Why does AuditVane strip port numbers from Purview ClientIP fields?
Purview frequently appends ephemeral TCP source ports like `185.220.101.45:51422`. Stripping ports ensures accurate deduplication, matching against Entra Sign-Ins, and firewall-ready CIDR formatting.
Can I export IOCs directly from AuditVane?
Yes! Click Export IOCs JSON or Export Markdown Report inside the workbench filter bar.
Should I block attacker IPs permanently in Entra Named Locations?
Use Named Location blocks for immediate tactical containment while monitoring churn, and enforce FIDO2/Compliant Device Conditional Access for durable protection.
What is the highest-value use of an extracted attacker IP?
Running a tenant-wide retrospective search across ALL employees’ Entra Sign-In logs—phishing campaigns almost always hit more than one recipient!