Rocket.Chat: Stored CSS Injection via Image URLs in UIKit Blocks

An authenticated user sends a message with a UIKit block whose image URL breaks out of url(...); the injected CSS applies to the whole application for every viewer.

Advisory ID: TP-2026-158
Product: Rocket.Chat (open-source team chat platform)
Vulnerability type: Stored CSS injection (CWE-79)
CVE: not requested
CVSS 3.1: 5.5 (Medium) · CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:L
Affected versions: verified live on 8.6.1; versions before 9.0.0 do not contain the fix
Fixed in: 9.0.0
Reported: 18 July 2026

Summary

Rocket.Chat is an open-source team chat platform; besides text, messages can contain UIKit blocks with images. The image URL of such a block is written by the client, unescaped, into stylesheet text as background-image: url(...). A URL containing ), ; and } ends the declaration and appends CSS rules of its own that apply to the whole application. An authenticated user with no special rights stores CSS with a single message, and it takes effect in the browser of every user who is shown that message.

Root cause

Line numbers refer to 8.6.1: ImageElement and ImageBlock set the image URL through @rocket.chat/styled as background-image: url(${(props) => props.imageUrl}) (packages/fuselage-ui-kit/src/elements/ImageElement.styles.tsx:11, packages/fuselage-ui-kit/src/blocks/ImageBlock.styles.tsx:20).
@rocket.chat/styled turns this into stylesheet text with css() from @rocket.chat/css-in-js, converts the value with String() only and inserts the result into a <style> element of the page.
The characters ), ;, { and } in imageUrl therefore close url(...) and the surrounding rule and open new rules with any selector.
imageUrl comes from the blocks field of a message, which every authenticated user sets through chat.sendMessage and which is stored unchanged.
The application's Content Security Policy permits the inserted <style> element with style-src 'self' 'unsafe-inline', while script-src without unsafe-inline still prevents script execution.

Proof of Concept

POST /api/v1/chat.sendMessage HTTP/1.1
X-Auth-Token: <token>
X-User-Id: <user id>
Content-Type: application/json

{"message":{"rid":"GENERAL","msg":"x","blocks":[{"type":"section","text":{"type":"plain_text","text":"i"},"accessory":{"type":"image","imageUrl":"https://x/a.png);}body{background:url(//attacker.example/leak)}.z{x:url(y","altText":"a"}}]}}

// Browser of a user who opens #general
getComputedStyle(document.body).backgroundImage
"url(\"http://attacker.example/leak\")"

The value closes the declaration and the component's rule with );}, a separate rule for body follows, and the remainder absorbs the leftover characters of the original rule. Verified on 8.6.1: an account with the role user sends the message, the rule is then present in document.styleSheets and applies to the whole application window; a second account confirmed that injected rules also take effect in other users' browsers. A block of type image reaches the same sink.

Impact

  • Stored CSS from an ordinary user takes effect for every user who is shown the message.
  • Forced requests to external servers when the channel is opened, which can be used to track viewers.
  • Changes to the whole interface, for example overlays for phishing or clickjacking.
  • Limited: no JavaScript execution and no access to sessions.

References

Is Something Like This in Your Software?

Our team found this vulnerability during its work. Have your applications tested by the same specialists, with a penetration test from turingpoint.