By NHI Mgmt Group Editorial TeamDomain: Cyber SecuritySource: PortSwiggerPublished August 11, 2026

TL;DR: Webmail clients often render untrusted CSS inside trusted inbox UIs, and sanitisation gaps can let attackers turn styling into a data-exfiltration primitive, according to PortSwigger. The lesson for identity and access teams is that mailbox trust boundaries, not just message content filters, now need stronger policy and runtime scrutiny.


At a glance

What this is: This is PortSwigger research on how untrusted CSS rendered in webmail can become a covert data exfiltration path if sanitisation and browser trust boundaries are weak.

Why it matters: It matters because identity, access, and security teams must treat inbox rendering as an attack surface where trusted UI context can be abused to reach sensitive data and delegated sessions.

By the numbers:

👉 Read PortSwigger's research on CSS exfiltration inside webmail clients


Context

Webmail is not just a message transport layer. It is a trusted application that renders attacker-controlled content inside a privileged user context, which makes CSS sanitisation a governance problem as much as a browser problem. In identity terms, the real risk is not the stylesheet itself but the way a trusted inbox can be turned into a channel for data exposure and session abuse.

This kind of issue sits at the boundary between application security, identity assurance, and data protection. If a webmail client assumes that stripped-down CSS is harmless, it can still be manipulated into leaking information through layout, timing, or conditional rendering tricks. That creates a practical control gap for programmes that rely on single sign-on, delegated mailbox access, and browser-based access to sensitive communications.


Key questions

Q: How should security teams handle untrusted CSS in webmail clients?

A: Security teams should treat untrusted CSS as executable logic for the purposes of risk assessment. That means testing what the stylesheet can infer, fetch, or conditionally reveal inside a logged-in mailbox session, then constraining those behaviours through sanitisation, sandboxing, and outbound request controls.

Q: Why can authenticated webmail still be unsafe for sensitive communications?

A: Authentication proves the user is allowed into the mailbox, but it does not prove the rendering environment is trustworthy. If untrusted CSS or other client-side content can influence what the browser fetches or reveals, the attacker can abuse the trusted session to leak data without breaking login controls.

Q: What do security teams get wrong about CSS sanitisation?

A: They often assume that removing scripts makes the problem safe enough. In practice, CSS can still create inference channels through selectors, layout, and remote requests, so the control has to be validated against the client's full rendering behaviour rather than against a narrow syntax filter.

Q: Who is accountable when a webmail client leaks data through rendered content?

A: Accountability usually spans application security, platform owners, and the team managing the identity-linked mail environment. If the client renders attacker-controlled content inside a trusted session, then both the rendering policy and the browser boundary should be treated as governed controls under the organisation's security framework.


Technical breakdown

Why untrusted CSS becomes dangerous in webmail clients

Modern webmail clients often allow limited CSS because email rendering depends on styling for layout and usability. The security problem is that CSS is not purely decorative. It can influence visibility, position, selectors, and timing, which gives attackers indirect control over what the user sees and what the client fetches. Sanitisation that strips obvious scripts but leaves complex CSS constructs can still expose conditional logic, remote resource requests, or style-based inference channels. In a trusted inbox, those primitives can be chained into covert disclosure even when JavaScript is blocked.

Practical implication: treat CSS sanitisation as an input-validation control, not a cosmetic filter.

How trusted UI context enables covert data exfiltration

The core abuse pattern is that the email client renders attacker-controlled styles inside an authenticated session that already has access to mailbox content, contacts, or embedded metadata. CSS can be used to encode conditions about the DOM, user state, or secret-bearing elements, then leak the result through network requests, rendering differences, or side effects in the browser. This is why the issue is not limited to classic XSS. The attacker is borrowing the platform's trust boundary and using the rendering engine as an oracle. Once that boundary is crossed, the mailbox becomes a data extraction surface.

Practical implication: restrict external fetches and isolate email rendering from authenticated application context wherever possible.

Why sanitisation alone does not close the mailbox attack surface

Sanitisation reduces risk, but it is not a complete trust model. Email clients differ in how they parse CSS, handle browser quirks, and reconcile sanitised markup with native UI components. Those discrepancies create inconsistent enforcement, which attackers can exploit to find bypasses that are harmless in one client and dangerous in another. This matters in enterprise environments because users often mix webmail, mobile apps, and desktop clients, each with different rendering behaviour. A control that exists only at the filter layer cannot fully govern a multi-client trust boundary.

Practical implication: pair sanitisation with client-specific testing, policy restrictions, and secure rendering isolation.


Threat narrative

Attacker objective: The attacker wants to steal sensitive mailbox data or session-linked information while avoiding the obvious indicators that would accompany script-based exploitation.

  1. Entry begins when the attacker delivers an email containing CSS crafted to survive the target webmail client's sanitisation and render inside the trusted inbox.
  2. Credential or data harvesting occurs when the stylesheet uses conditional rendering or fetch side effects to infer mailbox content, user state, or embedded sensitive values.
  3. Impact follows when the extracted information is exfiltrated without visible script execution, turning the inbox into a covert disclosure channel.

NHI Mgmt Group analysis

CSS sanitisation is now a trust-boundary control, not a rendering nicety. Webmail clients that accept attacker-controlled styling are making a security decision about what can run inside a trusted session. That decision affects data exposure, phishing resilience, and the integrity of identity-linked mailbox workflows. Practitioners should treat inbox rendering as part of the attack surface and not as a passive presentation layer.

