At the Black Hat USA 2026 conference, PortSwigger researcher Gareth Heyes unveiled a novel and alarming class of attacks that leverage Cascading Style Sheets (CSS) to break the security boundaries of major webmail services. The research demonstrates that a malicious HTML email can escape its container and manipulate the trusted user interface of webmail clients like Microsoft Outlook and Google Gmail. These attacks, which do not rely on JavaScript, can be used to create convincing phishing overlays to steal passwords, exfiltrate API tokens, and hijack UI elements, including those for integrated AI assistants. The findings challenge the long-held assumption that sanitized CSS is safe and highlight fundamental flaws in how many webmail clients render untrusted content.
The core of the attack lies in the gap between the CSS properties that a webmail's sanitizer allows and how a modern web browser actually interprets and renders those properties. Attackers can abuse legitimate, 'allow-listed' CSS features to cause content within the email body to be rendered outside of its intended boundaries, overlaying the trusted webmail UI.
For example, an attacker could use CSS properties like position: fixed combined with other tricks to place a fake password input field directly over the legitimate webmail interface. When the user interacts with what they believe is a legitimate prompt, they are actually typing their credentials into the attacker's form within the email.
The research demonstrated successful attacks against a wide array of popular webmail services, indicating a systemic problem rather than a single vendor issue.
This is security research presented at a conference, not evidence of active in-the-wild exploitation. However, with the public disclosure of these techniques, it is highly probable that threat actors will attempt to replicate and weaponize them for phishing and credential theft campaigns.
These attacks represent a significant evolution of phishing, moving beyond simple fake login pages to interactive attacks within the trusted context of the user's own inbox.
The impact of these techniques, if widely adopted by attackers, would be substantial. They undermine a fundamental security assumption of webmail clients. Users are trained to trust the UI of their email provider (the buttons, links, and prompts outside the email body). By allowing malicious content to break out and overlay this trusted UI, these attacks can create phishing lures that are nearly indistinguishable from legitimate requests. This could lead to a significant increase in successful credential theft, account takeovers, and the compromise of data from services connected to the email account.
Detecting these attacks from a user or SOC perspective is extremely difficult, as they are designed to look legitimate. Defense must primarily come from the webmail providers themselves.
Detection for end-users is challenging. The primary advice is user awareness:
For webmail providers, detection involves re-evaluating their sanitization process. This includes Static Analysis (D3-SA) of incoming HTML/CSS to identify potentially dangerous patterns that current sanitizers might miss.
The researcher, Gareth Heyes, provided several recommendations for webmail providers to remediate these flaws:
<iframe>. The sandbox attribute can be used to disable scripting, prevent top-level navigation, and block other dangerous capabilities, creating a much stronger security boundary.For users, there is no direct remediation other than remaining vigilant and waiting for providers to patch their services.
Webmail providers should render emails within a sandboxed iframe to create a strong security boundary and prevent content from escaping.
Implement stricter CSS sanitization to filter out potentially dangerous properties and combinations.
Train users to be suspicious of any unexpected prompts or login screens that appear within their webmail client after opening an email.
The most effective architectural defense for webmail providers against these CSS attacks is to render all email content within a sandboxed <iframe>. This creates a robust security boundary between the untrusted email content and the trusted parent webmail UI. By using the sandbox attribute on the iframe, providers can explicitly disable capabilities like scripting, top-level navigation, and form submissions. This containment strategy ensures that even if a malicious CSS payload is rendered, its effects are confined to the iframe and it cannot overlay, interact with, or manipulate the main application interface. This moves beyond simple content sanitization to true structural isolation, which is far more resilient to novel bypass techniques.
Webmail providers must enhance their server-side sanitization process with more sophisticated static analysis of incoming HTML and CSS. Current sanitizers that rely on simple allow/deny lists for CSS properties are insufficient. A more advanced approach would involve analyzing the relationships between CSS selectors and properties to identify patterns that are likely to cause layout escapes. For example, the sanitizer could flag the combination of position: fixed, high z-index values, and negative positioning coordinates as a high-risk pattern. This requires a deeper, more contextual understanding of how CSS works in modern browsers, moving from a stateless property filter to a stateful layout analysis engine to better predict and block malicious rendering behavior before the email reaches the client.
While the primary responsibility for fixing this lies with webmail providers, user training remains a critical defense-in-depth layer. Security awareness programs should be updated to include this new threat vector. Users should be taught to be extremely suspicious of any pop-up, login form, or permission request that appears within their webmail interface immediately after opening or interacting with an email. A key training point should be: 'The application should not ask you to log in again when you are already logged in.' Users should be instructed to close the suspicious email, navigate to a different part of the application, and if the prompt disappears, report the email as phishing. This helps build a human firewall that can detect attacks that bypass technical controls.
Gareth Heyes presents his research on CSS attacks at the Black Hat USA 2026 conference.

Cybersecurity professional with over 10 years of specialized experience in security operations, threat intelligence, incident response, and security automation. Expertise spans SOAR/XSOAR orchestration, threat intelligence platforms, SIEM/UEBA analytics, and building cyber fusion centers. Background includes technical enablement, solution architecture for enterprise and government clients, and implementing security automation workflows across IR, TIP, and SOC use cases.
CyberNetSec.io uses automation to assist source monitoring, deduplication, observable extraction, and structured intelligence generation. Published analysis follows human-defined editorial standards and adds defensive context including MITRE ATT&CK, D3FEND, STIX, and Sigma where applicable. Read our editorial policy.
Every tactic, technique, and sub-technique used in this threat has been identified and mapped to the MITRE ATT&CK framework for consistent, actionable threat language.
Observables and indicators of compromise (IOCs) have been extracted and cataloged. Risk has been assessed and correlated with known threat actors and historical campaigns.
Detection rules, incident response steps, and D3FEND-aligned mitigation strategies are included so your team can act on this intelligence immediately.
Structured threat data is packaged as a STIX 2.1 bundle and can be visualized as an interactive graph — relationships between actors, malware, techniques, and indicators.
Sigma detection rules are derived from the threat techniques in this article and can be converted for deployment across any major SIEM or EDR platform.