Most AI data leaks don't involve an attacker. They involve a capable employee with a deadline who pastes a client list, a contract or a chunk of source code into whichever AI tool is open in the next tab. Microsoft's 2026 Data Security Index put it plainly: about a third of surveyed organisations' data security incidents involved generative AI tools, and fewer than half had controls aimed specifically at AI.

The SOC's job here isn't to stop people using AI. It's to know which AI is in use, spot the moments where real data is leaving, and give the business the evidence to make policy. This post covers the detection side across network, endpoint, identity and browser, with KQL for Sentinel and Defender XDR and SPL for proxy data in Splunk.

Complete Bundle · $79 · Best Value
Everything — triage, IR runbooks, threat hunting playbook, quick reference. 8 documents total
Save $9 vs buying separately. PDF + DOCX, all platforms. Instant download, keep forever.
Get Complete Bundle — $79 →

What "shadow AI" actually covers in 2026

It's not just chatbots in a browser any more. When you scope a program, cover all six channels, because they leak different data and show up in different logs:

ChannelTypical leakWhere you see it
Consumer AI chat in the browserPasted text, uploaded filesProxy/SWG, DeviceNetworkEvents, Purview Endpoint DLP
AI browser extensionsEverything on every page the extension can readDefender TVM browser extension inventory
API keys in scripts and toolsSource code, datasets, customer records in bulkNon-browser processes calling model APIs
AI SaaS connected through OAuthMail, calendar, files, meeting recordingsAuditLogs consent events
Local LLM runtimesLess leakage, but unvetted models and exposed portsProcess and listening-port events
AI coding agents and MCP serversRepo contents, secrets in config, broad local file accessProcess events on developer machines

Detection 1: inventory who uses which AI services

Start with visibility, not alerts. This query gives you a ranked view of AI services by users and devices from Defender for Endpoint network telemetry. It runs without a proxy, which matters for remote users who never touch your corporate egress. Put the domain list in a watchlist so it can be updated without editing rules. New services appear monthly.

Sentinel KQL — Shadow AI inventory: AI service usage by users and devices (Defender for Endpoint)
let AiDomains = dynamic([
    "chatgpt.com", "chat.openai.com", "api.openai.com", "claude.ai", "api.anthropic.com",
    "gemini.google.com", "aistudio.google.com", "generativelanguage.googleapis.com",
    "copilot.microsoft.com", "perplexity.ai", "chat.deepseek.com", "api.deepseek.com",
    "chat.mistral.ai", "api.mistral.ai", "grok.com", "poe.com", "huggingface.co",
    "character.ai", "chat.qwen.ai", "openrouter.ai"]);
DeviceNetworkEvents
| where TimeGenerated > ago(7d)
| where isnotempty(RemoteUrl)
| extend Host = tolower(extract(@"^(?:https?://)?([^/:]+)", 1, RemoteUrl))
| where Host has_any (AiDomains)
| summarize Users = dcount(InitiatingProcessAccountUpn), Devices = dcount(DeviceName),
            Connections = count(), TopUsers = make_set(InitiatingProcessAccountUpn, 10)
            by Host
| order by Users desc

Share the output with whoever owns AI policy. The first run usually changes the conversation. Instead of "we should probably think about AI", it becomes "312 people used four unapproved services last week, and here's which ones".

Better catalog, same idea

If you have Defender for Cloud Apps, its Cloud Discovery has a Generative AI app category with a risk score per app. Use that as the source of truth for which services exist, and keep the KQL for alerting and correlation. Marking an app "Unsanctioned" there can also block it on endpoints through Defender for Endpoint network protection.

Detection 2: upload volume outliers to AI services

A user who normally sends a few kilobytes of prompts per day and suddenly uploads 80 MB to an AI service is uploading files. If your proxy or SWG logs to Sentinel through CEF, CommonSecurityLog has the byte counts. Compare each user against their own 14-day baseline, not against the whole company.

Sentinel KQL — AI upload outliers: today's MB sent per user vs their own 14-day baseline (proxy/SWG via CEF)
let AiDomains = dynamic(["chatgpt.com", "chat.openai.com", "claude.ai", "gemini.google.com",
                         "perplexity.ai", "chat.deepseek.com", "chat.mistral.ai", "grok.com", "poe.com"]);
let Daily = CommonSecurityLog
    | where TimeGenerated > ago(15d)
    | where DestinationHostName has_any (AiDomains)
    | summarize SentMB = sum(SentBytes) / 1048576.0 by SourceUserName, Day = startofday(TimeGenerated);
