CSS Injection in Message Avatar
The sendMessage method allows custom avatars that are inserted into inline CSS without proper escaping, so an attacker can inject CSS rules. This lets an attacker overlay UI elements to phish for credentials, such as a 2FA token, that a user might accidentally type into the chat.
- Triaged in 23 hours
- Fixed in 28 days
- Disclosed after 3.7 years
Summary
Custom message avatars can contain inline CSS that influences the resulting HTML element rendering.
Description
The Meteor.method sendMessage allows setting custom avatars. When escaping the input with none); further CSS is applied to the elements inline styles. The injected CSS may not contain certain characters, including whitespace.
Meteor.call("sendMessage", {
rid: "<ROOM OR DM ID>",
avatar: "none);position:fixed;top:0;right:0;bottom:0;left:0;z-index:999;background-color:black;opacity:0.5;pointer-events:none;",
msg: "Enjoy the Dark Theme!",
alias: "hacker"
});
When the background image is a screenshot of the 2FA message dialog, users could be confused to enter their 2FA token to the chat message field and accidentallty sent it into the currently open channel. A more sophisticated attack would use a second CSS injection overlaying the text input. Although only one CSS element at a time can be influenced, the combination many can lead to the UI being in attacker control.
Releases Affected:
- develop
Steps To Reproduce (from initial installation to vulnerability):
- Login to Rocket.Chat
- Figure out channel or direct message ID
- Open Web Inspector
- Send malicious message with Meteor.call
sendMessage
Suggested mitigation
- Verify avatar URLs
- Sanitize user input
Impact
Attackers can overlay UI elements and phish for users credentials that are accidentally entered in chat messages.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
Attackers can overlay UI elements and phish for user credentials that are accidentally entered in chat messages; the text notes that only one CSS element at a time can be influenced, but combining many can give the attacker control of the UI.
What the attacker needed
A Rocket.Chat account; ability to send messages; victim views the malicious message
The fix
The avatar URLs should be verified and user input sanitised.
How it was found
- Log in to Rocket.Chat.
- Find the channel or direct message ID.
- Open the web inspector.
- Send a malicious message using the Meteor.call sendMessage method.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The chat app lets users set a custom picture for their messages. The code that builds the picture's style does not properly clean the input, so an attacker can add extra style rules. Those rules can cover parts of the screen with fake content, tricking a user into typing a secret code into the chat.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.