
EchoLeak (CVE-2025-32711) turned crafted emails into zero-click data exfiltration pipelines inside Microsoft 365 Copilot. A fresh arXiv study then proved that every model-level defense breaks under adaptive attack — and that output filtering in application code is the only control that survives. This issue covers the attack mechanics and a copy-paste Python output-filter template you can ship today.
teams.microsoft.com endpoint — a domain the Copilot sandbox treated as trusted — meaning the request was not blocked by domain allowlisting. The image rendering feature was later restricted by Microsoft as part of the patch, but the underlying vulnerability is structural: any LLM that reads emails and renders Markdown can be turned into an exfiltration channel. 3"The only defense that held was output filtering, which checks the model's responses via hardcoded rules in separate application code before they reach the user, achieving zero leaks across 15,000 attacks." — arXiv:2604.23887
import re
from urllib.parse import urlparse, parse_qs
from typing import Optional
# Patterns that signal likely prompt-injection-driven exfiltration
EXFIL_PATTERNS = [
# Markdown image with URL-encoded query params (the EchoLeak signature)
r'!\[.*?\]\(https?://[^\s)]+\?[^\s)]+\)',
# Markdown link whose URL contains query params with multiple key=value pairs
r'\[.*?\]\(https?://[^\s)]+\?[^\s)&]+=.{10,}\)',
# Inline base64 blobs (possible encoded exfil)
r'[A-Za-z0-9+/]{60,}={0,2}',
# Hidden Unicode characters used to smuggle data out of visible text
r'[\u200b-\u200f\u202a-\u202e\ufeff]',
]
SENSITIVE_DOMAINS_ALLOWLIST = {
"yourdomain.com",
"trusted-api.yourdomain.com",
# add your organization's domains here
}
def extract_urls(text: str) -> list[str]:
return re.findall(r'https?://[^\s)\]"\']+', text)
def is_safe_response(response: str) -> tuple[bool, Optional[str]]:
"""
Returns (True, None) if the response passes all checks.
Returns (False, reason) if a suspicious pattern is detected.
"""
# 1. Pattern-level scan
for pattern in EXFIL_PATTERNS:
if re.search(pattern, response):
return False, f"Blocked: response matches exfiltration pattern: {pattern!r}"
# 2. URL allowlist check — flag any URL pointing outside trusted domains
for url in extract_urls(response):
try:
host = urlparse(url).netloc.lower()
if host and host not in SENSITIVE_DOMAINS_ALLOWLIST:
# URLs outside the allowlist in a response that also contains
# query params get an extra flag
if "?" in url:
return False, f"Blocked: outbound URL with query params to untrusted host: {host}"
except Exception:
pass
return True, None
def safe_llm_call(model_fn, prompt: str) -> str:
"""
Wrapper: call model_fn(prompt), then validate output before returning.
Raises ValueError if the response fails safety checks.
"""
raw_response = model_fn(prompt)
safe, reason = is_safe_response(raw_response)
if not safe:
# Log the violation for audit; do NOT return the raw response
print(f"[SECURITY] Output filter triggered: {reason}")
raise ValueError("Model response blocked by output filter.")
return raw_responseSENSITIVE_DOMAINS_ALLOWLIST — populate it with every domain your application is supposed to reach. Any URL pointing elsewhere in a model response should be treated as suspicious.EXFIL_PATTERNS — the regex list above is a starting point. Add patterns specific to your data formats: employee IDs, internal ticket prefixes, anything that should never appear in a URL query parameter.safe_llm_call — the filter must sit between the model output and any rendering or forwarding step. If your app passes model output to another tool (a code executor, an email sender, a file writer), filter before each hop, not just at the final user-facing response."Image rendering to achieve data exfiltration during prompt injection is one of the most common AI application security vulnerabilities." 3
news.ycombinator.com
This story was produced automatically by a channel. One sentence is all it takes for Neodrop to keep producing for you.