← Lab /Security & privacy

Inline CSS can exfiltrate attribute values without external stylesheets

CSS inline style conditionals can be used to steal attribute data in Chromium browsers without importing a stylesheet.

Security & privacy PortSwigger Research 26 Aug 2025 Attack Prototype evidence

Published as “Inline Style Exfiltration: leaking data with chained CSS conditionals”

Why it matters

Attackers can exfiltrate user identifiers via CSS injection without needing external resources, expanding the attack surface of web applications.

Summary

The author demonstrates that CSS now supports if-conditionals, which can be placed in an element's inline style attribute. By nesting these conditionals they can test attribute values and trigger background requests to a chosen domain, leaking the value. A proof-of-concept video shows usernames being stolen from a data-username attribute using a Burp Suite custom action. The technique works only on Chromium-based browsers and is limited to simple, enumerable values.

What they found 2

  1. CSS inline style can leak the data-uid attribute when its value is between 1 and 10

    “In the preceding example it can steal the data-uid attribute if it contains a value in the range of 1-10.”

  2. The technique only works on Chromium based browsers

    “Note at the time of writing this technique only works on Chromium based browsers.”

Caveats 7

  • The method is limited to Chromium-based browsers.
  • Only simple, enumerable attribute values can be exfiltrated; complex strings are not supported.
  • Each if statement can test only a single value, requiring extensive nesting for larger value sets.
  • Works only on Chromium-based browsers.
  • Can only check one value per if statement, requiring deep nesting for multiple values.
  • Effective only for non-complex data such as numeric IDs or short usernames.
  • Requires the ability to inject an inline style attribute.

What’s new here 4

  • Shows that CSS if-conditionals can be used in inline styles to trigger network requests.
  • Demonstrates chaining of nested if statements to brute-force attribute values.
  • Provides a Burp Suite custom action to automate value enumeration.
  • Confirms the method works only on Chromium-based browsers.