KQLAlert-ready after reviewShadow AI and AI-powered attackers
Windows script host or HTA connects to an LLM API (PROMPTFLUX pattern)
GTIG describes PROMPTFLUX, a VBScript dropper that sends a hard-coded API key to the Gemini API to have its own code rewritten, and PROMPTSTEAL (APT28), which queries a model through the Hugging Face API to generate commands. Legitimate wscript, cscript or mshta traffic to model APIs is very rare.
- Log source
- Microsoft Defender for Endpoint: DeviceNetworkEvents
- Techniques
- AML.T0096 AI Service API · AML.T0102 Generate Malicious Commands · AML.T0050 Command and Scripting Interpreter
- MITRE ATT&CK
- T1059.005Visual BasicT1218.005MshtaT1027.014Polymorphic Code
- Reviewed
- 2026-11-10
Query
let ai_api_hosts = dynamic(["api.openai.com", "api.anthropic.com", "generativelanguage.googleapis.com", "api.deepseek.com",
"openrouter.ai", "router.huggingface.co"]);
DeviceNetworkEvents
| where Timestamp > ago(30d)
| where InitiatingProcessFileName in~ ("wscript.exe", "cscript.exe", "mshta.exe")
| where isnotempty(RemoteUrl)
| extend RemoteHost = tolower(tostring(parse_url(iff(RemoteUrl contains "://", RemoteUrl, strcat("https://", RemoteUrl))).Host))
| where RemoteHost in (ai_api_hosts) or RemoteHost endswith ".openai.azure.com"
| project Timestamp, DeviceName, InitiatingProcessAccountName, InitiatingProcessFileName,
InitiatingProcessCommandLine, InitiatingProcessParentFileName, RemoteHost, RemoteIP
| order by Timestamp desc Expected false positives
- Legacy in-house VBScript automation that calls an AI API (unusual; confirm with the owner)
Sources
- Google GTIG: AI threat tracker — advances in threat actor usage of AI tools (Nov 2025)
- Gemini API reference (generativelanguage.googleapis.com)
- Hugging Face Inference Providers (router.huggingface.co)
- Elastic rule: Connection to common LLM endpoints by scripting utilities
Reviewed against vendor documentation, not tested in your environment. Defensive use only.