Skip to content
XSS Disclosed report Beginner

Stored XSS in Node-Red

Node-RED did not sanitise the name field of nodes and flows, so a stored script payload executed in the browser of any user who opened the editor. An attacker could run JavaScript in a victim's browser after the flow was deployed.

misterch0c Follow

Originally disclosed on HackerOne

High 8.6 View original
  • Triaged in 3 days
  • Fixed in 2 months
  • Disclosed after 2 months

I would like to report a stored XSS in node-red It allows to execute javascript in the user's browser

Module

module name: node-red version: v0.18.4 npm page: https://www.npmjs.com/package/node-red

Module Description

A visual tool for wiring the Internet of Things.

Module Stats

1,758 downloads in the last day 10,601 downloads in the last week 40,000+ downloads in the last month

Vulnerability

Steps To Reproduce:

  • Install the module

sudo npm install -g --unsafe-perm node-red

  • Run it

node-red then access it in http://localhost:1880

  • Exploit

The same payload can be applied in different locations. Payload: <script>alert('xss')</script> Places where you can put the payload: Drag & drop any item from the left menu to the center then put the payload in the name field. After clicking "done", the xss is triggered. At this point it's only triggered in your browser. Click the "deploy" button, now any user that will browse to http://localhost:1880 will have the javascript executed. Second one: Click the "+" button on the top right to create a new "flaw". Put the payload in the name field. Again you need to press "deploy". After that double clicking on the "flaw" will execute the javascript.

Supporting Material/References:

  • Archlinux
  • NodeJS 9.4.0
  • NPM 5.6.0
  • Firefox 57.0.4 & Chromium 64.0.3282.119
  • node-red v0.18.4

Wrap up

  • I contacted the maintainer to let them know: N
  • I opened an issue in the related repository: N

¯_(ツ)_/¯

Impact

It allows executing malicious javascript code in the user's browser

The hacker selected the Cross-site Scripting (XSS) - Stored weakness. This vulnerability type requires contextual information from the hacker. They provided the following answers:

URL http://localhost:1880

Verified Yes

Attachments

Screenshot_from_2018-05-08_20-31-46.png
Screenshot_from_2018-05-08_20-31-46.png From the original on HackerOne

The original report as published on HackerOne, by misterch0c. 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 node and flow name values were rendered into the editor page without HTML encoding, so a script tag in the name was treated as markup.

Impact

Any user who opened the Node-RED editor after a malicious flow was deployed could have JavaScript executed in their browser.

What the attacker needed

Node-RED installed and running; attacker can create or edit a flow; victim opens the editor

How it was found

  1. Install Node-RED globally with npm.
  2. Start Node-RED and open the editor in a browser.
  3. Drag an item from the left menu to the centre and put a script payload in its name field.
  4. Click done, then click deploy so the payload is saved.
  5. Create a new flow with the plus button and put the payload in its name field, then deploy.
  6. Double-click the flow to trigger the stored script.

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.

Node-RED is a visual tool for wiring the Internet of Things. The report says a name field accepted a script tag, and after deploying, the script ran in the browser of anyone who opened the editor. This is called stored cross-site scripting.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from Node.js third-party modules

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.