let Baseline = Daily
    | where Day < startofday(now())
    | summarize AvgMB = avg(SentMB), StdMB = stdev(SentMB), ActiveDays = count() by SourceUserName;
Daily
| where Day == startofday(now())
| join kind=leftouter Baseline on SourceUserName
| extend AvgMB = coalesce(AvgMB, 0.0), StdMB = coalesce(StdMB, 0.0)
| where SentMB > 10 and SentMB > AvgMB + 3 * StdMB
| project SourceUserName, TodayMB = round(SentMB, 1), AvgMB = round(AvgMB, 1),
          StdMB = round(StdMB, 1), ActiveDays
| order by TodayMB desc

The same logic in Splunk, against the CIM Web data model:

Splunk SPL — AI upload outliers per user vs own baseline (CIM Web data model)
| tstats summariesonly=true sum(Web.bytes_out) AS bytes_out FROM datamodel=Web
    WHERE earliest=-15d@d (Web.dest="chatgpt.com" OR Web.dest="claude.ai" OR Web.dest="gemini.google.com"
        OR Web.dest="perplexity.ai" OR Web.dest="chat.deepseek.com" OR Web.dest="chat.mistral.ai")
    BY Web.user _time span=1d
| rename Web.user AS user
| eval mb_out=round(bytes_out/1048576, 2), is_today=if(_time>=relative_time(now(), "@d"), 1, 0)
| eventstats avg(eval(if(is_today=0, mb_out, null()))) AS avg_mb
             stdev(eval(if(is_today=0, mb_out, null()))) AS std_mb BY user
| fillnull value=0 avg_mb std_mb
| where is_today=1 AND mb_out > 10 AND mb_out > avg_mb + 3*std_mb
| table user mb_out avg_mb std_mb

Be honest about what this misses: a pasted client list is a few kilobytes and will never stand out on volume. Volume catches file uploads. Pasted text needs content inspection, which is what Purview Endpoint DLP or your SWG's inline DLP is for (covered below).

Detection 3: API keys in scripts and tools

Browser usage is the visible part. The bigger bulk leaks happen when someone puts a personal API key into a Python script and pipes a customer table through a model to "clean it up". That traffic comes from python.exe, node.exe, curl.exe or an IDE, not a browser, and it goes to API hosts, not chat UIs.

Sentinel KQL — Non-browser processes calling model APIs (personal API keys, scripts, unapproved tools)
let AiApiHosts = dynamic([
    "api.openai.com", "api.anthropic.com", "generativelanguage.googleapis.com",
    "api.deepseek.com", "api.mistral.ai", "api.groq.com", "openrouter.ai",
    "api.together.xyz", "api.perplexity.ai", "api-inference.huggingface.co"]);
let Browsers = dynamic(["chrome.exe", "msedge.exe", "firefox.exe", "brave.exe", "opera.exe", "arc.exe"]);
DeviceNetworkEvents
| where TimeGenerated > ago(7d)
| extend Host = tolower(extract(@"^(?:https?://)?([^/:]+)", 1, RemoteUrl))
| where Host in (AiApiHosts)
| where InitiatingProcessFileName !in~ (Browsers)
| summarize Connections = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated),
            Hosts = make_set(Host, 10), CommandLines = make_set(InitiatingProcessCommandLine, 5)
            by DeviceName, InitiatingProcessAccountUpn, InitiatingProcessFileName,
               InitiatingProcessFolderPath
| order by Connections desc

Azure OpenAI endpoints (*.openai.azure.com) are deliberately not in that list. In most enterprises they're the sanctioned route. A hit here on a server, especially a database or file server, deserves a phone call the same day.

Detection 4: local LLM runtimes

Local models such as Ollama and LM Studio keep data on the machine, which is better than a consumer cloud service. They're still worth knowing about: models downloaded from anywhere, runtimes nobody patches, and the occasional instance listening on all interfaces with no authentication. Ollama's default port is 11434 and LM Studio's is 1234. A listener bound to 0.0.0.0 rather than 127.0.0.1 is exposed to the network.

Sentinel KQL — Local LLM runtimes executed, and any listening on the network
let LocalLlmBinaries = dynamic(["ollama.exe", "ollama app.exe", "lms.exe", "LM Studio.exe",
                                "llama-server.exe", "koboldcpp.exe", "jan.exe", "gpt4all.exe"]);
