CVE-2022-21830
Description
A blind self XSS vulnerability exists in RocketChat LiveChat <v1.9 that could allow an attacker to trick a victim pasting malicious code in their chat instance.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
@rocket.chat/livechatnpm | < 1.9.0 | 1.9.0 |
Affected products
2- RocketChat/LiveChatdescription
Patches
Vulnerability mechanics
Root cause
"Missing output sanitization of user-supplied innerText and rendered Markdown HTML allows injection of arbitrary JavaScript into the LiveChat widget DOM."
Attack vector
An attacker can craft a malicious payload (e.g., an HTML snippet or JavaScript URI) and trick a victim into pasting it into the LiveChat composer input. Because the widget did not sanitize `innerText` before passing it to the `onChange` handler, and did not sanitize the rendered Markdown HTML, the payload would be injected into the page and executed in the victim's browser session. This is a blind self-XSS scenario: the attacker cannot directly inject the payload but relies on social engineering to make the victim paste the malicious content. [CWE-79]
Affected code
The vulnerability resides in `src/components/Composer/index.js` and `src/components/Messages/MessageText/markdown.js`. The `handleInput` callback passed user-supplied `innerText` directly to `onChange` without sanitization, and the `renderMarkdown` function rendered Markdown to HTML without sanitizing the output. Both paths allowed unneutralized user input to be placed into the page DOM, enabling cross-site scripting.
What the fix does
The patch adds the `dompurify` library (version 2.2.6) and imports its `sanitize` function in two files. In `Composer/index.js`, the `handleInput` callback now wraps `this.el.innerText` with `sanitize()` before passing it to `onChange`. In `Messages/MessageText/markdown.js`, the `renderMarkdown` function now passes the output of `md.render()` through `sanitize()`. These changes ensure that any HTML or JavaScript injected via user input is stripped or escaped before being rendered in the DOM, closing the XSS vector.
Preconditions
- configThe victim must be using RocketChat LiveChat version <1.9.
- inputThe attacker must trick the victim into pasting a malicious payload into the LiveChat composer input (social engineering).
Generated on Jun 20, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-hf55-c445-2w97ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-21830ghsaADVISORY
- github.com/RocketChat/Rocket.Chat.Livechat/pull/558ghsaWEB
- github.com/RocketChat/Rocket.Chat.Livechat/releases/tag/v1.9.0ghsaWEB
- hackerone.com/reports/1091118ghsax_refsource_MISCWEB
News mentions
0No linked articles in our index yet.