Ryan Hausknecht is the Director of Research at BeyondTrust Phantom Labs. Ryan has an extensive background in red teaming, detection development, and security research through his tenure at Microsoft and Specterops. His most notable contibutions have been in cloud security as the creator of PowerZure, the Azure Threat Research Matrix, and as the co-author of AzureHound.
Simon Maxwell-Stewart is a Staff Security Researcher at BeyondTrust's Phantom Labs, where he focuses on cloud platform security and the emerging attack surface of enterprise AI systems. Before getting into security he spent over a decade doing data science and machine learning, with a physics degree from Oxford and production ML work in healthcare.
These days he's the resident graph nerd on the Phantom Labs team, applying graph analysis to identity security problems across Microsoft cloud environments. His recent research focuses on Entra ID attack paths, Azure infrastructure security.
Abstract
Microsoft Copilot Studio lets anyone build AI agents that execute Python. Behind the scenes, that code runs in a Windows container on Azure Service Fabric, wrapped in a Python sandbox and guarded by a GPT-4.1 mini model that decides what's safe to run. Three layers of defense. The presenter broke all of them.
Starting from a standard agent with code interpreter enabled, we used classic MRO introspection with string concatenation to bypass dunder filters, escaped Python entirely through pythonnet (which nobody thought to block), and systematically defeated the LLM guardrail by exploiting its leaked reasoning chain. The result: exfiltrated TLS private keys and certificates, 75 environment variables including Azure AD client IDs and Service Fabric cluster topology, complete application source code, and confirmed command execution as ContainerUser.
The most interesting finding was the LLM guardrail itself. It is non-deterministic: identical payloads sometimes pass and sometimes get blocked. It leaks its full security reasoning in the API response, turning the defender's AI into an oracle for the attacker. This talk walks through the full attack chain, demos a C2 tool that turns the code interpreter into a persistent shell, and releases all tooling.
- Ned Batchelder, "Eval really is dangerous" (2012). Original documentation of Python MRO introspection for sandbox escape.
- Michael Bargury / Zenity, "Living off Microsoft Copilot" (DEFCON 32, Black Hat USA 2024). Prompt injection and data exfiltration through Copilot connectors. Different attack surface from code interpreter sandbox escape.
- Tobias Diehl, "Mind the Data Voids: Hijacking Copilot Trust to Deliver C2 Instructions" (DEFCON 33). Memory-persistent data exfiltration via M365 Copilot. Related but targets a different feature and attack path.
What you'll get from it
Microsoft Copilot Studio lets people build AI agents that run Python, inside a sandbox watched over by a language model that judges whether the code is safe. Ryan Hausknecht and Simon Maxwell-Stewart describe getting past every layer and reaching secrets such as TLS keys and environment variables. The AI guard itself was the weak point: it behaves inconsistently and leaks its own reasoning, which gives the attacker hints. It's for anyone deploying AI features that run code users give them.