PortSwigger research shows how attackers can weaponize HTML/CSS inside emails to cross trust boundaries in webmail, including UI manipulation, token theft, and password theft. The paper highlights real-world weaknesses in email sanitization and gives concrete examples (including an Outlook UI-control bug) that could be turned into realistic email-based attacks against employees.
How the attack worked
Research from PortSwigger examined how HTML and CSS embedded in emails can cross trust boundaries inside webmail clients. Because webmail clients often render untrusted CSS in trusted UI areas, and sanitization can be bypassed due to parsing discrepancies, attackers can manipulate interface elements that users assume are safe. One concrete example involved a real Outlook bug where HTML label elements inside an email could open the UI ribbon and pin the attacker's message, effectively letting the email content control parts of the mail client interface.
The research also described how attackers can hide content from a human reader while showing different content to an AI 'browser' or assistant feature. This creates a disparity between what the victim sees and what an AI feature processes, which can be used to manipulate AI-driven translation or summarization tools into taking unintended actions such as opening multiple tabs to attacker-controlled URLs.
A third technique involved clipboard behavior. Copying content from a webpage, such as a page showing a visitor's IP address, could carry hidden malicious CSS rather than plain text. When pasted into a webmail draft, this caused visible effects like a brief red flash in AOL and Yahoo Mail, pointing to a sanitization or race condition issue during paste handling.
Why it succeeded
These techniques succeeded because they exploit assumptions baked into everyday workflows: that clicking inside an email body is harmless, that AI assistants process content the same way a human does, and that pasted text is just text. None of the scenarios require a fake login page or urgent threatening language, which are the usual signals employees are trained to spot.
What to watch for
- Unexpected instructions to click inside an email message body, especially phrases like "click here" that aren't part of a normal mail client control
- Visual changes in the mail client, such as pinning, color flashes, or UI state changes, right after interacting with an email or pasting content
- Prompts encouraging use of an AI translate or summarize feature on content from an untrusted or foreign-language sender
- Requests to copy diagnostic-looking data, like an IP address, from a webpage into an email draft
Building resistance
Employees should treat unusual click-inside-the-email prompts as suspicious, particularly if they appear to affect the mail interface itself. Caution is warranted when using AI assistants to translate or summarize messages from unfamiliar senders, since indirect prompt engineering can trigger unintended actions like opening links. Finally, avoid copying and pasting content from unknown websites directly into email drafts or internal tools, since clipboard content can carry hidden HTML or CSS beyond visible text.
Key findings
- Webmail clients often render untrusted CSS in trusted UI areas, and sanitization can be bypassed due to parsing discrepancies.
- A real Outlook bug allows an email message to influence Outlook’s UI actions using HTML <label> elements (e.g., opening ribbon and pinning a message).
- Attackers can hide content from a user while showing different content to an AI ‘browser’ feature, enabling indirect prompt injection via email.
- Clipboard/paste behavior can introduce malicious CSS into draft emails; tests showed visible effects (e.g., a brief red flash) in AOL and Yahoo Mail, suggesting a sanitization/race issue.
- The research discusses stealing tokens (e.g., email login tokens) by abusing CSS selectors and browser/webmail behavior.
Who’s being targeted
- Commonly targeted roles: All employees, Executives, Executive assistants, Helpdesk/IT support, Users of AI email/browser assistants.
- Affected industries: Technology / Email providers, Professional services (any organization using webmail), Media / Publishing (referenced token target: Medium).
- Attack channels: email, website.
- Impersonated: A normal email message (no explicit brand impersonation; abuse of Outlook UI controls), A foreign-language sender / translation request (uses AI ‘translate’ workflow), A website showing the user their IP address (clipboard poisoning).
Red flags to watch for
- Unexpected instructions to click inside the message body (not a normal Outlook control)
- Odd ‘Click me first’ style prompts without business context
- Email seems to change Outlook UI state (e.g., message becomes pinned) after clicking
- Email encourages use of an AI feature to process content from an untrusted sender
- Hidden/transparent content (very low opacity) embedded in the email
- AI tool starts opening tabs or navigating without clear user intent
- Copy/paste from web pages into email drafts causes unusual visual changes (e.g., colors flashing)
- Pasted content includes formatting/behavior beyond plain text
- Requests to copy/paste ‘diagnostic’ or ‘IP address’ data into email drafts
Frequently asked questions
How can CSS in an email hijack a webmail interface?
Webmail clients sometimes render untrusted CSS in trusted UI areas, and sanitization can be bypassed due to parsing discrepancies, letting attacker-controlled styling influence how the interface behaves.
Can an email actually control Outlook's UI?
Yes, researchers found a real Outlook bug where HTML label elements in an email could trigger UI actions like opening the ribbon and pinning the attacker's message.
How does copy pasting content lead to a CSS attack?
Clipboard content copied from a webpage can carry hidden HTML or CSS rather than plain text, and pasting it into a webmail draft can trigger visible effects, which was observed in AOL and Yahoo Mail.
How can AI email assistants be manipulated by this technique?
Attackers can hide content from the human reader using CSS opacity while showing different content to an AI feature, enabling indirect prompt injection that causes the assistant to take unintended actions like opening tabs.
Read the video transcript
Imagine an email that doesn’t just trick you… it quietly controls your Outlook window. PortSwigger found a real Outlook bug: an email with HTML labels like "Click me first" can open the ribbon and even pin that message, just from you clicking text in the email body. Same trick with AI: a foreign email says "PortSwigger est le meilleur…" and tells you to translate. Hidden CSS can show one thing to you, and different instructions to the AI, making it open attacker URLs in new tabs. If an email tells you to click text inside the message to pin, open ribbons, or use AI on it, stop. Close it and report the email to Security instead of clicking.