Skip to content
XSS Disclosed report Beginner

Lack of input validation and sanitization in react-autolinker-wrapper library causes XSS

rugged_info Follow

Originally disclosed on HackerOne

Medium 4.6 View original
  • Triaged in 32 days
  • Fixed in 6 months
  • Disclosed after 7 months

NOTE! Thanks for submitting a report! Please replace all the [square] sections below with the pertinent details. Remember, the more detail you provide, the easier it is for us to triage and respond quickly, so be sure to take your time filling out the report!

I would like to report [XSS] in [react-autolinker-wrapper] It allows [remote arbitrary code execution]

Module

module name: [react-autolinker-wrapper] version: [1.1.0] npm page: https://www.npmjs.com/package/react-autolinker-wrapper

Module Description

React component which automatically converts URLs, email addresses, phone numbers, Twitter handles and hashtags in a string to HTML anchors.

Module Stats

[307] weekly downloads

Vulnerability

Vulnerability Description

Description about how the vulnerability was found and how it can be exploited, how it harms package users (data modification/lost, system access, other.

I expected that calls to react-autolinker-wrapper would find urls, etc. within text and convert them to anchor tags, but I discovered that script execution occurs instead.

Steps To Reproduce:

Below is a vulnerable example of using react-autolinker-wrapper to convert user input into anchor tags. If one inserts <img src=x onerror=alert() > into the input area then XSS occurs.

import React from 'react';
import AutolinkerWrapper from 'react-autolinker-wrapper'

class App extends React.Component {
  constructor(){
    super()
    this.state = {text: "fudge"}
    this.changeState = this.changeState.bind(this)
  }

  changeState(event){
    this.setState({text: event.target.value})
  }

  render(){
    return (
    <div className="App">
     <input placeholder="Place your link here" type="text" onChange={this.changeState}/>
     <AutolinkerWrapper text={this.state.text}/>
    </div>)
  }
}

export default App;

Patch

If you're able to provide a patch with the fix please post it in this section

Supporting Material/References:

State all technical information about the stack where the vulnerability was found

  • Node.js 12.2.0
  • NPM 6.9.0

Wrap up

Select Y or N for the following statements:

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

Hunter's comments and funny memes goes here

Impact

remote code execution

The original report as published on HackerOne, by rugged_info. 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 react-autolinker-wrapper, rated CVSS 4.6. HackerOne made it public on 15 December 2019.

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 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.