
Overview
CVE-2025-32711, nicknamed "EchoLeak," is a critical zero-click vulnerability in Microsoft 365 Copilot that allowed attackers to exfiltrate sensitive organizational data without any user interaction. This repository contains detection and remediation tools to help organizations assess their exposure and implement protective measures.
Demo

PowerShell-based detection and remediation tool demonstration
Vulnerability Details
- CVE ID: CVE-2025-32711
- Nickname: EchoLeak
- CVSS Score: 9.3 (Critical)
- Type: LLM Scope Violation / AI Command Injection
- Affected Product: Microsoft 365 Copilot
- Status: Patched server-side by Microsoft in May 2025
- User Action Required: None (server-side patch applied)
Attack Mechanism
The vulnerability exploits how Microsoft 365 Copilot processes and retrieves data:
- Zero-Click Attack: Attacker sends a specially crafted email containing hidden prompt injections
- Bypass Security: The email bypasses XPIA (Cross-Prompt Injection Attack) classifiers by appearing as user instructions
- Data Exfiltration: When Copilot processes any query, it accesses the malicious email and executes the hidden instructions
- Silent Leakage: Sensitive data from Copilot's context (emails, OneDrive, SharePoint, Teams) is sent to attacker-controlled servers
Repository Structure
cve-2025-32711-detection/
├── README.md # This file
├── detect.ps1 # PowerShell detection script
├── remediate.ps1 # PowerShell remediation script
├── tests/
│ ├── test_detection.ps1 # Detection script test suite
│ └── test_remediation.ps1 # Remediation script test suite
└── logs/ # Directory for log files
Prerequisites
- Windows PowerShell 5.1 or PowerShell 7+
- Administrative privileges on the system
- Microsoft 365 PowerShell modules:
ExchangeOnlineManagement
Microsoft.Graph
AzureAD or AzureAD.Standard.Preview
Installation
- Clone this repository:
git clone https://github.com/daryllundy/cve-2025-32711-detection.git
cd cve-2025-32711-detection
- Install required PowerShell modules:
Install-Module -Name ExchangeOnlineManagement -Force
Install-Module -Name Microsoft.Graph -Force
Install-Module -Name AzureAD -Force
- Connect to Microsoft 365:
Connect-ExchangeOnline
Connect-MgGraph -Scopes "User.Read.All", "Directory.Read.All", "SecurityEvents.Read.All"
Connect-AzureAD
Usage
Detection Script
The detection script checks for:
- Microsoft 365 Copilot deployment status
- Suspicious email patterns indicating prompt injection attempts
- Security configuration vulnerabilities
- Audit log anomalies
Run the detection script:
.\detect.ps1 -OutputPath ".\logs\detection_report.json"
Parameters:
-OutputPath: Path for the detection report (default: .\logs\detection_report.json)
-IncludeEmailAnalysis: Perform deep email analysis (may take longer)
-Days: Number of days to look back in audit logs (default: 30)
The remediation script implements:
- Enhanced email filtering rules
- DLP policies for prompt injection detection
- Audit logging improvements
- Security configuration hardening
Run the remediation script:
.\remediate.ps1 -ConfigPath ".\config\remediation_config.json" -WhatIf
Parameters:
-ConfigPath: Path to remediation configuration file
-WhatIf: Preview changes without applying them
-Force: Apply changes without confirmation prompts
Testing
Run the test suites to verify script functionality:
# Test detection capabilities
.\tests\test_detection.ps1
# Test remediation functions
.\tests\test_remediation.ps1
Detection Indicators
The tool looks for the following indicators of potential exploitation:
-
Email Patterns:
- Emails containing markdown-style links with excessive query parameters
- Messages with hidden instructions targeting AI assistants
- Reference-style markdown links that bypass standard filters
-
Behavioral Anomalies:
- Unusual data access patterns by Copilot service accounts
- Spike in external data transfers
- Suspicious audit log entries related to AI operations
-
Configuration Weaknesses:
- Missing or misconfigured DLP policies
- Inadequate email filtering rules
- Disabled audit logging for AI operations
The remediation script performs the following actions:
-
Email Security:
- Creates mail flow rules to detect prompt injection patterns
- Implements content filtering for AI-specific threats
- Blocks suspicious markdown patterns in emails
-
Data Loss Prevention:
- Creates DLP policies for AI prompt injection detection
- Monitors for data exfiltration patterns
- Alerts on suspicious content combinations
-
Audit and Monitoring:
- Enables comprehensive audit logging
- Creates alert policies for AI-related anomalies
- Configures retention policies for security logs
-
Access Controls:
- Reviews and restricts Copilot data access permissions
- Implements conditional access policies
- Enforces principle of least privilege
Best Practices
- Regular Monitoring: Run the detection script weekly to identify new threats
- Update Patterns: Keep detection patterns updated as new attack variants emerge
- Test Thoroughly: Always use
-WhatIf parameter before applying remediation
- Document Changes: Maintain logs of all security configurations applied
- Stay Informed: Monitor Microsoft security advisories for updates
Limitations
- This tool cannot detect past exploitation if audit logs have been purged
- Server-side patches by Microsoft have already addressed the core vulnerability
- Detection patterns may need updates as attack techniques evolve
- Some remediation actions require specific Microsoft 365 licensing
Support
For issues, questions, or contributions:
- Open an issue in this repository
- Consult Microsoft's official documentation
- Review the Microsoft Security Response Center advisory
References
License
This tool is provided as-is for security assessment purposes. Use at your own risk and ensure compliance with your organization's security policies.