Mailbox rendering creates an identity adjacency that many programmes undergovern. Once a user is authenticated, the client often has access to data, metadata, and delegated workflows that sit close to identity controls but outside the IAM console. That creates a verification trust gap: the user is authenticated, yet the browser environment is still hostile. Security teams need to manage that gap explicitly rather than assuming authentication alone resolves it.

CSS-based exfiltration is a form of low-noise data theft that evades script-centric controls. Traditional web security monitoring often prioritises JavaScript payloads, but this technique uses the browser's own layout and request behaviour. That shifts detection requirements toward content security policy, outbound request control, and browser isolation. The practitioner conclusion is that webmail security must be validated against non-script abuse paths, not just XSS.

Browser rendering policy should be governed like any other privileged access path. If a webmail client can render untrusted content inside a high-trust interface, then the organisation has effectively delegated part of its data-access model to the browser engine. That belongs in a formal control review, not an application exception list. Teams should align email rendering controls with NIST SP 800-53 Rev 5 Security and Privacy Controls and OWASP-NHI thinking where identity-linked content can be abused.

Concept: inbox trust boundary erosion. This is the point at which a user-authenticated mailbox stops behaving like a simple communication channel and starts acting like an attackable execution environment for conditional disclosure. The operational implication is that organisations need to test email clients as if they were semi-trusted runtimes, because attackers will. That is where policy, isolation, and monitoring need to meet.

What this signals

Inbox rendering needs to be added to the identity threat model. Organisations already accept that session theft, delegated access, and content injection can intersect, but webmail CSS shows that the browser itself can become part of the trust boundary. That makes email clients a control point for identity-adjacent data leakage, not just a communications tool.

The practical next step is to align mail-client governance with browser isolation, outbound request control, and secure coding reviews for sanitisation logic. Where sensitive credentials or account data travel through email workflows, the security team should treat style rendering as part of the attack chain, and validate it against the same discipline used for other privileged access paths.


For practitioners

  • Harden CSS sanitisation and rendering rules Review which CSS properties, selectors, and remote fetch behaviours are allowed in webmail. Block style constructs that can create conditional requests, timing side channels, or DOM inference paths, and test the allowlist against real email samples rather than only benign templates.
  • Isolate email rendering from authenticated application context Use sandboxing, separate origins, or hardened viewer components so untrusted mail content cannot reach the same browser privileges as core identity sessions. This reduces the chance that mailbox data or delegated tokens can be inferred through client-side behaviour.
  • Test webmail clients for non-script exfiltration paths Add CSS-driven conditional rendering, image fetch side effects, and layout-based inference to your secure testing programme. Include browser, mobile, and desktop mail clients because enforcement differences often determine whether the exploit succeeds.
  • Restrict outbound network paths from mail renderers Limit where the client can fetch content from and log unexpected request patterns from inbox rendering sessions. If the renderer can reach arbitrary external hosts, the attacker has an easier exfiltration channel even when script execution is blocked.

Key takeaways

  • Webmail CSS is a governance issue because trusted inbox rendering can become a covert data-exfiltration channel.
  • Attackers can abuse browser behaviour and sanitisation gaps without using conventional script execution, which makes detection harder.
  • Security teams should test, isolate, and restrict mail rendering as if it were a privileged runtime tied to identity sessions.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST CSF 2.0PR.AC-4Mail rendering inside authenticated sessions affects access control enforcement.
NIST SP 800-53 Rev 5AC-4This issue is fundamentally about controlling information flow from untrusted email content.
MITRE ATT&CKTA0010 , Exfiltration; TA0006 , Credential AccessThe technique can support stealthy data theft and inference of sensitive mailbox content.
OWASP Non-Human Identity Top 10NHI-08Identity-linked content handling can expose secrets and delegated access contexts.

Review mailbox and identity workflows for secret exposure and weak trust boundaries around delegated access.


Key terms

  • CSS sanitisation: CSS sanitisation is the process of removing or constraining stylesheet features that could be abused when untrusted content is rendered. In webmail, it must account for more than visual styling because selectors, fetches, and layout effects can all become security-relevant behaviours.
  • Inbox trust signal: An inbox trust signal is any visible or technical indicator that helps a recipient judge whether an email is legitimate. In this context, the signal only works when it is backed by authentication and lifecycle controls, otherwise it can create misplaced confidence rather than real trust.
  • Exfiltration Channel: An exfiltration channel is any route through which data can leave an organisation, including browsers, cloud apps, email, collaboration tools, removable media, and AI assistants. Effective governance requires visibility across all relevant channels, not just endpoints, because attackers and insiders often choose the path that is least monitored.
  • Rendering isolation: Rendering isolation separates untrusted content from the authenticated session and sensitive browser context used by the rest of the application. It reduces the chance that attacker-controlled markup or styles can influence requests, state, or data visible to the user.

What's in the full report

PortSwigger's full research covers the exploit mechanics and client-specific rendering behaviour this post intentionally leaves at the source:

  • Step-by-step analysis of the CSS sanitisation assumptions that webmail clients rely on
  • Technical examples showing how style-driven side channels can leak data without script execution
  • Client behaviour differences that determine whether the attack succeeds in practice
  • Hands-on exploit discussion that helps defenders reproduce and validate the failure mode

👉 PortSwigger's full post shows the attack mechanics, browser behaviour, and sanitisation gaps in detail

Deepen your knowledge

The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, secrets management, and workload identity in practical terms. It helps identity and security practitioners connect access control decisions to the wider control model their programmes depend on.
NHIMG Editorial Note
Published by the NHIMG editorial team on August 11, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org