union
    (DeviceProcessEvents
        | where TimeGenerated > ago(7d)
        | where FileName in~ (LocalLlmBinaries)
        | project TimeGenerated, DeviceName, Account = AccountName,
                  Signal = "Runtime executed", Detail = ProcessCommandLine),
    (DeviceNetworkEvents
        | where TimeGenerated > ago(7d)
        | where ActionType == "ListeningConnectionCreated"
        | where InitiatingProcessFileName in~ (LocalLlmBinaries)
        | project TimeGenerated, DeviceName, Account = InitiatingProcessAccountName,
                  Signal = strcat("Listening ", LocalIP, ":", tostring(LocalPort)), Detail = LocalIP)
| summarize FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated),
            Signals = make_set(Signal, 10) by DeviceName, Account
| extend ExposedToNetwork = tostring(Signals) has "0.0.0.0"
| order by ExposedToNetwork desc, LastSeen desc

Detection 5: AI apps holding mailbox and file access

AI meeting note-takers and "inbox assistants" are the quietest form of shadow AI. A user clicks "Sign in with Microsoft", consents to Mail.Read and Calendars.Read, and a third party now processes their mail indefinitely. It's the same mechanism as consent phishing, just with a legitimate-looking vendor, and it shows up in the same AuditLogs events. The OAuth consent post covers the scope parsing in depth. This is the AI-focused cut:

Sentinel KQL — AI-branded OAuth apps consented in the tenant, with what they can read
let AiAppTerms = dynamic(["AI", "GPT", "Copilot", "Assistant", "Notetaker", "Note Taker", "Otter",
                          "Fireflies", "Fathom", "Gemini", "Claude", "Perplexity", "Transcri", "Meeting"]);
AuditLogs
| where TimeGenerated > ago(30d)
| where OperationName == "Consent to application"
| where Result =~ "success"
| extend AppName     = tostring(TargetResources[0].displayName),
         ConsentedBy = tostring(InitiatedBy.user.userPrincipalName),
         Props       = tostring(TargetResources[0].modifiedProperties)
| where AppName has_any (AiAppTerms)
| extend ReadsMail = Props has "Mail.Read",
         ReadsFiles = Props has_any ("Files.Read", "Sites.Read"),
         ReadsCalendar = Props has "Calendars.Read"
| summarize Users = dcount(ConsentedBy), FirstConsent = min(TimeGenerated), LastConsent = max(TimeGenerated),
            ReadsMail = max(toint(ReadsMail)), ReadsFiles = max(toint(ReadsFiles)),
            ReadsCalendar = max(toint(ReadsCalendar)), SampleUsers = make_set(ConsentedBy, 10)
            by AppName
| order by Users desc

Anything with mail or file scopes and more than a handful of users needs a vendor review. If the review doesn't happen, revoke the grants and tighten user consent settings.

Detection 6: AI browser extensions

An AI extension with permission to "read and change all your data on all websites" sees every internal app, every CRM record and every webmail message the user opens. Defender for Endpoint's vulnerability management module inventories browser extensions and their permissions. These tables live in Defender advanced hunting (they aren't streamed to Sentinel), so run this one there.

Defender XDR KQL — AI-related browser extensions and their high-risk permissions
DeviceTvmBrowserExtensions
| where ExtensionName has_any ("GPT", "AI", "Copilot", "Claude", "Gemini", "Assistant", "Summar", "Writer")
| summarize Devices = dcount(DeviceId) by BrowserName, ExtensionId, ExtensionName, ExtensionVendor, ExtensionRisk
| join kind=leftouter (
    DeviceTvmBrowserExtensionsKB
    | summarize HighRiskPermissions = make_set_if(PermissionName, PermissionRisk in~ ("High", "Critical"))
        by ExtensionId, BrowserName
  ) on ExtensionId, BrowserName
| order by Devices desc

The controls that actually reduce leakage

Detection tells you where you are. These change the outcome:

Get legal and HR aligned first

Several of these queries identify individual users. Before anything turns into an alert that leads to a conversation with someone's manager, agree with legal, privacy and HR what's monitored, what's disclosed in policy, and how findings are handled. In regulated environments especially, monitoring that isn't covered by policy creates its own problem.

Shadow AI is a governance problem that the SOC happens to have the data for. Use the data to show leadership what's actually happening, then help design the controls. The SOC shouldn't be the team playing whack-a-mole with new AI domains every week.

Weekly Intelligence Pack
Production detections like these, every Tuesday

Every issue includes a full detection rule for Sentinel, CrowdStrike or Splunk, with investigation steps, false positive guidance and MITRE mapping. Platforms rotate so you get broad coverage over time.

Join — $14.99/mo See a Sample Issue
Founding member pricing locked for life · 30-day money back