
AutoJack: How a single page can RCE the host running your AI agent | Microsoft Security Blog
Microsoft Security Research disclosed "AutoJack," an exploit chain in AutoGen Studio (the prototyping UI for Microsoft's AutoGen multi-agent framework) where an agent with browsing capability (e.g., MultimodalWebSurfer) that renders an attacker-controlled webpage can be jacked into opening a WebSocket to the local MCP control plane at /api/mcp/ws. The chain combines three flaws: a localhost-only origin allowlist that the agent's own headless browser satisfies (CWE-1385), an auth middleware that explicitly skips /api/mcp/* paths without the intended WebSocket-level check (CWE-306), and a server_params query parameter that is base64-decoded into StdioServerParams and executed verbatim via stdio_client with no executable allowlist (CWE-78) — letting the page spawn calc.exe or arbitrary commands under the developer's account with no user interaction beyond the agent rendering the page. The issue was fixed pre-PyPI-release upstream (commit b047730) and never shipped in the published autogenstudio package; Microsoft provides mitigation guidance and Defender advanced hunting KQL queries to detect the pattern (suspicious child processes from autogenstudio, WebSocket calls carrying server_params, browser-automation processes reaching non-corporate domains).
What it is
AutoJack is a demonstrative exploit chain in AutoGen Studio's MCP WebSocket surface (Microsoft's AutoGen prototyping UI), from Microsoft's ongoing agent-framework security series (an earlier post covered RCE primitives in Semantic Kernel). It turns a browsing agent into a "confused deputy" that crosses the localhost trust boundary and spawns arbitrary processes on the host. The page states the chain does not work on current builds and was fixed in upstream commit b047730 before any PyPI release included the surface.
How it works
The mechanism the summary flags but doesn't spell out is why the origin allowlist fails: the WebSocket accepts Origin: http://127.0.0.1 / http://localhost. That correctly blocks a human browser pointed at evil.com. But an AutoGen agent's built-in web tooling — MultimodalWebSurfer, fetch_webpage_tool, any Playwright-backed surfer, or a code-execution tool running requests/websockets — is itself a localhost process. JavaScript it renders inherits the localhost identity, so the WebSocket call it makes satisfies the allowlist. The endpoint then takes a server_params query parameter, base64-decodes a JSON blob into StdioServerParams, and hands command + args to stdio_client(...) with no allowlist — calc.exe, powershell.exe -enc …, bash -c '…' all run as "MCP servers." No user interaction beyond getting the agent to render the attacker's page.
flowchart LR
A[Attacker page on open web] --> B{Origin check<br/>localhost only}
B -->|human browser at evil.com| X[Blocked]
B -->|JS run by agent's<br/>headless browser| C[Passes: agent is localhost]
C --> D{Auth middleware}
D -->|/api/mcp/* opt-out| E[No auth check]
E --> F[server_params -> stdio_client<br/>arbitrary command]Preconditions / Affected
Matters only if an agent that can browse untrusted pages also runs on the same host as a privileged local service reachable over loopback. AutoGen Studio installed from PyPI is not exposed to this specific chain. The value here is pattern recognition for other agent frameworks with the same shape.
What to do
The page gives a defensive principle, not commands: when an agent on your server or laptop can browse the open web and talk to privileged local services, treat localhost as an attack surface, not a trust boundary. Control planes must be authenticated, authorized, and isolated. Note the two design traps to audit for elsewhere: origin allowlists that assume localhost = trusted, and auth middleware that opt-outs paths (/api/mcp/*, /api/ws/*) on the assumption the handler does its own check — when it doesn't.
Caveats
This is retrospective and demonstrative: the chain is fixed, doesn't work on current builds, and never shipped in a PyPI release. There is no CVE, patch command, or detection rule to apply — the takeaway is the reusable pattern, not a live fix.
Organisations named here
- CWE-78
Technologies named here
- AutoGen Studio
- AutoGen
- MultimodalWebSurfer
- Microsoft Semantic Kernel
- Playwright-backed surfer
- fetch_webpage_tool
- Model Context Protocol
- stdio_client
- Azure AI Content Safety Prompt Shields
- Microsoft Defender for Cloud AI threat protection
- Microsoft Defender for Cloud AI Security Posture Management
- Microsoft Foundry AI Red Teaming Agent
- PyRIT
- Microsoft Defender
- Microsoft Defender Vulnerability Management
- Microsoft Entra Conditional Access
- Microsoft Entra Privileged Identity Management
- Microsoft Entra Agent ID
- Microsoft Defender for Identity
- Microsoft Dev Box
- Windows Sandbox
- Microsoft Defender for Cloud DevOps Security
- GitHub Advanced Security
- Microsoft Defender advanced hunting / KQL
- Microsoft Security Copilot
- Python
- Playwright
- Flask
- Missing Authentication for Critical Functionality
Techniques named here
- AutoJack
- CWE-1385 - Missing Origin Validation in WebSockets
- CWE-306
- Cross-site WebSocket hijacking
- Confused deputy attack
- Indirect prompt injection / cross-prompt injection attack
- Remote Code Execution via chained web-to-localhost delivery
- Missing Origin Validation in WebSockets
Related in AI Security
